2006-03-30 Eric Seidel <eseidel@apple.com>
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2006-03-30  Eric Seidel  <eseidel@apple.com>
2
3         Reviewed by anders.
4
5         Small code-style update.
6
7         * kjs/operations.cpp:
8         (KJS::isNaN):
9         (KJS::isInf):
10         (KJS::isPosInf):
11         (KJS::isNegInf):
12         (KJS::equal):
13         (KJS::strictEqual):
14         (KJS::relation):
15         (KJS::maxInt):
16         (KJS::minInt):
17         (KJS::add):
18         (KJS::mult):
19
20 2006-03-31  Anders Carlsson  <andersca@mac.com>
21
22         Reviewed by Maciej.
23
24         Make sure the GetterSetterImp objects are marked as well.
25         
26         * kjs/internal.cpp:
27         (KJS::GetterSetterImp::mark):
28         Call JSCell::mark().
29
30 2006-03-30  Eric Seidel  <eseidel@apple.com>
31
32         Reviewed by ggaren.
33
34         * kjs/nodes.h: Some various small style fixes.
35
36 2006-03-30  Eric Seidel  <eseidel@apple.com>
37
38         Reviewed by ggaren.
39
40         Clean-up style issues in node.h, remove redundant initializations.
41
42         * kjs/nodes.h:
43         (KJS::StatementNode::evaluate):
44         (KJS::ArrayNode::ArrayNode):
45         (KJS::ObjectLiteralNode::ObjectLiteralNode):
46         (KJS::ArgumentsNode::ArgumentsNode):
47         (KJS::NewExprNode::NewExprNode):
48         (KJS::CaseClauseNode::CaseClauseNode):
49         (KJS::FuncDeclNode::FuncDeclNode):
50
51 2006-03-30  Tim Omernick  <timo@apple.com>
52
53         Reviewed by Geoff.
54
55         <rdar://problem/4212626> REGRESSION: LIVECONNECT: JavaScript type for Java Strings is function,
56         not object
57
58         * bindings/runtime.h:
59         (KJS::Bindings::Instance::implementsCall):
60         New method.  Returns false by default.  Concrete subclasses can override this return true when
61         the bound object may be called as a function.
62         (KJS::Bindings::Instance::invokeDefaultMethod):
63         Since bound objects are no longer treated as functions by default, we can return jsUndefined()
64         here instead of in concrete subclasses that decide not to implement the default method
65         functionality.
66
67         * bindings/runtime_object.cpp:
68         (RuntimeObjectImp::implementsCall):
69         Don't assume that the bound object is a function; instead, let the object instance decide whether
70         it is callable.
71
72         * bindings/c/c_instance.h:
73         * bindings/c/c_instance.cpp:
74         (KJS::Bindings::CInstance::implementsCall):
75         The object is callable if its class has an invokeDefault function.
76
77         * bindings/objc/objc_instance.h:
78         * bindings/objc/objc_instance.mm:
79         (ObjcInstance::implementsCall):
80         The object is callable if the ObjC instance responds to -invokeDefaultMethodWithArguments:.
81
82         * bindings/jni/jni_instance.h:
83         * bindings/jni/jni_instance.cpp:
84         Moved bogus invokeDefaultMethod() to superclass.
85
86 2006-03-29  Geoffrey Garen  <ggaren@apple.com>
87
88         Reviewed by Darin.
89
90         - JavaScriptCore side of fix for <rdar://problem/4308243> 8F36 
91         Regression: crash in malloc_consolidate if you use a .PAC file
92
93         The crash was a result of threaded deallocation of thread-unsafe
94         objects. Pure JS objects are thread-safe because all JS execution
95         is synchronized through JSLock. However, JS objects that wrap WebCore 
96         objects are thread-unsafe because JS and WebCore execution are not 
97         synchronized.  That unsafety comes into play when the collector 
98         deallocates a JS object that wraps a WebCore object, thus causing the 
99         WebCore object to be deallocated.
100
101         The solution here is to have each JSCell know whether it is safe to
102         collect on a non-main thread, and to avoid collecting unsafe cells
103         when on a non-main thread.
104
105         We don't have a way to test PAC files yet, so there's no test
106         attached to this patch.
107
108         * kjs/collector.cpp:
109         (KJS::Collector::collect):
110         (1) Added the test "currentThreadIsMainThread || 
111         imp->m_destructorIsThreadSafe". 
112
113         * kjs/protect.h:
114         (KJS::gcProtectNullTolerant):
115         (KJS::gcUnprotectNullTolerant):
116         * kjs/value.h:
117         (KJS::JSCell::JSCell): The bools here must be bitfields, otherwise
118         m_destructorIsThreadSafe becomes another whole word, ruining the
119         collector optimizations we've made based on the size of a JSObject.
120         * kxmlcore/FastMalloc.cpp:
121         (KXMLCore::currentThreadIsMainThread):
122         (KXMLCore::fastMallocRegisterThread):
123         * kxmlcore/FastMalloc.h:
124
125 2006-03-28  Darin Adler  <darin@apple.com>
126
127         Reviewed by Geoff.
128
129         - change some code that resulted in init routines on Mac OS X -- if the framework has
130           init routines it will use memory and slow down applications that link with WebKit
131           even in cases where those applications don't use WebKit
132
133         * kjs/date_object.cpp: Changed constants that were derived by multiplying other constants
134         to use immediate numbers instead. Apparently, double constant expressions of the type we
135         had here are evaluated at load time.
136
137         * kjs/list.cpp: Can't use OwnArrayPtr in ListImp because of the global instances of
138         ListImp, so go back to using a plain old pointer.
139         (KJS::List::List): Set overflow to 0 when initializing ListImp.
140         (KJS::List::release): Replace a clear call with a delete and explicit set to 0.
141         (KJS::List::append): Use raw pointers, and do a delete [] instead of finessing it with
142         a swap of OwnArrayPtr.
143         (KJS::List::copyFrom): Remove now-unneeded get().
144         (KJS::List::copyTail): Ditto.
145
146         * kjs/ustring.cpp: Changed UString::Rep::empty initializer a bit so that it doesn't get
147         a static initializer routine. Had to get rid of one level of constant to get the compiler
148         to understand it could initialize without any code.
149
150         - added a build step that checks for init routines
151
152         * JavaScriptCore.xcodeproj/project.pbxproj: Deleted now-unused custom build rule that
153         was replaced by the generate-derived-sources script a while back. Added a custom build
154         phase that invokes the check-for-global-initializers script.
155
156 2006-03-28  Timothy Hatcher  <timothy@apple.com>
157
158         Reviewed by Eric.
159
160         fixes <rdar://problem/4458539> Unable to include Security(public) and WebKit(private) headers
161
162         * bindings/npapi.h: added #defines after the #ifndefs
163
164 2006-03-27  Maciej Stachowiak  <mjs@apple.com>
165
166         Reviewed by Anders.
167         
168         - fixed <rdar://problem/4489745> REGRESSION: Safari crashes at to display http://www.lgphilips-lcd.com/
169
170         * kjs/nodes.cpp:
171         (Node::deref): take into account the case where the extra refcount table was never created
172
173 2006-03-23  David Carson <dacarson@gmail.com>
174
175         Reviewed by Darin.
176         
177         - JSObject in LiveConnect not working.
178         http://bugzilla.opendarwin.org/show_bug.cgi?id=7917
179
180         * bindings/jni_jsobject.cpp:
181         (JavaJSObject::convertJObjectToValue): Was trying to retrieve the native pointer from the wrong base
182         class, and the GetFieldID was using the wrong signature.
183
184 2006-03-23  Darin Adler  <darin@apple.com>
185
186         Reviewed by Maciej.
187
188         - fix buildbot
189
190         * JavaScriptCore.xcodeproj/project.pbxproj: Change target name to JavaScriptCore (it was "include"!?).
191         Also add -Y 3 option for linker.
192
193 2006-03-23  Darin Adler  <darin@apple.com>
194
195         Reviewed by Maciej.
196
197         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7726
198           REGRESSION: orbitz calendar fails (JavaScript function serialization/parsing)
199
200         * kjs/object.h: Take function name, as well as source URL and line number, when
201         using the special overloaded construct for making functions.
202         * kjs/object.cpp: (KJS::JSObject::construct): Ditto.
203         * kjs/function_object.h: Ditto.
204         * kjs/function_object.cpp: (FunctionObjectImp::construct): Pass a name when
205         constructing the function rather than null. Use "anonymous" when making a
206         function using the default function constructor.
207
208         * kjs/nodes2string.cpp: (FuncDeclNode::streamTo): Put a line break just before
209         a function declaration.
210
211         - unrelated fix
212
213         * kxmlcore/HashMapPtrSpec.h: Add missing needed friend declaration.
214
215 2006-03-23  Darin Adler  <darin@apple.com>
216
217         Reviewed by Maciej.
218
219         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7805
220           LEAK: method name leaks in KJS::Bindings::CInstance::invokeMethod
221
222         * bindings/c/c_utility.h: Remove NPN_UTF16FromString declaration (not implemented).
223         * bindings/c/c_utility.cpp:
224         (KJS::Bindings::convertValueToNPVariant): Use DOUBLE_TO_NPVARIANT,
225         BOOLEAN_TO_NPVARIANT, VOID_TO_NPVARIANT, NULL_TO_NPVARIANT, and
226         OBJECT_TO_NPVARIANT. In the case of OBJECT, call _NPN_RetainObject in
227         one case and remove a _NPN_ReleaseObject in another because this
228         should return a retained value.
229         (KJS::Bindings::convertNPVariantToValue): Use NPVARIANT_TO_BOOLEAN,
230         NPVARIANT_TO_INT32, and NPVARIANT_TO_DOUBLE.
231
232         * bindings/c/c_runtime.h: Removed implementations of CMethod::name and
233         CField::name that called _NPN_UTF8FromIdentifier and hence leaked.
234         * bindings/c/c_runtime.cpp:
235         (KJS::Bindings::CMethod::name): Added. Returns the string from inside the
236         method object.
237         (KJS::Bindings::CField::name): Added. Returns the string from inside the
238         field object.
239         (KJS::Bindings::CField::valueFromInstance): Added call to _NPN_ReleaseVariantValue
240         on the result of getProperty after using it to fix a storage leak.
241         (KJS::Bindings::CField::setValueToInstance): Added call to _NPN_ReleaseVariantValue
242         after pasing a value to setProperty now that the conversion function does a retain.
243
244         * bindings/c/c_instance.cpp:
245         (KJS::Bindings::CInstance::invokeMethod): Changed to use Vector for a local
246         stack buffer. Removed special case for NPVARIANT_IS_VOID because the
247         convertNPVariantToValue function handles that properly.
248         (KJS::Bindings::CInstance::invokeDefaultMethod): Ditto.
249
250         * bindings/NP_jsobject.h: Formatting changes only.
251         * bindings/NP_jsobject.cpp:
252         (jsDeallocate): Changed parameter type so we don't need a function cast.
253         (_NPN_InvokeDefault): Use VOID_TO_NPVARIANT.
254         (_NPN_Invoke): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
255         (_NPN_Evaluate): Use VOID_TO_NPVARIANT.
256         (_NPN_GetProperty): Use NULL_TO_NPVARIANT and VOID_TO_NPVARIANT.
257
258         * bindings/c/c_class.cpp: Formatting changes only.
259         * bindings/c/c_class.h: Formatting changes only.
260
261         * bindings/npruntime_priv.h: Removed obsolete and now-unused functions:
262         NPN_VariantIsVoid, NPN_VariantIsNull, NPN_VariantIsUndefined,
263         NPN_VariantIsBool, NPN_VariantIsInt32, NPN_VariantIsDouble,
264         NPN_VariantIsString, NPN_VariantIsObject, NPN_VariantToBool,
265         NPN_VariantToInt32, NPN_VariantToDouble, NPN_VariantToString,
266         NPN_VariantToStringCopy, NPN_VariantToObject, NPN_InitializeVariantAsVoid,
267         NPN_InitializeVariantAsNull, NPN_InitializeVariantAsUndefined,
268         NPN_InitializeVariantWithBool, NPN_InitializeVariantWithInt32,
269         NPN_InitializeVariantWithDouble, NPN_InitializeVariantWithString,
270         NPN_InitializeVariantWithObject, and NPN_InitializeVariantWithVariant.
271         * bindings/npruntime.cpp:
272         (getIntIdentifierDictionary): Don't bother creating custom callbacks for the
273         integer dictionary since the default behavior is fine for integers.
274
275 2006-03-23  Mark Rowe  <opendarwin.org@bdash.net.nz>
276
277         Reviewed and landed by Maciej.
278
279         - WebKit no longer builds with bison 2.1
280         http://bugzilla.opendarwin.org/show_bug.cgi?id=7923
281
282         * generate-derived-sources:  Handle generated header named either grammar.cpp.h
283         or grammar.hpp.
284
285 2006-03-22  Maciej Stachowiak  <mjs@apple.com>
286
287         - fix the build
288
289         * JavaScriptCore.xcodeproj/project.pbxproj:
290
291 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
292
293         * kjs/generate-derived-sources: Set executable property.
294
295 2006-03-21  Maciej Stachowiak  <mjs@apple.com>
296
297         Reviewed by Darin.
298         
299         Ensure that generated source dependencies are handled properly, as follows:
300         
301         - Made an external script that generates the sources into a
302           DerivedSources dir in the build products directory.
303         - Added a new build target that builds all the generated sources
304           if needed. Sadly it has to be a target, not a phase for Xcode to notice changes.
305         - Added the DerivedSources dir in question to the include path.
306         - Added the new DerivedSources dir and its contents to the project as build-relative.
307         
308         * JavaScriptCore.xcodeproj/project.pbxproj:
309         * kjs/generate-derived-sources: Added. Based on the windows version - maybe someday they
310         can share more.
311
312 2006-03-11  Maciej Stachowiak  <mjs@apple.com>
313
314         Reviewed by Darin.
315         
316         - fixed "charAt layout test fails on intel macs; some NaNs are printed as -NaN"
317         http://bugzilla.opendarwin.org/show_bug.cgi?id=7745
318
319         * kjs/ustring.cpp:
320         (KJS::UString::from): Use "NaN" for all NaN values, regardless of sign.
321
322 2006-03-16  Maciej Stachowiak  <mjs@apple.com>
323
324         Reviewed by Darin.
325         
326         - tweaks to my change to redo KJS::Node refcounting
327
328         * kjs/nodes.cpp:
329         (Node::ref):
330         (Node::deref):
331         (Node::refcount):
332         (Node::clearNewNodes):
333         * kjs/nodes.h:
334
335 2006-03-16  Darin Adler  <darin@apple.com>
336
337         Reviewed by Maciej.
338
339         - fixed Vector so that you can pass a reference to something in the vector
340           to the append or insert functions
341
342         * kxmlcore/Vector.h:
343         (KXMLCore::Vector::expandCapacity): Added new overloads that take a pointer to adjust
344         and return the adjusted value of the pointer.
345         (KXMLCore::Vector::append): Pass a pointer when expanding the vector, and use it when
346         adding the new element. Makes the case where the element moves when the vector
347         is expanded work.
348         (KXMLCore::Vector::insert): Ditto.
349
350 2006-03-15  Eric Seidel  <eseidel@apple.com>
351
352         Reviewed by adele.
353
354         Build fix.
355
356         * kjs/date_object.cpp:
357         (KJS::DateProtoFunc::callAsFunction): use size() not "len()"
358
359 2006-03-15  Eric Seidel  <eseidel@apple.com>
360
361         Reviewed by mjs.
362
363         Fix CString copy constructor, fixes Date.parse("") on Win32.
364
365         * kjs/date_object.cpp:
366         (KJS::DateProtoFunc::callAsFunction):
367         * kjs/ustring.cpp:
368         (KJS::CString::CString):
369         (KJS::CString::operator=):
370
371 2006-03-13  Maciej Stachowiak  <mjs@apple.com>
372
373         Reviewed by Anders.
374         
375         - KJS::Node and KJS::StatementNode are bigger than they need to be
376         http://bugzilla.opendarwin.org/show_bug.cgi?id=7775
377
378         The memory usage of Node was reduced by 2 machine words per node:
379
380         - sourceURL was removed and only kept on FunctionBodyNode. The
381         source URL can only be distinct per function or top-level program node, 
382         and you always have one.
383         
384         - refcount was removed and kept in a separate hashtable when
385         greater than 1. newNodes set represents floating nodes with
386         refcount of 0. This helps because almost all nodes have a refcount of 1
387         for almost all of their lifetime.
388         
389         * bindings/runtime_method.cpp:
390         (RuntimeMethod::RuntimeMethod): Pass null body, added FIXME.
391         * kjs/Parser.cpp:
392         (KJS::clearNewNodes): New nodes are tracked in nodes.cpp now, but still clear
393         them at the appropriate time.
394         * kjs/context.h:
395         (KJS::ContextImp::currentBody): added; used to retrieve source URL and sid
396         for current code.
397         (KJS::ContextImp::pushIteration): moved here from LabelStack
398         (KJS::ContextImp::popIteration): ditto
399         (KJS::ContextImp::inIteration): ditto
400         (KJS::ContextImp::pushSwitch): ditto
401         (KJS::ContextImp::popSwitch): ditto
402         (KJS::ContextImp::inSwitch): ditto
403         * kjs/function.cpp:
404         (KJS::FunctionImp::FunctionImp): Add FunctionBodyNode* parameter.
405         (KJS::FunctionImp::callAsFunction): Pass body to ContextImp.
406         (KJS::FunctionImp::argumentsGetter): _context renamed to m_context.
407         (KJS::DeclaredFunctionImp::DeclaredFunctionImp): Pass body to superclass
408         constructor.
409         (KJS::GlobalFuncImp::callAsFunction): Pass progNode as body for ContextImp in
410         eval.
411         * kjs/function.h: Move body field from DeclaredFunctionImp to
412         FunctionImp.
413         * kjs/grammar.y: Change DBG; statements no longer have a sourceid.
414         * kjs/internal.cpp:
415         (KJS::ContextImp::ContextImp): Initialize new m_currentBody, m_iterationDepth
416         and m_switchDepth data members. New FunctionBodyNode* parameter - the
417         function body provides source URL and SourceId.
418         (KJS::InterpreterImp::mark): Use exception() function, not _exception directly.
419         (KJS::InterpreterImp::evaluate): Pass progNode to ContextImp constructor
420         to use as the body.
421         * kjs/internal.h:
422         (KJS::LabelStack::LabelStack): Remove iteration depth and switch depth;
423         statement label stacks don't need these and it bloats their size. Put them
424         in the ContextImp instead.
425         * kjs/interpreter.cpp:
426         (KJS::ExecState::lexicalInterpreter): Renamed _context to m_context.
427         * kjs/interpreter.h:
428         (KJS::ExecState::dynamicInterpreter): Renamed _context to m_context.
429         (KJS::ExecState::context): ditto
430         (KJS::ExecState::setException): Renamed _exception to m_exception
431         (KJS::ExecState::clearException): ditto
432         (KJS::ExecState::exception): ditto
433         (KJS::ExecState::hadException): ditto
434         (KJS::ExecState::ExecState): ditto both above renames
435         * kjs/nodes.cpp:
436         (Node::Node): Removed initialization of line, source URL and refcount. Add to
437         local newNodes set instead of involving parser.
438         (Node::ref): Instead of managing refcount directly, story refcount over 1 in a
439         HashCountedSet, and keep a separate HashSet of "floating" nodes with refcount
440         0.
441         (Node::deref): ditto
442         (Node::refcount): ditto
443         (Node::clearNewNodes): Destroy anything left in the new nodes set.
444         (currentSourceId): Inline helper to get sourceId from function body via context.
445         (currentSourceURL): ditto for sourceURL.
446         (Node::createErrorCompletion): use new helper
447         (Node::throwError): ditto
448         (Node::setExceptionDetailsIfNeeded): ditto
449         (StatementNode::StatementNode): remove initialization of l0 and sid, rename
450         l1 to m_lastLine.
451         (StatementNode::setLoc): Set own m_lastLine and Node's m_line.
452         (StatementNode::hitStatement): Get sid, first line, last line in the proper new ways.
453         (StatListNode::StatListNode): updated for setLoc changes
454         (BlockNode::BlockNode): ditto
455         (DoWhileNode::execute): excpect iteraton counts on ContextImp, not LabelStack
456         (WhileNode::execute): ditto
457         (ForNode::execute): ditto
458         (ForInNode::execute): ditto
459         (ContinueNode::execute): excpect inIteration on ContextImp, not LabelStack
460         (BreakNode::execute): excpect inIteration and inSwitch on ContextImp, not LabelStack
461         (SwitchNode::execute): expect switch counts on ContextImp, not LabelStack
462         (FunctionBodyNode::FunctionBodyNode): update for new setLoc
463         (FunctionBodyNode::processFuncDecl): reindent
464         (SourceElementsNode::SourceElementsNode): update for new setLoc
465         * kjs/nodes.h:
466         (KJS::Node::lineNo): Renamed _line to m_line
467         (KJS::StatementNode::firstLine): Use lineNo()
468         (KJS::StatementNode::lastLine): Renamed l1 to m_lastLine
469         (KJS::FunctionBodyNode::sourceId): added
470         (KJS::FunctionBodyNode::sourceURL): added
471         * kjs/testkjs.cpp:
472
473 2006-03-14  Geoffrey Garen  <ggaren@apple.com>
474
475         - Fixed <rdar://problem/4478239> string sort puts "closed" before 
476         "close"
477
478         Reviewed by Eric.
479
480         * kjs/ustring.cpp:
481         (KJS::compare): Inverted a < in order to treat the longer string as > 
482         the shorter string.
483
484 2006-03-12  Alexey Proskuryakov  <ap@nypop.com>
485
486         Reviewed by Maciej.
487
488         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7708
489         REGRESSION: Flash callback to JavaScript function not working.
490
491         Test: plugins/invoke.html
492
493         * bindings/c/c_utility.cpp:
494         (KJS::Bindings::convertUTF8ToUTF16): Return a correct string length.
495
496 2006-03-08  Eric Seidel  <eseidel@apple.com>
497
498         Reviewed by darin.
499
500         Partially fix JS on win32 by fixing hash table generation.
501
502         * kjs/create_hash_table: limit << results to 32 bits.
503         * kjs/testkjs.cpp:
504         (TestFunctionImp::callAsFunction):
505
506 2006-03-07  Darin Adler  <darin@apple.com>
507
508         * kxmlcore/Vector.h: Quick fix to try to get Windows compiling again.
509
510 2006-03-07  Darin Adler  <darin@apple.com>
511
512         Reviewed by Anders.
513
514         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
515           unwanted output while running layout tests
516
517         * kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
518         * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
519         to standard output. I think we should arrange for the error text to be in JavaScript
520         exceptions instead at some point.
521         * kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
522         too-large size rather than allocating a buffer smaller than requested.
523
524 2006-03-06  David Carson <dacarson@gmail.com>
525
526         Reviewed by Darin, landed by ap.
527
528         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=7582
529         c_utility.cpp contains CFString OS X platform-dependent code; should use ICU
530
531         Tested with test case from:
532         http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
533
534         * bindings/c_utility.cpp
535         (convertUTF8ToUTF16): Changed to using Unicode converter from ICU, and manual Latin-1 conversion.
536         * icu/unicode/ucnv.h: Copied from WebCore.
537         * icu/unicode/ucnv_err.h: Ditto.
538         * icu/unicode/uenum.h: Ditto.
539
540 2006-03-05  Darin Adler  <darin@apple.com>
541
542         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Updated.
543
544 2006-03-06  Mitz Pettel  <opendarwin.org@mitzpettel.com>
545
546         Fix suggested by Alexey Proskuryakov <ap@nypop.com>, reviewed by Maciej and Hyatt.
547         
548         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7601
549           REGRESSION (r13089): Reproducible crash dereferencing a deallocated element on google image search
550
551         * kxmlcore/Platform.h: Corrected the define to enable USE(MULTIPLE_THREADS) on Mac OS X.
552
553 2006-03-05  Darin Adler  <darin@apple.com>
554
555         Reviewed by Maciej.
556
557         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7616
558           get all references to KJS::Node out of internal.h
559
560         * JavaScriptCore.xcodeproj/project.pbxproj: Updated for file changes.
561
562         * kjs/Parser.cpp: Added.
563         * kjs/Parser.h: Added.
564
565         * kjs/internal.cpp: Removed the Parser class.
566         * kjs/internal.h: Ditto. Also removed unnecessary declarations of classes
567         not used in this header.
568
569         * kjs/nodes.h: Added an include of "Parser.h".
570         * kjs/function.h: Added a declaration of FunctionBodyNode.
571
572 2006-03-05  Geoffrey Garen  <ggaren@apple.com>
573
574         Reviewed by Maciej.
575
576         - JSC support for the fix for <rdar://problem/4467143> JavaScript 
577         enumeration of HTML element properties skips DOM node properties
578
579         * kjs/lookup.h: 
580         (1) Added the KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macro. The 
581         class definiton macro needs to know about the prototype's prototype so 
582         that the class constructor properly sets it. 
583         (2) Removed the KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT macro. The class
584         implementation macro does not need to know about the prototype's
585         prototype, since getOwnPropertySlot should only look in the current 
586         object's property map, and not its prototype's.
587
588 2006-03-05  Andrew Wellington  <proton@wiretapped.net>
589
590         Reviewed by Eric, landed by ap.
591         
592         - Remove unused breakpoint bool from StatementNodes. No test provided as
593         there is no functionality change.
594
595         * kjs/nodes.cpp:
596         (StatementNode::StatementNode):
597         * kjs/nodes.h:
598
599 2006-03-03  Geoffrey Garen  <ggaren@apple.com>
600
601         Reviewed by Darin.
602
603         - Fixed <rdar://problem/4465598> REGRESSION (TOT): Crash occurs at 
604         http://maps.google.com/?output=html ( KJS::Identifier::add(KJS::UString::Rep*)
605
606         This regression was caused by my fix for 4448098. I failed to account for the
607         deleted entry sentinel in the mehtod that saves the contents of a property map to 
608         the back/forward cache.
609
610         Manual test in WebCore/manual-tests/property-map-save-crash.html
611
612         * kjs/property_map.cpp:
613         (KJS::deletedSentinel): Use 1 instead of -1 to facilitate an easy bit mask
614         (KJS::isValid): New function: checks if a key is null or the deleted sentinel
615         (KJS::PropertyMap::~PropertyMap): Fixed up the branch logic here for readability
616         and a slight performance win
617         (KJS::PropertyMap::clear):
618         (KJS::PropertyMap::rehash):
619         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
620         (KJS::PropertyMap::save): Check keys with isValid()
621
622 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
623
624         - now fix mac build again
625
626         * kjs/identifier.cpp:
627
628 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
629
630         Rubber stamped by Anders and Eric.
631
632         - add fpconst.cpp to win32 build, it is now needed
633
634         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
635         * kjs/fpconst.cpp:
636
637 2006-03-02  Maciej Stachowiak  <mjs@apple.com>
638
639         Reviewed by Eric.
640
641         - fix windows build, broken by my last patch
642
643         * kjs/JSImmediate.cpp:
644         * kjs/identifier.cpp:
645         * kxmlcore/FastMalloc.cpp:
646         * kxmlcore/Platform.h:
647
648 2006-03-01  Maciej Stachowiak  <mjs@apple.com>
649
650         Reviewed by Darin.
651         
652         - Set up new prototype macros and avoid using #if without defined() in JSC
653         
654         Added new PLATFORM macros and related, to make sure #if's all check if relevant macros
655         are defined, and to separate core OS-level dependencies from operating environment
656         dependencies so you can, e.g., build KDE on Mac or Windows.
657
658         * kxmlcore/Platform.h: Added.
659
660         - deploy them everywhere in JavaScriptCore
661         
662         * JavaScriptCore.xcodeproj/project.pbxproj:
663         * bindings/jni/jni_utility.cpp:
664         (KJS::Bindings::convertValueToJValue):
665         * bindings/objc/WebScriptObject.mm:
666         * bindings/objc/objc_instance.mm:
667         (ObjcInstance::end):
668         * bindings/softlinking.h:
669         * bindings/testbindings.mm:
670         (main):
671         * kjs/JSLock.cpp:
672         * kjs/collector.cpp:
673         (KJS::Collector::markCurrentThreadConservatively):
674         (KJS::Collector::markOtherThreadConservatively):
675         (KJS::Collector::markStackObjectsConservatively):
676         * kjs/config.h:
677         * kjs/date_object.cpp:
678         (gmtoffset):
679         (KJS::formatTime):
680         (KJS::DateProtoFunc::callAsFunction):
681         (KJS::DateObjectImp::construct):
682         (KJS::makeTime):
683         * kjs/dtoa.cpp:
684         * kjs/fpconst.cpp:
685         (KJS::sizeof):
686         (KJS::):
687         * kjs/grammar.y:
688         * kjs/identifier.cpp:
689         * kjs/internal.cpp:
690         * kjs/interpreter.cpp:
691         (KJS::Interpreter::evaluate):
692         (KJS::Interpreter::createLanguageInstanceForValue):
693         * kjs/interpreter.h:
694         * kjs/lookup.cpp:
695         * kjs/lookup.h:
696         * kjs/math_object.cpp:
697         * kjs/object.cpp:
698         * kjs/object.h:
699         * kjs/operations.cpp:
700         (KJS::isNaN):
701         (KJS::isInf):
702         (KJS::isPosInf):
703         (KJS::isNegInf):
704         * kjs/operations.h:
705         * kjs/regexp.cpp:
706         (KJS::RegExp::RegExp):
707         (KJS::RegExp::~RegExp):
708         (KJS::RegExp::match):
709         * kjs/regexp.h:
710         * kjs/testkjs.cpp:
711         (StopWatch::start):
712         (StopWatch::stop):
713         (StopWatch::getElapsedMS):
714         * kjs/ustring.cpp:
715         * kjs/ustring.h:
716         * kxmlcore/AlwaysInline.h:
717         * kxmlcore/Assertions.cpp:
718         * kxmlcore/Assertions.h:
719         * kxmlcore/FastMalloc.cpp:
720         (KXMLCore::):
721         * kxmlcore/FastMalloc.h:
722         * kxmlcore/FastMallocInternal.h:
723         * kxmlcore/HashTable.h:
724         * kxmlcore/TCPageMap.h:
725         * kxmlcore/TCSpinLock.h:
726         (TCMalloc_SpinLock::Lock):
727         (TCMalloc_SpinLock::Unlock):
728         (TCMalloc_SlowLock):
729         * kxmlcore/TCSystemAlloc.cpp:
730         (TCMalloc_SystemAlloc):
731         * os-win32/stdint.h:
732
733 2006-02-28  Geoffrey Garen  <ggaren@apple.com>
734
735         Reviewed by Darin.
736
737         - Fixed <rdar://problem/4448098> Switch PropertyMap deleted entry 
738         placeholder to -1 from UString::Rep::null
739
740         This turned out to be only a small speedup (.12%). That's within the 
741         margin of error for super accurate JS iBench, but Shark confirms the 
742         same, so I think it's worth landing.
743
744         FYI, I also confirmed that the single entry optimization in 
745         PropertyMap is a 3.2% speedup.
746
747         * kjs/property_map.cpp:
748         (KJS::PropertyMap::~PropertyMap):
749         (KJS::PropertyMap::clear):
750         (KJS::PropertyMap::put):
751         (KJS::PropertyMap::insert):
752         (KJS::PropertyMap::rehash):
753         (KJS::PropertyMap::remove):
754         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
755         (KJS::PropertyMap::checkConsistency):
756         * kjs/property_map.h:
757         (KJS::PropertyMap::deletedSentinel):
758
759 2006-02-27  Eric Seidel  <eseidel@apple.com>
760
761         Rubber-stamped by darin.
762
763         Remove fpconst.cpp, unused on win32 and the cause of linker warnings.
764
765         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
766
767 2006-02-27  Eric Seidel  <eseidel@apple.com>
768
769         Reviewed by mjs.
770
771         Fix Assertions.cpp to compile on win32.
772
773         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
774         * kxmlcore/Assertions.cpp:
775
776 2006-02-27  Eric Seidel  <eseidel@apple.com>
777
778         Reviewed by mjs.
779
780         Made Assertions.cpp platform independent.
781         Moved mac-specific logging logic up into WebCore.
782         http://bugzilla.opendarwin.org/show_bug.cgi?id=7503
783
784         * JavaScriptCore.xcodeproj/project.pbxproj:
785         * kxmlcore/Assertions.cpp: Added.
786         * kxmlcore/Assertions.h:
787         * kxmlcore/Assertions.mm: Removed.
788
789 2006-02-27  Darin Adler  <darin@apple.com>
790
791         - fixed Mac Debug build, there was an unused parameter
792
793         * kxmlcore/FastMalloc.cpp: (KXMLCore::fastMallocRegisterThread):
794         Remove parameter name.
795
796         * kjs/debugger.h: Fixed comment.
797
798 2006-02-27  Eric Seidel  <eseidel@apple.com>
799
800         Reviewed by darin.
801
802         * kxmlcore/Vector.h:
803         (KXMLCore::deleteAllValues): fix unused variable warning
804
805 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
806
807         Reviewed by Darin.
808         
809         - Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params
810         http://bugzilla.opendarwin.org/show_bug.cgi?id=7384
811
812         * JavaScriptCore.xcodeproj/project.pbxproj:
813         * bindings/NP_jsobject.cpp:
814         (jsAllocate):
815         (_NPN_InvokeDefault):
816         (_NPN_Evaluate):
817         (_NPN_GetProperty):
818         (_NPN_SetProperty):
819         (_NPN_RemoveProperty):
820         (_NPN_HasProperty):
821         (_NPN_HasMethod):
822         * bindings/c/c_class.h:
823         (KJS::Bindings::CClass::constructorAt):
824         * bindings/c/c_utility.cpp:
825         (KJS::Bindings::convertNPVariantToValue):
826         * bindings/jni/jni_class.cpp:
827         (JavaClass::methodsNamed):
828         (JavaClass::fieldNamed):
829         * bindings/jni/jni_instance.cpp:
830         (JavaInstance::invokeDefaultMethod):
831         * bindings/jni/jni_jsobject.cpp:
832         * bindings/jni/jni_objc.mm:
833         (-[NSObject KJS::Bindings::]):
834         * bindings/objc/WebScriptObject.mm:
835         (+[WebUndefined allocWithZone:]):
836         (-[WebUndefined initWithCoder:]):
837         (-[WebUndefined encodeWithCoder:]):
838         (-[WebUndefined copyWithZone:]):
839         * bindings/objc/objc_class.h:
840         (KJS::Bindings::ObjcClass::constructorAt):
841         * bindings/objc/objc_class.mm:
842         (KJS::Bindings::ObjcClass::methodsNamed):
843         (KJS::Bindings::ObjcClass::fallbackObject):
844         * bindings/objc/objc_instance.mm:
845         (ObjcInstance::getValueOfUndefinedField):
846         * bindings/objc/objc_runtime.mm:
847         (ObjcFallbackObjectImp::getOwnPropertySlot):
848         (ObjcFallbackObjectImp::put):
849         (ObjcFallbackObjectImp::canPut):
850         (ObjcFallbackObjectImp::deleteProperty):
851         (ObjcFallbackObjectImp::toBoolean):
852         * bindings/runtime.cpp:
853         (KJS::Bindings::Instance::createLanguageInstanceForValue):
854         * bindings/runtime.h:
855         (KJS::Bindings::Instance::getValueOfUndefinedField):
856         (KJS::Bindings::Instance::setValueOfUndefinedField):
857         * bindings/runtime_array.cpp:
858         (RuntimeArray::lengthGetter):
859         (RuntimeArray::indexGetter):
860         (RuntimeArray::put):
861         (RuntimeArray::deleteProperty):
862         * bindings/runtime_method.cpp:
863         (RuntimeMethod::lengthGetter):
864         (RuntimeMethod::execute):
865         * bindings/runtime_object.cpp:
866         (RuntimeObjectImp::fallbackObjectGetter):
867         (RuntimeObjectImp::fieldGetter):
868         (RuntimeObjectImp::methodGetter):
869         (RuntimeObjectImp::put):
870         (RuntimeObjectImp::canPut):
871         (RuntimeObjectImp::deleteProperty):
872         (RuntimeObjectImp::defaultValue):
873         (RuntimeObjectImp::callAsFunction):
874         * bindings/runtime_root.cpp:
875         (performJavaScriptAccess):
876         * kjs/array_object.cpp:
877         (ArrayInstance::lengthGetter):
878         (ArrayInstance::getOwnPropertySlot):
879         (ArrayPrototype::ArrayPrototype):
880         (ArrayPrototype::getOwnPropertySlot):
881         * kjs/bool_object.cpp:
882         (BooleanObjectImp::BooleanObjectImp):
883         * kjs/date_object.cpp:
884         (KJS::DateObjectFuncImp::DateObjectFuncImp):
885         (KJS::DateObjectFuncImp::callAsFunction):
886         * kjs/error_object.cpp:
887         (ErrorObjectImp::ErrorObjectImp):
888         (NativeErrorPrototype::NativeErrorPrototype):
889         (NativeErrorImp::NativeErrorImp):
890         * kjs/function.cpp:
891         (KJS::FunctionImp::argumentsGetter):
892         (KJS::FunctionImp::lengthGetter):
893         (KJS::Arguments::mappedIndexGetter):
894         (KJS::ActivationImp::argumentsGetter):
895         (KJS::ActivationImp::put):
896         * kjs/function_object.cpp:
897         (FunctionObjectImp::FunctionObjectImp):
898         * kjs/internal.cpp:
899         (KJS::GetterSetterImp::toPrimitive):
900         (KJS::GetterSetterImp::toBoolean):
901         * kjs/interpreter.cpp:
902         (KJS::Interpreter::evaluate):
903         * kjs/interpreter.h:
904         (KJS::Interpreter::isGlobalObject):
905         (KJS::Interpreter::interpreterForGlobalObject):
906         (KJS::Interpreter::isSafeScript):
907         * kjs/lexer.cpp:
908         (Lexer::makeIdentifier):
909         (Lexer::makeUString):
910         * kjs/lookup.h:
911         (KJS::staticFunctionGetter):
912         (KJS::staticValueGetter):
913         * kjs/nodes.cpp:
914         (StatementNode::processFuncDecl):
915         (PropertyNode::evaluate):
916         (PropertyNameNode::evaluate):
917         * kjs/number_object.cpp:
918         (NumberObjectImp::NumberObjectImp):
919         (NumberObjectImp::getOwnPropertySlot):
920         * kjs/object.cpp:
921         (KJS::JSObject::defineGetter):
922         (KJS::JSObject::defineSetter):
923         (KJS::JSObject::hasInstance):
924         (KJS::JSObject::propertyIsEnumerable):
925         * kjs/object_object.cpp:
926         (ObjectObjectImp::ObjectObjectImp):
927         * kjs/property_slot.cpp:
928         (KJS::PropertySlot::undefinedGetter):
929         (KJS::PropertySlot::functionGetter):
930         * kjs/reference.cpp:
931         (KJS::Reference::getPropertyName):
932         * kjs/reference_list.cpp:
933         (ReferenceListIterator::operator++):
934         * kjs/regexp_object.cpp:
935         (RegExpObjectImp::RegExpObjectImp):
936         (RegExpObjectImp::getValueProperty):
937         (RegExpObjectImp::putValueProperty):
938         * kjs/string_object.cpp:
939         (StringInstance::lengthGetter):
940         (StringInstance::indexGetter):
941         (StringPrototype::StringPrototype):
942         * kxmlcore/Assertions.mm:
943         * kxmlcore/FastMalloc.cpp:
944         (KXMLCore::TCMalloc_PageHeap::CheckList):
945         * kxmlcore/HashTable.h:
946         (KXMLCore::HashTableConstIterator::checkValidity):
947         (KXMLCore::IdentityHashTranslator::translate):
948         * pcre/pcre_get.c:
949         (pcre_get_stringnumber):
950
951 2006-02-23  Darin Adler  <darin@apple.com>
952
953         - try to fix buildbot failure
954
955         * bindings/c/c_utility.cpp: Touch this file, which seems to not have been
956         recompiled after additional inlining was introduced (Xcode bug?).
957
958 2006-02-23  Geoffrey Garen  <ggaren@apple.com>
959
960         Reviewed by Darin, Maciej.
961
962         - Inline some functions suggested by Shark. 2.9% speedup on super
963         accurate JS iBench.
964
965         http://bugzilla.opendarwin.org/show_bug.cgi?id=7411
966         <rdar://problem/4448116>
967
968         * kjs/nodes.h:
969         (KJS::ArgumentsNode::evaluateList):
970         * kjs/object.cpp:
971         * kjs/object.h:
972         (KJS::ScopeChain::release):
973         (KJS::JSObject::toPrimitive):
974         * kjs/scope_chain.cpp:
975         * kjs/ustring.cpp:
976         * kjs/ustring.h:
977         (KJS::UString::toArrayIndex):
978         * kjs/value.cpp:
979         * kjs/value.h:
980         (KJS::JSValue::toObject):
981         * kxmlcore/FastMalloc.cpp:
982         (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
983         (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
984
985 2006-02-21  Eric Seidel  <eseidel@apple.com>
986
987         Added *.user to ignore list.
988
989 2006-02-21  Eric Seidel  <eseidel@apple.com>
990
991         Reviewed by ggaren.
992
993         Add grammarWrapper.cpp to work around visual studio bug plaguing buildbot.
994
995         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
996         * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Added.
997
998 2006-02-21  Eric Seidel  <eseidel@apple.com>
999
1000         Reviewed by ggaren.
1001
1002         * kjs/testkjs.cpp: #if out timeval code on win32
1003
1004 2006-02-21  Michael Emmel  <mike.emmel@gmail.com>
1005
1006         Reviewed by Darin.
1007
1008         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7397
1009           TCPageMap.h would not compile for me because string.h was missing
1010
1011         * kxmlcore/TCPageMap.h: Added <string.h> include.
1012
1013 2006-02-21  Darin Adler  <darin@apple.com>
1014
1015         Reviewed by John Sullivan.
1016
1017         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7404
1018           remove a bunch of extra implementsCall overrides
1019
1020         * JavaScriptCore.xcodeproj/project.pbxproj: Sorted files.
1021
1022         * kjs/internal.h: Made InternalFunctionImp::callAsFunction pure virtual so that
1023         we'll get a compile error if some derived class neglects to implement it.
1024
1025         * kjs/function.cpp: (KJS::FunctionImp::FunctionImp): Remove unneeded initialization
1026         of param, which is an OwnPtr so it gets initialized by default.
1027
1028         * bindings/runtime_method.cpp:
1029         * bindings/runtime_method.h:
1030         * kjs/array_object.cpp:
1031         * kjs/array_object.h:
1032         * kjs/bool_object.cpp:
1033         * kjs/bool_object.h:
1034         * kjs/date_object.cpp:
1035         * kjs/date_object.h:
1036         * kjs/error_object.cpp:
1037         * kjs/error_object.h:
1038         * kjs/function.cpp:
1039         * kjs/function.h:
1040         * kjs/function_object.cpp:
1041         * kjs/function_object.h:
1042         * kjs/math_object.cpp:
1043         * kjs/math_object.h:
1044         * kjs/number_object.cpp:
1045         * kjs/number_object.h:
1046         * kjs/object_object.cpp:
1047         * kjs/object_object.h:
1048         * kjs/regexp_object.cpp:
1049         * kjs/regexp_object.h:
1050         * kjs/string_object.cpp:
1051         * kjs/string_object.h:
1052         Removed many rendundant implementations of implementsCall from subclasses of
1053         InternalFunctionImp.
1054
1055 2006-02-21  Darin Adler  <darin@apple.com>
1056
1057         - fixed build
1058
1059         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsCall):
1060         Oops, fixed name.
1061
1062 2006-02-21  Darin Adler  <darin@apple.com>
1063
1064         Change suggested by Mitz.
1065
1066         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7402
1067           REGRESSION: Methods do not execute
1068
1069         * kjs/internal.h: Add implementsHasCall to InternalFunctionImp.
1070         * kjs/internal.cpp: (KJS::InternalFunctionImp::implementsHasCall):
1071         Return true. All the classes derived from InternalFunctionImp need
1072         to return true from this -- later we can remove all the extra
1073         implementations too.
1074
1075 2006-02-21  Maciej Stachowiak  <mjs@apple.com>
1076
1077         - fix build breakage caused by last-minute change to my patch
1078
1079         * kjs/lookup.h:
1080
1081 2006-02-20  Maciej Stachowiak  <mjs@apple.com>
1082
1083         Reviewed by Geoff and Darin.
1084         
1085         Patch from Maks Orlovich, based on work by David Faure, hand-applied and 
1086         significantly reworked by me.
1087         
1088         - Patch: give internal function names (KJS merge)
1089         http://bugzilla.opendarwin.org/show_bug.cgi?id=6279
1090
1091         * tests/mozilla/expected.html: Updated for newly fixed test.
1092
1093         * kjs/array_object.cpp:
1094         (ArrayProtoFunc::ArrayProtoFunc):
1095         * kjs/array_object.h:
1096         * kjs/bool_object.cpp:
1097         (BooleanPrototype::BooleanPrototype):
1098         (BooleanProtoFunc::BooleanProtoFunc):
1099         * kjs/bool_object.h:
1100         * kjs/date_object.cpp:
1101         (KJS::DateProtoFunc::DateProtoFunc):
1102         (KJS::DateObjectImp::DateObjectImp):
1103         (KJS::DateObjectFuncImp::DateObjectFuncImp):
1104         * kjs/error_object.cpp:
1105         (ErrorPrototype::ErrorPrototype):
1106         (ErrorProtoFunc::ErrorProtoFunc):
1107         * kjs/error_object.h:
1108         * kjs/function.cpp:
1109         (KJS::FunctionImp::FunctionImp):
1110         (KJS::GlobalFuncImp::GlobalFuncImp):
1111         * kjs/function.h:
1112         * kjs/function_object.cpp:
1113         (FunctionPrototype::FunctionPrototype):
1114         (FunctionProtoFunc::FunctionProtoFunc):
1115         (FunctionProtoFunc::callAsFunction):
1116         * kjs/function_object.h:
1117         * kjs/internal.cpp:
1118         (KJS::InterpreterImp::initGlobalObject):
1119         (KJS::InternalFunctionImp::InternalFunctionImp):
1120         * kjs/internal.h:
1121         (KJS::InternalFunctionImp::functionName):
1122         * kjs/lookup.h:
1123         (KJS::staticFunctionGetter):
1124         (KJS::HashEntryFunction::HashEntryFunction):
1125         (KJS::HashEntryFunction::implementsCall):
1126         (KJS::HashEntryFunction::toBoolean):
1127         (KJS::HashEntryFunction::implementsHasInstance):
1128         (KJS::HashEntryFunction::hasInstance):
1129         * kjs/math_object.cpp:
1130         (MathFuncImp::MathFuncImp):
1131         * kjs/math_object.h:
1132         * kjs/number_object.cpp:
1133         (NumberPrototype::NumberPrototype):
1134         (NumberProtoFunc::NumberProtoFunc):
1135         * kjs/number_object.h:
1136         * kjs/object.cpp:
1137         (KJS::JSObject::putDirectFunction):
1138         (KJS::Error::create):
1139         * kjs/object.h:
1140         * kjs/object_object.cpp:
1141         (ObjectPrototype::ObjectPrototype):
1142         (ObjectProtoFunc::ObjectProtoFunc):
1143         * kjs/object_object.h:
1144         * kjs/regexp_object.cpp:
1145         (RegExpPrototype::RegExpPrototype):
1146         (RegExpProtoFunc::RegExpProtoFunc):
1147         * kjs/regexp_object.h:
1148         * kjs/string_object.cpp:
1149         (StringProtoFunc::StringProtoFunc):
1150         (StringObjectImp::StringObjectImp):
1151         (StringObjectFuncImp::StringObjectFuncImp):
1152         * kjs/string_object.h:
1153         
1154 2006-02-20  Geoffrey Garen  <ggaren@apple.com>
1155
1156         Reviewed by Darin, with help from Eric, Maciej.
1157
1158         - More changes to support super-accurate JS iBench. Doesn't work on 
1159         Windows. (Doesn't break Windows, either.) I've filed [http://bugzilla.
1160         opendarwin.org/show_bug.cgi?id= 7399] about that. 
1161
1162         * kjs/interpreter.cpp:
1163         (KJS::Interpreter::evaluate): Print line numbers with exception output
1164         * kjs/testkjs.cpp: Changed " *" to "* " because Eric says that's the 
1165         way we roll with .cpp files.
1166         (StopWatch::StopWatch): New class. Provides microsecond-accurate 
1167         timings.
1168         (StopWatch::~StopWatch):
1169         (StopWatch::start):
1170         (StopWatch::stop):
1171         (StopWatch::getElapsedMS):
1172         (TestFunctionImp::callAsFunction): Added missing return statement. 
1173         Fixed up "run" to use refactored helper functions. Removed bogus 
1174         return statement from "quit" case. Made "print" output to stdout 
1175         instead of stderr because that makes more sense, and PERL handles 
1176         stdout better.
1177         (main): Factored out KXMLCore unit tests. Removed custom exception 
1178         printing code because the interpreter prints exceptions for you. Added 
1179         a "delete" call for the GlobalImp we allocate.
1180         (testIsInteger): New function, result of refacotring.
1181         (createStringWithContentsOfFile): New function, result of refactoring. 
1182         Renamed "code" to "buffer" to match factored-out-ness.
1183
1184 2006-02-20  Eric Seidel  <eseidel@apple.com>
1185
1186         Reviewed by hyatt.
1187
1188         Fix "Copy ICU DLLs..." phase.
1189
1190         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1191         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1192
1193 2006-02-19  Darin Adler  <darin@apple.com>
1194
1195         - renamed ERROR to LOG_ERROR to fix build
1196           presumably Maciej had this change and forgot to land it
1197
1198         * kjs/collector.cpp: Removed now-unneeded #undef ERROR.
1199         * kxmlcore/Assertions.h: Renamed ERROR to LOG_ERROR.
1200         * kxmlcore/FastMalloc.cpp: Changed MESSAGE macro to use LOG_ERROR.
1201
1202 2006-02-18  Mitz Pettel  <opendarwin.org@mitzpettel.com>
1203
1204         Test: fast/js/toString-exception.html
1205
1206         Reviewed by Maciej.
1207
1208         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7343
1209           REGRESSION: fast/js/toString-overrides.html fails when run multiple times
1210
1211         * kjs/array_object.cpp:
1212         (ArrayProtoFunc::callAsFunction): Remove the object from the visited elements set before
1213         returning an error.
1214
1215 2006-02-18  Darin Adler  <darin@apple.com>
1216
1217         Reviewed by Maciej.
1218
1219         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7345
1220           add insert and remove to KXMLCore::Vector
1221
1222         * kxmlcore/Vector.h: Added "moveOverlapping", which is used in both
1223         insert and remove to slide elements within the vector. Also added
1224         "insert" and "remove" functions.
1225
1226 2006-02-16  Geoffrey Garen  <ggaren@apple.com>
1227
1228         Reviewed by John.
1229
1230         - Fixed <rdar://problem/4448534> TOT REGRESSION: crash in KJS::
1231         Bindings::Instance::deref when leaving page @ gigaom.com
1232
1233         * bindings/c/c_instance.cpp:
1234         (KJS::Bindings::CInstance::~CInstance): Since we cache the class object
1235         globally, we shouldn't delete it, so don't.
1236
1237 2006-02-16  Timothy Hatcher  <timothy@apple.com>
1238
1239         Added -Wno-deprecated-declarations to all the ObjC binding files to prevent deprecation
1240         warnings. Using <rdar://problem/4448350> to track this.
1241
1242         * JavaScriptCore.xcodeproj/project.pbxproj:
1243         * bindings/objc/objc_jsobject.h: Removed empty file.
1244         * bindings/objc/objc_jsobject.mm: Removed empty file.
1245
1246 2006-02-16  Tim Omernick  <timo@apple.com>
1247
1248         Reviewed by Geoff.
1249
1250         <rdar://problem/4428609> Flash Player 8.0.22 can crash Safari (and WebKit apps) with
1251         javascript disabled (7015)
1252
1253         * bindings/NP_jsobject.cpp:
1254         (_NPN_CreateNoScriptObject):
1255         Returns an NPObject which is not bound to a JavaScript object.  This kind of NPObject
1256         can be given to a plugin as the "window script object" when JavaScript is disabled.
1257         The object has a custom NPClass, NPNoScriptObjectClass, which has no defined methods.
1258         Because of this, none of the NPN_* functions called by the plugin on this "no script
1259         object" will cause entry into JavaScript code.
1260         (_NPN_InvokeDefault):
1261         Make sure the NPVariant is filled before returning from this function.  This never
1262         mattered before because we never reached this case, having only created NPObjects of
1263         the class NPScriptObjectClass.
1264         (_NPN_Invoke):
1265         ditto
1266         (_NPN_Evaluate):
1267         ditto
1268         (_NPN_GetProperty):
1269         ditto
1270
1271         * bindings/NP_jsobject.h:
1272         Declared _NPN_CreateNoScriptObject().
1273
1274 2006-02-16  Darin Adler  <darin@apple.com>
1275
1276         Reviewed by me, change by Peter Kuemmel.
1277
1278         * kjs/operations.cpp: (KJS::isNegInf): Fix Windows code, which was
1279         checking for positive infinity (rolling in fix from KDE side).
1280
1281 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
1282
1283         Reviewed by Maciej, Eric.
1284
1285         - WebCore half of fix for <rdar://problem/4176077> CrashTracer: 6569
1286         crashes in DashboardClient at com.apple.JavaScriptCore:
1287         KJS::Bindings::ObjcFallbackObjectImp::type()
1288
1289         WebCore and JavaScriptCore weren't sharing Instance objects very
1290         nicely. I made them use RefPtrs, and sent them to bed without dessert.
1291
1292         * bindings/jni/jni_instance.cpp: Made _instance a RefPtr
1293         (JavaInstance::~JavaInstance):
1294         (JObjectWrapper::JObjectWrapper):
1295         * bindings/jni/jni_instance.h:
1296         (KJS::Bindings::JObjectWrapper::ref):
1297         (KJS::Bindings::JObjectWrapper::deref):
1298         * bindings/jni/jni_runtime.cpp: Made _array a RefPtr
1299         (JavaArray::~JavaArray):
1300         (JavaArray::JavaArray):
1301         * bindings/jni/jni_runtime.h:
1302         (KJS::Bindings::JavaArray::operator=):
1303         * bindings/objc/objc_runtime.h:
1304         - Prohibited copying because that would muss the ref count.
1305         - Prohibited construction without instance because an instance wrapper
1306         without an instance is almost certainly a bug.
1307         * bindings/objc/objc_runtime.mm:
1308         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
1309         * bindings/runtime.cpp:
1310         (KJS::Bindings::Instance::Instance):
1311         (KJS::Bindings::Instance::createBindingForLanguageInstance):
1312         (KJS::Bindings::Instance::createRuntimeObject):
1313         * bindings/runtime.h:
1314         (KJS::Bindings::Instance::ref):
1315         (KJS::Bindings::Instance::deref):
1316         * bindings/runtime_object.cpp:
1317         (RuntimeObjectImp::RuntimeObjectImp):
1318         (RuntimeObjectImp::fallbackObjectGetter):
1319         (RuntimeObjectImp::fieldGetter):
1320         (RuntimeObjectImp::methodGetter):
1321         (RuntimeObjectImp::getOwnPropertySlot):
1322         (RuntimeObjectImp::put):
1323         (RuntimeObjectImp::canPut):
1324         * bindings/runtime_object.h: 
1325         - Removed ownsInstance data member because RefPtr takes care of 
1326         instance lifetime now. 
1327         - Prohibited copying because that would muss the ref count.
1328         - Prohibited construction without instance because an instance wrapper
1329         without an instance is almost certainly a bug.
1330         (KJS::RuntimeObjectImp::getInternalInstance):
1331
1332 2006-02-15  Geoffrey Garen  <ggaren@apple.com>
1333
1334         Reviewed by John.
1335
1336         - Applied the 4330457 change to CClass and ObjcClass as well.
1337
1338         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
1339         will catch this. 
1340
1341         This change isn't as critical because CClass and ObjcClass objects get 
1342         cached globally and never deleted, but it's good practice, in case we 
1343         ever do decide to delete CClass and ObjcClass objects.
1344
1345         This change requires prohibiting copying, because we don't do any 
1346         intelligent ref-counting -- when a Class is destroyed, it destroys its 
1347         methods and fields unconditionally. (Java classes already prohibited
1348         copying.)
1349
1350         * bindings/c/c_class.cpp:
1351         - Merged _commonInit and _commonDelete into constructor and destructor.
1352         (CClass::CClass):
1353         (CClass::~CClass):
1354         (CClass::methodsNamed): Added delete callbacks
1355         (CClass::fieldNamed): Added delete callbacks
1356         * bindings/c/c_class.h: Prohibited copying
1357         * bindings/c/c_instance.cpp: 
1358         (KJS::Bindings::CInstance::getClass): Changed to use the preferred 
1359         class factory method, to take advantage of the global cache.
1360
1361         [ Repeated changes applied to CClass for ObjcClass: ]
1362
1363         * bindings/objc/objc_class.h: 
1364         * bindings/objc/objc_class.mm:
1365         (KJS::Bindings::ObjcClass::ObjcClass):
1366         (KJS::Bindings::ObjcClass::~ObjcClass):
1367         (KJS::Bindings::ObjcClass::methodsNamed):
1368         (KJS::Bindings::ObjcClass::fieldNamed):
1369         * bindings/objc/objc_runtime.h:
1370         (KJS::Bindings::ObjcMethod::ObjcMethod): Initialized uninitialized
1371         variable to prevent bad CFRelease.
1372         (KJS::Bindings::ObjcMethod::~ObjcMethod): Removed erroneous ';' from
1373         if statement to prevent bad CFRelease.
1374         * bindings/objc/objc_runtime.cpp: Changed to use the preferred
1375         ObjectStructPtr, for clarity.
1376
1377 2006-02-14  Geoffrey Garen  <ggaren@apple.com>
1378
1379         Reviewed by John.
1380
1381         - Fixed <rdar://problem/4330457> CrashTracer: [REGRESSION] 3763 crashes
1382         in Safari at com.apple.JavaScriptCore: KJS::Bindings::JavaInstance::
1383         getClass const + 56
1384
1385         Once plugins work in DumpRenderTree, running run-webkit-tests --leaks
1386         will catch this. 
1387
1388         This was a memory leak in the bindings code. The leak was so extreme
1389         that it would cause Safari or the JVM to abort from lack of memory.
1390         Upon construction, Class objects create field and method objects, 
1391         storing them in CFDictionaries. The bug was that upon destruction, the 
1392         class objects released the dictionaries but didn't destroy the stored 
1393         objects.
1394
1395         The fix is to supply CFDictionary callbacks for destroying the values
1396         added to the dictionary. 
1397         
1398         * bindings/jni/jni_class.cpp: 
1399         (JavaClass::JavaClass): Added delete callbacks
1400         * bindings/runtime.cpp: Added definitions for delete callbacks
1401         (KJS::Bindings::deleteMethodList):
1402         (KJS::Bindings::deleteMethod):
1403         (KJS::Bindings::deleteField):
1404         * bindings/runtime.h: Added declarations for delete callbacks
1405
1406 2006-02-14  Timothy Hatcher  <timothy@apple.com>
1407
1408         Reviewed by Justin.
1409
1410         Fixed <rdar://problem/4415050> STD: WebCore build steps use echo -n, which will change
1411         behavior due to POSIX version of sh
1412
1413         * JavaScriptCore.xcodeproj/project.pbxproj: removed the use of echo -n, replaced with printf ""
1414
1415 2006-02-13   Dave Hyatt <hyatt@apple.com>
1416
1417         Fix Win32 bustage in JavaScriptCore.
1418
1419         Reviewed by darin
1420
1421         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1422         Add JSImmediate to the Win32 project.
1423
1424         * kjs/JSImmediate.h:
1425         (KJS::JSImmediate::fromDouble):
1426         (KJS::JSImmediate::toDouble):
1427         (KJS::JSImmediate::NanAsBits):
1428         (KJS::JSImmediate::oneAsBits):
1429         Win32 needs explicit returns after abort() for non-void functions.
1430
1431         * kjs/testkjs.cpp:
1432         (run):
1433         Win32 catches a bug in testkjs!  The "return 2" should actually
1434         have been a return false.
1435
1436         * kjs/value.h:
1437         The extern decls of NaN and Inf need to be const.
1438
1439 === JavaScriptCore-521.7 ===
1440
1441 2006-02-13  Timothy Hatcher  <timothy@apple.com>
1442
1443         Reviewed by Darin.
1444
1445         Replaced the old NS_DURING exception blocking with @try/@catch.
1446
1447         * JavaScriptCorePrefix.h: undef try and catch to workaround a C++ conflict
1448         * bindings/objc/objc_instance.mm:
1449         (ObjcInstance::invokeMethod):
1450         (ObjcInstance::invokeDefaultMethod):
1451         (ObjcInstance::setValueOfUndefinedField):
1452         (ObjcInstance::getValueOfUndefinedField):
1453         * bindings/objc/objc_runtime.mm:
1454         (ObjcField::valueFromInstance):
1455         (ObjcField::setValueToInstance):
1456         (ObjcArray::setValueAt):
1457         (ObjcArray::valueAt):
1458
1459 2006-02-13  Darin Adler  <darin@apple.com>
1460
1461         - fix a couple problems building on Windows, based on requests
1462           from Krzysztof Kowalczyk <kkowalczyk@gmail.com>
1463
1464         * kjs/JSImmediate.h: Change code using non-standard u_int32/64_t types
1465         to the standard uint32/64_t. Also removed curious "isIEEE()" function
1466         that checked the sizes of some types (and type sizes alone don't tell you if
1467         the floating point conforms to the IEEE-standard). Added missing include
1468         of <stdint.h>.
1469
1470         * kjs/property_slot.h: Added missing include of <assert.h>.
1471
1472 2006-02-12  Geoffrey Garen  <ggaren@apple.com>
1473
1474         Reviewed by darin.
1475
1476         Cleaned up testkjs, added new "run" functionality to allow scripting 
1477         tests from within JS. ("run" is a part of my new super-accurate
1478         JS iBench.)
1479
1480         No regressions in run-javascriptcore-tests.
1481
1482         * kjs/testkjs.cpp:
1483         (GlobalImp::className):
1484         (TestFunctionImp::):
1485         (TestFunctionImp::callAsFunction):
1486         (main):
1487         (run):
1488
1489 2006-02-11  Alexey Proskuryakov  <ap@nypop.com>
1490
1491         Reviewed by Darin.
1492
1493         - improve fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
1494         RealPlayer.GetTitle() Crashes Safari/Dashboard
1495
1496         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
1497         Use kCFStringEncodingISOLatin1 rather than kCFStringEncodingWindowsLatin1, 
1498         because the latter encoding has holes, and conversion can still fail.
1499
1500 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1501
1502         Reviewed by Darin.
1503
1504         - Inlined RefPtr assignment operators. .7% performance win on 
1505         super-accurate JS iBench.
1506
1507         * kxmlcore/RefPtr.h:
1508         (KXMLCore::::operator):
1509
1510 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1511
1512         No review needed, just a build fix. This time for sure.
1513
1514         * kjs/JSType.h:
1515
1516 2006-02-10  Geoffrey Garen  <ggaren@apple.com>
1517
1518         Reviewed by eric.
1519         
1520         - Fixed build. As it goes without saying, I will not mention that I
1521         blame Kevin.
1522
1523         * JavaScriptCore.xcodeproj/project.pbxproj:
1524         * kjs/JSImmediate.cpp:
1525         (KJS::JSImmediate::toObject):
1526
1527 2006-02-09  Geoffrey Garen  <ggaren@apple.com>
1528
1529         Reviewed by mjs.
1530
1531         - Fixed <rdar://problem/4343730> Should switch ConstantValues (null, 
1532         undefined, true, false) from JS objects to immediate values similar to
1533         SimpleNumber
1534
1535         2.0% performance gain on my new super-accurate version of JS iBench.
1536         (I promise to land a version of it soon.)
1537
1538         The gist of the change:
1539         (1) The SimpleNumber class (simple_number.h) is now the JSImmediate
1540         class (JSImmediate.h/.cpp), and it handles not only numbers but also 
1541         null, undefined, true, and false. 
1542         (2) JSImmediate provides convenience methods for the bit masking
1543         necessary to encode and decode immediate values.
1544         (3) ConstantValues, BooleanImp, NullImp, and UndefinedImp are gone.
1545         (4) JSCell no longer implements functions like getBoolean, because
1546         only a JSImmediate can be a boolean.
1547         (5) JSImmediate no longer uses ALWAYS_INLINE because there's no need,
1548         and ALWAYS_INLINE is a non-portable option of last resort.
1549         (6) Type is now JSType, and it resides in its own file, JSType.h.
1550         Since I was there, I did some header include sorting as part of this
1551         change.
1552
1553         The rest pretty much explains itself.
1554
1555         * JavaScriptCore.xcodeproj/project.pbxproj: Removed simple_number.h,
1556         added JSImmediate.h/.cpp.
1557         * bindings/c/c_instance.cpp:
1558         (KJS::Bindings::CInstance::defaultValue):
1559         * bindings/c/c_instance.h:
1560         * bindings/c/c_utility.cpp:
1561         (KJS::Bindings::convertValueToNPVariant):
1562         * bindings/jni/jni_instance.cpp:
1563         (JavaInstance::defaultValue):
1564         * bindings/jni/jni_instance.h:
1565         * bindings/jni/jni_jsobject.cpp:
1566         (JavaJSObject::convertValueToJObject):
1567         * bindings/objc/WebScriptObject.mm:
1568         (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
1569         Standardized calls to use getXXX instead of hand-rolling JSValue 
1570         functionality.
1571         * bindings/objc/objc_instance.h:
1572         * bindings/objc/objc_instance.mm:
1573         (ObjcInstance::getValueOfUndefinedField):
1574         (ObjcInstance::defaultValue):
1575         * bindings/objc/objc_runtime.h:
1576         * bindings/objc/objc_runtime.mm:
1577         (ObjcFallbackObjectImp::type):
1578         (ObjcFallbackObjectImp::defaultValue):
1579         * bindings/runtime.h:
1580         (KJS::Bindings::Instance::getValueOfUndefinedField):
1581         * bindings/runtime_object.cpp:
1582         (RuntimeObjectImp::defaultValue):
1583         * bindings/runtime_object.h:
1584         * kjs/JSImmediate.h: Added.
1585         (KJS::JSImmediate::isImmediate):
1586         (KJS::JSImmediate::isNumber):
1587         (KJS::JSImmediate::isBoolean):
1588         (KJS::JSImmediate::isUndefinedOrNull):
1589         (KJS::JSImmediate::fromDouble):
1590         (KJS::JSImmediate::toDouble):
1591         (KJS::JSImmediate::toBoolean):
1592         (KJS::JSImmediate::trueImmediate):
1593         (KJS::JSImmediate::falseImmediate):
1594         (KJS::JSImmediate::NaNImmediate):
1595         (KJS::JSImmediate::undefinedImmediate):
1596         (KJS::JSImmediate::nullImmediate):
1597         (KJS::JSImmediate::tag):
1598         (KJS::JSImmediate::unTag):
1599         (KJS::JSImmediate::getTag):
1600         (KJS::JSImmediate::):
1601         (KJS::JSImmediate::isIEEE):
1602         (KJS::JSImmediate::is32bit):
1603         (KJS::JSImmediate::is64bit):
1604         (KJS::JSImmediate::NanAsBits):
1605         (KJS::JSImmediate::zeroAsBits):
1606         (KJS::JSImmediate::oneAsBits):
1607         * kjs/JSLock.cpp:
1608         (KJS::JSLock::lock): Removed hack-o-rama to initialize ConstantValues.
1609         * kjs/JSType.h: Added.
1610         * kjs/collector.cpp:
1611         (KJS::Collector::protect):
1612         (KJS::Collector::unprotect):
1613         (KJS::Collector::collect):
1614         * kjs/internal.cpp:
1615         (KJS::StringImp::toPrimitive):
1616         (KJS::NumberImp::toPrimitive):
1617         (KJS::NumberImp::toBoolean):
1618         (KJS::GetterSetterImp::toPrimitive):
1619         * kjs/internal.h:
1620         (KJS::StringImp::type):
1621         (KJS::NumberImp::type):
1622         * kjs/object.cpp:
1623         (KJS::JSObject::type):
1624         (KJS::tryGetAndCallProperty): Replaced "Are you one of the six things
1625         I'm looking for?" test with "Are you not the one thing I'm not looking
1626         for" test.
1627         (KJS::JSObject::defaultValue):
1628         (KJS::JSObject::toPrimitive):
1629         * kjs/object.h:
1630         (KJS::GetterSetterImp::type):
1631         (KJS::JSValue::isObject):
1632         * kjs/operations.cpp:
1633         (KJS::equal):
1634         (KJS::strictEqual):
1635         (KJS::add):
1636         * kjs/reference.cpp:
1637         (KJS::Reference::deleteValue):
1638         * kjs/simple_number.h: Removed.
1639         * kjs/string_object.cpp:
1640         (StringInstance::getOwnPropertySlot): fixed indentation
1641         * kjs/value.cpp:
1642         (KJS::JSValue::toObject):
1643         (KJS::jsNumberCell): New function to quarantine a PIC branch -- allows
1644         us to inline jsNumber without adding PIC branches to callers.
1645         * kjs/value.h:
1646         (KJS::jsUndefined):
1647         (KJS::jsNull):
1648         (KJS::jsNaN):
1649         (KJS::jsBoolean):
1650         (KJS::jsNumber):
1651         (KJS::JSValue::downcast):
1652         (KJS::JSValue::isUndefinedOrNull):
1653         (KJS::JSValue::isBoolean):
1654         (KJS::JSValue::isNumber):
1655         (KJS::JSValue::isString):
1656         (KJS::JSValue::isObject):
1657         (KJS::JSValue::getBoolean):
1658         (KJS::JSValue::getNumber):
1659         (KJS::JSValue::getString):
1660         (KJS::JSValue::getObject):
1661         (KJS::JSValue::getUInt32):
1662         (KJS::JSValue::mark): Replaced !JSImmediate::is() test with assertion,
1663         resulting in a slight performance gain. Callers should always check
1664         !marked() before calling mark(), so it's impossible to call mark on
1665         a JSImmediate.
1666         (KJS::JSValue::marked):
1667         (KJS::JSValue::type):
1668         (KJS::JSValue::toPrimitive):
1669         (KJS::JSValue::toBoolean):
1670         (KJS::JSValue::toNumber):
1671         (KJS::JSValue::toString):
1672
1673 2006-02-06  Eric Seidel  <eseidel@apple.com>
1674
1675         Add svn:ignore properties for visual studio internals.
1676
1677 2006-02-06  Alexey Proskuryakov  <ap@nypop.com>
1678
1679         Reviewed by Darin.
1680
1681         - Refactor DateInstance to provide direct access to data. Several WIN32 modifications.
1682         http://bugzilla.opendarwin.org/show_bug.cgi?id=7107
1683
1684         - No tests added - only changed functionality on WIN32, which should be covered by 
1685         existing tests.
1686
1687         * kjs/date_object.cpp:
1688         (gmtoffset): On WIN32, use the recommended global (_timezone rather than timezone).
1689         Updated comments. 
1690         (KJS::timeZoneOffset): Removed, was basically the same as the above.
1691         (KJS::formatTime): Pass an UTC flag - UTC/local cannot be correctly selected on
1692         Windows based on struct tm itself.
1693         (KJS::DateInstance::getTime): Added.
1694         (KJS::DateInstance::getUTCTime): Added.
1695         (KJS::millisecondsToTM): Factored out from DateProtoFunc::callAsFunction().
1696         (KJS::DateObjectImp::callAsFunction): Use the new parameter to formatTime().
1697         (KJS::DateProtoFunc::callAsFunction): Updated for the other changes. The code for
1698         GetTimezoneOffset was incorrect on WIN32 - _daylight global has nothing to do
1699         with daylight savings time being in effect.
1700
1701         * kjs/date_object.h: Added prototypes for new functions.
1702
1703 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
1704
1705         Reviewed by Anders.
1706         
1707         - fixed ~1100 KJS::Node leaked on layout tests
1708         http://bugzilla.opendarwin.org/show_bug.cgi?id=7097
1709
1710         * kjs/internal.cpp:
1711         (KJS::Parser::noteNodeCycle):
1712         (KJS::Parser::removeNodeCycle):
1713         (KJS::clearNewNodes):
1714         * kjs/internal.h:
1715         * kjs/nodes.cpp:
1716         (ElementNode::breakCycle):
1717         (PropertyListNode::breakCycle):
1718         (ArgumentListNode::breakCycle):
1719         (StatListNode::StatListNode):
1720         (StatListNode::breakCycle):
1721         (VarDeclListNode::breakCycle):
1722         (BlockNode::BlockNode):
1723         (ClauseListNode::breakCycle):
1724         (CaseBlockNode::CaseBlockNode):
1725         (ParameterNode::breakCycle):
1726         (SourceElementsNode::SourceElementsNode):
1727         (SourceElementsNode::breakCycle):
1728         * kjs/nodes.h:
1729         (KJS::Node::breakCycle):
1730         (KJS::ElementNode::ElementNode):
1731         (KJS::ArrayNode::ArrayNode):
1732         (KJS::PropertyListNode::PropertyListNode):
1733         (KJS::ObjectLiteralNode::ObjectLiteralNode):
1734         (KJS::ArgumentListNode::ArgumentListNode):
1735         (KJS::ArgumentsNode::ArgumentsNode):
1736         (KJS::VarDeclListNode::VarDeclListNode):
1737         (KJS::VarStatementNode::VarStatementNode):
1738         (KJS::ForNode::ForNode):
1739         (KJS::CaseClauseNode::CaseClauseNode):
1740         (KJS::ClauseListNode::ClauseListNode):
1741         (KJS::ParameterNode::ParameterNode):
1742         (KJS::FuncExprNode::FuncExprNode):
1743         (KJS::FuncDeclNode::FuncDeclNode):
1744
1745 2006-02-05  Maciej Stachowiak  <mjs@apple.com>
1746
1747         Reviewed by Hyatt.
1748         
1749         - fix default traits for classes to make sure default constructors get called
1750
1751         * kxmlcore/VectorTraits.h:
1752         (KXMLCore::):
1753
1754 2006-02-04  Darin Adler  <darin@apple.com>
1755
1756         Reviewed by Maciej.
1757
1758         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5210
1759           REGRESSION: for/in loop with var changes global variable instead of making local
1760
1761         Test: fast/js/for-in-var-scope.html
1762
1763         * kjs/nodes.cpp:
1764         (valueForReadModifyAssignment): Use ALWAYS_INLINE macro.
1765         (ForInNode::execute): Break out of the scope chain loop once we find and set the
1766         loop variable. We don't want to set multiple loop variables.
1767         (ForInNode::processVarDecls): Process the declaration of the loop variable.
1768
1769         - other cleanup
1770
1771         * kjs/object.cpp: (KJS::tryGetAndCallProperty): Use ALWAYS_INLINE macro.
1772         * kxmlcore/FastMalloc.cpp: Change to use ALWAYS_INLINE macro from AlwaysInline.h
1773         instead of defining it here a second time.
1774
1775 2006-02-04  Maciej Stachowiak  <mjs@apple.com>
1776
1777         Reviewed by Hyatt.
1778         
1779         - change JavaScript collector statistics calls to use HashCountedSet instead
1780         of CFSet; other misc cleanup
1781         http://bugzilla.opendarwin.org/show_bug.cgi?id=7072
1782         
1783         * kjs/collector.cpp:
1784         (KJS::Collector::numProtectedObjects): renamed from numReferencedObjects
1785         (KJS::typeName):
1786         (KJS::Collector::rootObjectTypeCounts): renamed from rootObjectClasses,
1787         use HashSet
1788         * kjs/collector.h:
1789         (KJS::Collector::isOutOfMemory): Renamed from outOfMemory.
1790         * kjs/nodes.cpp:
1791
1792 2006-02-03  Timothy Hatcher  <timothy@apple.com>
1793
1794         Reviewed by Justin.
1795
1796         Renamed configuration names to Debug, Release and Production.
1797
1798         * JavaScriptCore.xcodeproj/project.pbxproj:
1799
1800 2006-02-02  George Staikos <staikos@opensource.apple.com>
1801
1802         Reviewed by Maciej.
1803
1804         * kjs/lookup.h: Fix compile, merged from KDE.
1805
1806 2006-02-02  Darin Adler  <darin@apple.com>
1807
1808         Reviewed by Maciej.
1809
1810         - http://bugzilla.opendarwin.org/show_bug.cgi?id=7005
1811           add Noncopyable, OwnPtr, OwnArrayPtr to KXMLCore
1812
1813         * kxmlcore/Noncopyable.h: Added.
1814         * kxmlcore/OwnArrayPtr.h: Added.
1815         * kxmlcore/OwnPtr.h: Added.
1816
1817         * JavaScriptCore.xcodeproj/project.pbxproj: Added new files.
1818
1819         * kjs/function.h:
1820         * kjs/function.cpp: Use OwnPtr for Parameter pointers.
1821
1822         * kjs/internal.h: Use Noncopyable for LabelStack.
1823
1824         * kjs/list.cpp: Use OwnArrayPtr for overflow.
1825
1826         * kjs/property_map.h:
1827         * kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties.
1828         Use Vector for some stack buffers.
1829
1830         * kjs/regexp_object.h:
1831         * kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
1832
1833 2006-01-31  Maciej Stachowiak  <mjs@apple.com>
1834
1835         Reviewed by Darin.
1836         
1837         - fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter
1838         that would catch them
1839
1840         * kjs/nodes.cpp:
1841         (NodeCounter::~NodeCounter): Added debug-only node counter.
1842         (Node::Node):
1843         (Node::~Node):
1844         * kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
1845
1846 2006-01-31  Darin Adler  <darin@apple.com>
1847
1848         Reviewed by Maciej.
1849
1850         - added deleteAllValues for HashSet as well as HashMap
1851         - fixed conversion from const_iterator to iterator, which I broke a while back
1852
1853         * kxmlcore/HashMap.h: Updated copyright date.
1854         * kxmlcore/HashSet.h: (KXMLCore::deleteAllValues): Added.
1855         * kxmlcore/HashTable.h: (KXMLCore::HashTableIterator::operator const_iterator): Added.
1856
1857 2006-01-31  Tim Omernick  <timo@apple.com>
1858
1859         Reviewed by Geoff Garen.
1860
1861         * bindings/c/c_utility.cpp:
1862         (KJS::Bindings::convertUTF8ToUTF16):
1863         Fixed an invalid assertion that UTF8Chars is not NULL.  It is valid for it to be NULL as long as
1864         UTF8Length is 0.
1865         This fixes an assertion failure on TOT at <http://www.musicindiaonline.com/p/x/tJO0OOBME9.As1NMvHdW/>,
1866         where JavaScript is getting a NULL string back from some call on the Real Player plugin.
1867
1868 2006-01-30  Anders Carlsson  <andersca@mac.com>
1869
1870         Reviewed by Darin.
1871
1872         Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6907
1873         REGRESSION: United.com menus messed up due to document.all/MSIE sniff
1874         
1875         * kjs/nodes.cpp:
1876         (typeStringForValue):
1877         Return "undefined" if the given object should masquerade as undefined.
1878         
1879         * kjs/object.h:
1880         (KJS::JSObject::masqueradeAsUndefined):
1881         Rename from isEqualToNull.
1882         
1883         * kjs/operations.cpp:
1884         (KJS::equal):
1885         Update for name change.
1886
1887 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
1888
1889         Reviewed by Darin.
1890         
1891         - properly define Vector assignment operator; the private version was accidentally left
1892         in, and the template version is not enough to replace the default
1893
1894         * kxmlcore/Vector.h:
1895         (KXMLCore::Vector::operator=):
1896
1897 2006-01-29  Eric Seidel  <eseidel@apple.com>
1898
1899         Reviewed by darin.
1900
1901         Fix the build by applying a GCC-specific namespace hack.
1902
1903         * kjs/lookup.h:
1904
1905 2006-01-29  Eric Seidel <eseidel@apple.com>
1906
1907         Reviewed by hyatt.
1908
1909         Fix build on Win32.
1910
1911         * kjs/lookup.h: fixed ::cacheGlobalObject
1912         * kxmlcore/Vector.h:
1913         (KXMLCore::Vector::operator[]): use unsigned long
1914
1915 2006-01-29  Maciej Stachowiak  <mjs@apple.com>
1916
1917         Reviewed by Dave Hyatt.
1918
1919         * kxmlcore/Vector.h:
1920         (KXMLCore::Vector::operator[]): Add unsigned overload
1921
1922 2006-01-28  Darin Adler  <darin@apple.com>
1923
1924         Reviewed by John Sullivan.
1925
1926         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6895
1927           include exception names in JavaScript form of DOM exception
1928
1929         * khtml/ecma/kjs_binding.cpp: (KJS::setDOMException): Include the name of the
1930         exception in the error message.
1931
1932 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
1933
1934         Reviewed by Darin.
1935         
1936         - miscellaneous Vector improvements
1937
1938         * kxmlcore/Vector.h:
1939         (KXMLCore::Vector::at): Add range-checking asserts.
1940         (KXMLCore::Vector::first): Added as a convenience.
1941         (KXMLCore::Vector::last): Convenience for stack-style use.
1942         (KXMLCore::Vector::removeLast): ditto
1943
1944 2006-01-28  Darin Adler  <darin@apple.com>
1945
1946         Reviewed by John Sullivan
1947
1948         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6870
1949           REGRESSION: JavaScript Date constructor won't accept another Date object
1950
1951         Test: fast/js/date-constructor.html
1952
1953         * kjs/date_object.cpp: (KJS::DateObjectImp::construct):
1954         Added a special case for constructing one date from another (to avoid losing
1955         milliseconds, which are not in the text form, to match Firefox), and changed
1956         the base code to convert to primitive before checking for string to match
1957         the standard. Also corrected a couple silly things in the "construct from
1958         current time" code path (removed a floor that does no good, and changed
1959         the constant used to convert microseconds to milliseconds to be a 1000
1960         rather than "msPerSecond").
1961
1962 2006-01-28  Darin Adler  <darin@apple.com>
1963
1964         * kjs/create_hash_table: Added missing license.
1965
1966 2006-01-28  Maciej Stachowiak  <mjs@apple.com>
1967
1968         Reviewed by Dave Hyatt.
1969         
1970         - added a Vector class
1971         http://bugzilla.opendarwin.org/show_bug.cgi?id=6894
1972
1973         * JavaScriptCore.xcodeproj/project.pbxproj:
1974         * kjs/internal.cpp:
1975         (KJS::Parser::saveNewNode): Apply Vector.
1976         (KJS::clearNewNodes): ditto
1977         * kjs/number_object.cpp:
1978         (integer_part_noexp): ditto
1979         (char_sequence): ditto
1980         * kjs/ustring.cpp:
1981         (KJS::UString::UTF8String): ditto
1982         * kxmlcore/HashMap.h:
1983         (KXMLCore::deleteAllValues): Tweaked this to only apply to HashMap,
1984         other versions are useful for other containers.
1985         * kxmlcore/Vector.h: Added. Implemented a Vector class, which should
1986         be usable for all Array/QVector style purposes, and also as a stack buffer
1987         with oversize handling. Also some helper classes to make vector operations
1988         as efficient as possible for POD types and for simple non-PODs like RefPtr.
1989         (KXMLCore::):
1990         (KXMLCore::VectorTypeOperations::destruct):
1991         (KXMLCore::VectorTypeOperations::initialize):
1992         (KXMLCore::VectorTypeOperations::move):
1993         (KXMLCore::VectorTypeOperations::uninitializedCopy):
1994         (KXMLCore::VectorTypeOperations::uninitializedFill):
1995         (KXMLCore::VectorBuffer::VectorBuffer):
1996         (KXMLCore::VectorBuffer::~VectorBuffer):
1997         (KXMLCore::VectorBuffer::deallocateBuffer):
1998         (KXMLCore::VectorBuffer::inlineBuffer):
1999         (KXMLCore::Vector::Vector):
2000         (KXMLCore::Vector::~Vector):
2001         (KXMLCore::Vector::size):
2002         (KXMLCore::Vector::capacity):
2003         (KXMLCore::Vector::isEmpty):
2004         (KXMLCore::Vector::at):
2005         (KXMLCore::Vector::operator[]):
2006         (KXMLCore::Vector::data):
2007         (KXMLCore::Vector::operator T*):
2008         (KXMLCore::Vector::operator const T*):
2009         (KXMLCore::Vector::begin):
2010         (KXMLCore::Vector::end):
2011         (KXMLCore::Vector::clear):
2012         (KXMLCore::Vector::fill):
2013         (KXMLCore::Vector::operator=):
2014         (KXMLCore::::Vector):
2015         (KXMLCore::::operator):
2016         (KXMLCore::::fill):
2017         (KXMLCore::::expandCapacity):
2018         (KXMLCore::::resize):
2019         (KXMLCore::::reserveCapacity):
2020         (KXMLCore::::append):
2021         (KXMLCore::deleteAllValues):
2022         * kxmlcore/VectorTraits.h: Added.
2023         (KXMLCore::VectorTraits): Traits to enable making Vector efficient for
2024         simple types.
2025
2026 2006-01-28  Alexey Proskuryakov  <ap@nypop.com>
2027
2028         Reviewed by Darin.
2029
2030         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5163
2031         RealPlayer.GetTitle() Crashes Safari/Dashboard
2032
2033         * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16):
2034         Fallback to kCFStringEncodingWindowsLatin1 if the passed buffer is not valid UTF-8, preventing crashes.
2035
2036 2006-01-25  George Staikos <staikos@opensource.apple.com>
2037
2038         Reviewed by Darin.
2039
2040         * kxmlcore/HashFunctions.h: Merge build fix from KDE.
2041
2042 2006-01-25  Darin Adler  <darin@apple.com>
2043
2044         - removed an unused source file
2045
2046         * kjs/pointer_hash.h: Removed.
2047         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to pointer_hash.h.
2048
2049 2006-01-23  Anders Carlsson  <andersca@mac.com>
2050
2051         Reviewed by Maciej.
2052
2053         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6737
2054         KJS_DEFINE_PROTOTYPE should work outside of the KJS namespace
2055         
2056         * kjs/lookup.h:
2057         Prefix all KJS types with KJS:: in KJS_DEFINE_PROTOTYPE.
2058         
2059         (cacheGlobalObject):
2060         Move this out of the KJS namespace.
2061
2062 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2063
2064         Reviewed by Eric.
2065
2066         - renamed PointerHash to PtrHash
2067         - made PtrHash the default hash function for int and pointer types that aren't further specialized
2068         - added an AtomicStringImpl class to make it easier and more typesafe to identity hash atomic strings
2069         - did appropriate consequent cleanup (very few places now need to declare a hash function)
2070         http://bugzilla.opendarwin.org/show_bug.cgi?id=6752
2071         
2072         * kjs/array_object.cpp:
2073         (ArrayProtoFunc::callAsFunction): no need to mention PointerHash
2074         * kjs/collector.cpp: ditto
2075         * kjs/identifier.cpp:
2076         (KXMLCore::): declare DefaultHash the new way
2077         * kjs/internal.cpp: no need to mention PointerHash
2078         * kjs/ustring.h:
2079         * kxmlcore/HashCountedSet.h: change how we get the default hash to make it
2080         easier to specialize on PtrHash
2081         * kxmlcore/HashFunctions.h:
2082         (KXMLCore::): renamed PointerHash to PtrHash; changed DefaultHash so that it has
2083         a Hash typedef rather than being a hash function class itself; declared DefaultHash
2084         for int and partializy specialized for pointer types
2085         * kxmlcore/HashMapPtrSpec.h:
2086         (KXMLCore::PtrHashIteratorAdapter::PtrHashIteratorAdapter): Slight tweaks for new
2087         way of handling pointer hash
2088         (KXMLCore::PtrHashConstIteratorAdapter::PtrHashConstIteratorAdapter): ditto
2089         (KXMLCore::): ditto
2090         * kxmlcore/HashMap.h: ditto
2091         * kxmlcore/HashSet.h: ditto
2092
2093 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2094
2095         Reviewed by Tim Omernick.
2096         
2097         - use classes instead of free functions for extractors, this better matches how other
2098         things work and should avoid the need for hacky workarounds on other compilers
2099         http://bugzilla.opendarwin.org/show_bug.cgi?id=6748
2100
2101         * kjs/array_object.cpp:
2102         * kjs/identifier.cpp:
2103         * kjs/internal.cpp:
2104         * kxmlcore/HashMap.h:
2105         (KXMLCore::PairFirstExtractor::extract):
2106         * kxmlcore/HashMapPtrSpec.h:
2107         (KXMLCore::):
2108         * kxmlcore/HashSet.h:
2109         (KXMLCore::IdentityExtractor::extract):
2110         * kxmlcore/HashTable.h:
2111         (KXMLCore::addIterator):
2112         (KXMLCore::removeIterator):
2113         (KXMLCore::HashTable::add):
2114         (KXMLCore::HashTable::isEmptyBucket):
2115         (KXMLCore::HashTable::isDeletedBucket):
2116         (KXMLCore::HashTable::HashTable):
2117         (KXMLCore::HashTable::lookup):
2118         (KXMLCore::HashTable::add):
2119         (KXMLCore::HashTable::reinsert):
2120         (KXMLCore::HashTable::find):
2121         (KXMLCore::HashTable::contains):
2122         (KXMLCore::HashTable::remove):
2123         (KXMLCore::HashTable::allocateTable):
2124         (KXMLCore::HashTable::deallocateTable):
2125         (KXMLCore::HashTable::expand):
2126         (KXMLCore::HashTable::rehash):
2127         (KXMLCore::HashTable::clear):
2128         (KXMLCore::HashTable::swap):
2129         (KXMLCore::HashTable::operator):
2130         (KXMLCore::HashTable::checkTableConsistency):
2131         (KXMLCore::HashTable::checkTableConsistencyExceptSize):
2132         (KXMLCore::HashTable::invalidateIterators):
2133
2134 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2135
2136         Rubber stamped by Tim Hatcher.
2137         
2138         - renamed inert() operation on HashSet, HashCountedSet and HashTable to add()
2139         for consistency with HashMap
2140
2141         * kjs/array_object.cpp:
2142         (ArrayProtoFunc::callAsFunction):
2143         * kjs/collector.cpp:
2144         (KJS::Collector::protect):
2145         * kjs/identifier.cpp:
2146         (KJS::Identifier::add):
2147         * kxmlcore/HashCountedSet.h:
2148         (KXMLCore::::add):
2149         * kxmlcore/HashMap.h:
2150         (KXMLCore::::inlineAdd):
2151         * kxmlcore/HashSet.h:
2152         (KXMLCore::::add):
2153         * kxmlcore/HashTable.h:
2154         (KXMLCore::HashTable::add):
2155         (KXMLCore::::add):
2156         (KXMLCore::::HashTable):
2157
2158 2006-01-23  Justin Garcia  <justin.garcia@apple.com>
2159
2160         Reviewed by thatcher
2161         
2162         Turned on -O2 for B&I build.
2163
2164         * JavaScriptCore.xcodeproj/project.pbxproj:
2165
2166 2006-01-23  Maciej Stachowiak  <mjs@apple.com>
2167
2168         Reviewed by Tim Hatcher.
2169         
2170         - it's "Franklin Street", not "Franklin Steet"
2171
2172         * kjs/array_instance.h:
2173         * kjs/array_object.cpp:
2174         * kjs/array_object.h:
2175         * kjs/bool_object.cpp:
2176         * kjs/bool_object.h:
2177         * kjs/collector.cpp:
2178         * kjs/collector.h:
2179         * kjs/completion.h:
2180         * kjs/context.h:
2181         * kjs/date_object.cpp:
2182         * kjs/date_object.h:
2183         * kjs/debugger.cpp:
2184         * kjs/debugger.h:
2185         * kjs/dtoa.h:
2186         * kjs/error_object.cpp:
2187         * kjs/error_object.h:
2188         * kjs/function.cpp:
2189         * kjs/function.h:
2190         * kjs/function_object.cpp:
2191         * kjs/function_object.h:
2192         * kjs/grammar.y:
2193         * kjs/identifier.cpp:
2194         * kjs/identifier.h:
2195         * kjs/internal.cpp:
2196         * kjs/internal.h:
2197         * kjs/interpreter.cpp:
2198         * kjs/interpreter.h:
2199         * kjs/lexer.cpp:
2200         * kjs/lexer.h:
2201         * kjs/list.cpp:
2202         * kjs/list.h:
2203         * kjs/lookup.cpp:
2204         * kjs/lookup.h:
2205         * kjs/math_object.cpp:
2206         * kjs/math_object.h:
2207         * kjs/nodes.cpp:
2208         * kjs/nodes.h:
2209         * kjs/nodes2string.cpp:
2210         * kjs/number_object.cpp:
2211         * kjs/number_object.h:
2212         * kjs/object.cpp:
2213         * kjs/object.h:
2214         * kjs/object_object.cpp:
2215         * kjs/object_object.h:
2216         * kjs/operations.cpp:
2217         * kjs/operations.h:
2218         * kjs/property_map.cpp:
2219         * kjs/property_map.h:
2220         * kjs/property_slot.cpp:
2221         * kjs/property_slot.h:
2222         * kjs/reference.cpp:
2223         * kjs/reference.h:
2224         * kjs/reference_list.cpp:
2225         * kjs/reference_list.h:
2226         * kjs/regexp.cpp:
2227         * kjs/regexp.h:
2228         * kjs/regexp_object.cpp:
2229         * kjs/regexp_object.h:
2230         * kjs/scope_chain.cpp:
2231         * kjs/scope_chain.h:
2232         * kjs/simple_number.h:
2233         * kjs/string_object.cpp:
2234         * kjs/string_object.h:
2235         * kjs/testkjs.cpp:
2236         * kjs/types.h:
2237         * kjs/ustring.cpp:
2238         * kjs/ustring.h:
2239         * kjs/value.cpp:
2240         * kjs/value.h:
2241         * kxmlcore/AlwaysInline.h:
2242         * kxmlcore/ListRefPtr.h:
2243         * kxmlcore/PassRefPtr.h:
2244         * kxmlcore/RefPtr.h:
2245
2246 2006-01-23  Darin Adler  <darin@apple.com>
2247
2248         Reviewed by John Sullivan.
2249
2250         - change needed for fix to http://bugzilla.opendarwin.org/show_bug.cgi?id=6617
2251           REGRESSION: Crash in cloneChildNodes when clicking element
2252
2253         * kxmlcore/PassRefPtr.h: Fix assignment operator from RefPtr of a different
2254         type by calling get() instead of going directly at m_ptr.
2255         * kxmlcore/RefPtr.h: Ditto.
2256
2257         - other changes
2258
2259         * JavaScriptCore.xcodeproj/project.pbxproj: Xcode decided to change this file.
2260         It's just a resorted list of keys in a dictionary.
2261
2262         * kjs/fpconst.cpp: Wrap this file in #if __APPLE__ since the alternate version
2263         in internal.cpp is in #if !__APPLE__. This file is to give us the "no init
2264         routine" property we want to have on OS X.
2265
2266 2006-01-22  Maciej Stachowiak  <mjs@apple.com>
2267
2268         Reviewed by Darin.
2269
2270         - Set up Page class and invert Frame / WebCoreFrameBridge ownership
2271         http://bugzilla.opendarwin.org/show_bug.cgi?id=6577
2272
2273         * kjs/interpreter.h: make globalExec virtual so ScriptInterpreter can 
2274         override it
2275
2276 2006-01-23  George Staikos <staikos@opensource.apple.com>
2277
2278         Reviewed by Maciej and Darin.
2279
2280         * kxmlcore/Assertions.h: This file only works with __APPLE__ right now
2281         * kjs/interpreter.cpp: ditto
2282         * kjs/simple_number.h: Add assert.h and remove from config.h
2283         * kjs/array_object.cpp: Use relative paths for kxmlcore includes
2284         * kjs/testkjs.cpp: Use relative paths for kxmlcore includes
2285
2286 2006-01-23  George Staikos <staikos@opensource.apple.com>
2287
2288         Reviewed by Maciej.
2289
2290         * kjs/config.h: unbreak preprocessor change
2291
2292 2006-01-23  George Staikos <staikos@opensource.apple.com>
2293
2294         Approved by Maciej and Darin.
2295
2296         * kjs/:
2297         * kxmlcore/:
2298              Update FSF address in license to make merging easier
2299
2300 2006-01-22  George Staikos <staikos@opensource.apple.com>
2301
2302         Reviewed by Maciej.
2303
2304         * kjs/collector.cpp: merge major speedup from KDE on Linux
2305                              patch by Maks Orlovich, bug #6145
2306                              Also unify cpu detection
2307         * kjs/config.h: define simpler CPU macros
2308
2309 2006-01-22  George Staikos <staikos@opensource.apple.com>
2310
2311         Reviewed by Maciej.
2312
2313         * kjs/collector.cpp: merge FreeBSD compile fix from KDE
2314                              -> requires build magic for use
2315
2316 2006-01-21  George Staikos <staikos@opensource.apple.com>
2317
2318         Reviewed by Maciej.
2319
2320         * kjs/nodes2string.cpp
2321         * kjs/operations.h
2322         * kjs/debugger.h
2323           Fix pedantic compile with some gcc versions (Merge from KDE)
2324
2325         * kjs/create_hash_table:
2326           Fix build with Perl 5.8.0 (Merge from KDE)
2327
2328 2006-01-18  Darin Adler  <darin@apple.com>
2329
2330         Reviewed by Hyatt.
2331
2332         - hash table fixes needed for my WebCore changes
2333
2334         * kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=):
2335         Added a missing return statement.
2336
2337         * kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you
2338         can't instantiate with a 0 by using traits rather than ? : to select the default
2339         emtpy value of hash table keys.
2340
2341         - small cleanup of "runtime" code left over from recent JavaScript crash fix
2342
2343         * bindings/runtime_root.h:
2344         (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed
2345         since it's now a ProtectedPtr.
2346         (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the
2347         fact that _imp was 0 and replaced with use of ProtectedPtr.
2348         (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
2349
2350 2006-01-17  Darin Adler  <darin@apple.com>
2351
2352         Reviewed by Anders.
2353
2354         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6611
2355           add assertions to check correct use of hash table iterators
2356
2357         * kxmlcore/HashTable.h:
2358         (KXMLCore::addIterator): Added. Helper function that adds an iterator to the list
2359         maintained by the specified hash table.
2360         (KXMLCore::removeIterator): Added. Helper function that removes an iterator from
2361         the list maintained by the hash table it's in.
2362         (KXMLCore::HashTableConstIterator::HashTableConstIterator): Added a HashTable
2363         parameter, ignored when not debugging. Call addIterator.
2364         (KXMLCore::HashTableConstIterator::~HashTableConstIterator):
2365         (KXMLCore::HashTableConstIterator::operator=): Call removeIterator.
2366         (KXMLCore::HashTableConstIterator::operator*): Call checkValidity.
2367         (KXMLCore::HashTableConstIterator::operator->): Ditto.
2368         (KXMLCore::HashTableConstIterator::operator++): Ditto.
2369         (KXMLCore::HashTableConstIterator::operator==): Ditto.
2370         (KXMLCore::HashTableConstIterator::operator!=): Ditto.
2371         (KXMLCore::HashTableConstIterator::checkValidity): Checks that the hash table
2372         pointer is not 0 and if there are two iterators that both point at the same table.
2373         (KXMLCore::HashTableIterator::HashTableIterator): Changed to use the const iterator
2374         as an implementation detail, to avoid having two separate iterator implementations.
2375         (KXMLCore::HashTableIterator::operator*): Ditto.
2376         (KXMLCore::HashTableIterator::operator->): Ditto.
2377         (KXMLCore::HashTableIterator::operator++): Ditto.
2378         (KXMLCore::HashTableIterator::operator==): Ditto.
2379         (KXMLCore::HashTableIterator::operator!=): Ditto.
2380         (KXMLCore::HashTable::HashTable): Initialize pointer to head of iterators list.
2381         (KXMLCore::HashTable::~HashTable): Added call to invalidateIterators.
2382         (KXMLCore::HashTable::makeIterator): Pass this pointer.
2383         (KXMLCore::HashTable::makeConstIterator): Ditto.
2384         (KXMLCore::HashTable::insert): Call invalidateIterators, since this is a public
2385         entry point that modifies the hash table.
2386         (KXMLCore::HashTable::remove): Ditto.
2387         (KXMLCore::HashTable::clear): Ditto.
2388         (KXMLCore::HashTable::swap): Ditto.
2389         (KXMLCore::HashTable::invalidateIterators): Added. Walks the iterators list and
2390         clears out the table, next, and previous pointers in all of them, and then clears
2391         the head so we have an empty list.
2392         (KXMLCore::addIterator): Added. Adds the iterator the the linked list in the
2393         passed-in table, and points the iterator at the table.
2394         (KXMLCore::removeIterator): Added. Removes the iterator from the linked list in
2395         the passed-in table.
2396
2397         * kxmlcore/HashTraits.h: A bit of tweaking and formatting.
2398
2399 2006-01-17  Justin Garcia  <justin.garcia@apple.com>
2400
2401         Reviewed by eric
2402         
2403         Deployment builds now use -O2
2404
2405         * JavaScriptCore.xcodeproj/project.pbxproj:
2406
2407 2006-01-17  Darin Adler  <darin@apple.com>
2408
2409         Reviewed by Anders.
2410
2411         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6610
2412           change RefPtr so that it works when deref ends up deleting the RefPtr
2413
2414         * kxmlcore/PassRefPtr.h: Always set m_ptr before calling deref.
2415         * kxmlcore/RefPtr.h: Ditto.
2416
2417 2006-01-16  Geoffrey Garen  <ggaren@apple.com>
2418
2419         Reviewed by darin.
2420
2421         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6322
2422         DateProtoFuncImp::callAsFunction can crash due to lack of type checking
2423
2424         * kjs/date_object.cpp:
2425         (KJS::DateProtoFunc::callAsFunction): Type check calls to all methods. 
2426         This matches section 15.9.5 in the spec.
2427
2428 2006-01-16  Tim Omernick  <timo@apple.com>
2429
2430         Reviewed by John Sullivan.
2431
2432         JavaScriptCore part of <rdar://problem/4211707> NPAPI ref count behavior differs with Mozilla
2433
2434         * bindings/npruntime.cpp:
2435         (_NPN_ReleaseObject):
2436         Refactored part of this function out into _NPN_DeallocateObject.
2437         (_NPN_DeallocateObject):
2438         Forcibly deallocates the passed object, even if its refcount is
2439         greater than zero.
2440         
2441         * bindings/npruntime_impl.h:
2442         Declared _NPN_DeallocateObject().
2443
2444 2006-01-16  Darin Adler  <darin@apple.com>
2445
2446         Reviewed by Maciej.
2447
2448         - fix problem with ++, ==, and != on const iterators in
2449           HashMaps that are using the pointer specialization
2450
2451         * kxmlcore/HashMapPtrSpec.h:
2452         (KXMLCore::PointerHashConstIteratorAdapter::operator++): Change type to const_iterator.
2453         (KXMLCore::PointerHashConstIteratorAdapter::operator==): Ditto.
2454         (KXMLCore::PointerHashConstIteratorAdapter::operator!=): Ditto.
2455
2456 2006-01-15  Alexey Proskuryakov  <ap@nypop.com>
2457
2458         Reviewed by Anders.
2459
2460         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6561
2461         run-javascriptcore-tests doesn't work
2462
2463         * JavaScriptCore/tests/mozilla/Getopt/Mixed.pm: 
2464         Changed revision number to 1.8 (broken by svn migration).
2465
2466 2006-01-14  David Kilzer  <ddkilzer@kilzer.net>
2467
2468         Reviewed and landed by Anders.
2469
2470         * kjs/create_hash_table: Fixed comment typo.
2471
2472 2006-01-13  Maks Orlovich   <maksim@kde.org>
2473
2474         Mostly merging work by Peter Kelly. Reviewed by Maciej, landed by ap.
2475
2476         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6261
2477         Misc. array object fixes from KJS
2478
2479         * kjs/array_object.cpp: Don't treat 2^32-1 as a real array index property.
2480         (ArrayInstance::getOwnPropertySlot): Ditto.
2481         (ArrayInstance::deleteProperty): Ditto.
2482         (ArrayInstance::put): Ditto.
2483         (ArrayInstance::propList): Added a FIXME comment.
2484         (ArrayInstance::put): Throw exception on trying to set invalid array length.
2485         (ArrayProtoFunc::callAsFunction): Do not use a separator argument when doing toString/toLocalString.
2486         * kjs/array_object.h: Added MAX_ARRAY_INDEX.
2487
2488 2006-01-13  Darin Adler  <darin@apple.com>
2489
2490         - Replaced tabs with spaces in source files that had less than 10 lines with tabs.
2491         - Set allow-tabs Subversion property in source files that have more than 10 lines with tabs.
2492
2493 2006-01-13  Anders Carlsson  <andersca@mac.com>
2494
2495         Reviewed by Eric.
2496
2497         * kjs/create_hash_table:
2498         Use correct size variables.
2499
2500 2006-01-13  Anders Carlsson  <andersca@mac.com>
2501
2502         Reviewed by Darin.
2503
2504         * kjs/create_hash_table:
2505         Don't create an empty entry array, instead add a entry with all fields
2506         set to null and set the hash table size to 1.
2507         
2508         * kjs/lookup.cpp:
2509         (findEntry):
2510         Remove the hash table size check
2511
2512 2006-01-12  Anders Carlsson  <andersca@mac.com>
2513
2514         Reviewed by Maciej.
2515
2516         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6494
2517         Crash when assigning a new function to a DOMParser object
2518         
2519         * JavaScriptCore.xcodeproj/project.pbxproj:
2520         Move lookup.cpp before lookup.h
2521         
2522         * kjs/lookup.cpp:
2523         (findEntry):
2524         If the hash table is empty, return 0 early.
2525
2526 2006-01-12  George Staikos <staikos@kde.org>
2527
2528         Reviewed by Darin.
2529
2530         * kjs/interpreter.cpp:
2531         * kjs/testkjs.cpp:
2532         * kjs/interpreter.h:
2533         Add helper to interpreter to call the collector in order to facilitate
2534         visibility rules in KDE.
2535
2536 2006-01-12  George Staikos <staikos@kde.org>
2537
2538         Reviewed by Maciej.
2539
2540         * kjs/kjs.pro: Updates to build the whole thing on Linux at least.
2541
2542         * kxmlcore/HashTable.h: Add missing assert.h
2543
2544 2006-01-12  Darin Adler  <darin@apple.com>
2545
2546         Reviewed by Geoff.
2547
2548         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6505
2549           retire APPLE_CHANGES from JavaScriptCore
2550
2551         * JavaScriptCore.xcodeproj/project.pbxproj: Removed both
2552         APPLE_CHANGES and HAVE_CONFIG_H from all targets.
2553
2554         * README: Removed. This had obsolete information in it
2555         and it wasn't clear what to replace it with.
2556
2557         * kjs/collector.h: Removed an APPLE_CHANGES if around something
2558         that's not really platform-specific (although it does use a
2559         platform-specific API at the moment).
2560         * kjs/collector.cpp: Removed a mistaken comment.
2561
2562         * kjs/grammar.y:
2563         * kjs/internal.cpp:
2564         * kjs/object.h:
2565         * kjs/operations.cpp:
2566         * kjs/operations.h:
2567         * kjs/ustring.h:
2568         Use __APPLE__ instead of APPLE_CHANGES for code that should be
2569         used only on Mac OS X.
2570
2571         * kjs/interpreter.cpp: Removed APPLE_CHANGES ifdef around the include
2572         of the runtime.h header. Even though that header isn't needed at the
2573         moment on platforms other than Mac OS X, the conditional stuff should
2574         be in the header itself, not in this one client.
2575
2576         * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed some
2577         code inside APPLE_CHANGES. I'm pretty sure this code isn't needed on
2578         any platform where pow is implemented corrrectly according to the IEEE
2579         standard. If it is needed on some, we can add it back with an appropriate
2580         #if for the platforms where it is needed.
2581
2582 2006-01-12  Justin Haygood  <justin@xiondigital.net>
2583
2584         Reviewed, tweaked, and landed by Darin.
2585
2586         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6416
2587           lexer.cpp, grammar.y protect include of config.h with "HAVE_CONFIG_H"
2588
2589         * kjs/dtoa.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2590         quotes instead of angle brackets. Moved dtoa.h include to the top.
2591         Changed system header includes to use angle brackets instead of quotes.
2592         * kjs/grammar.y: Removed HAVE_CONFIG_H, changed config.h to use
2593         quotes instead of angle brackets.
2594         * kjs/lexer.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2595         quotes instead of angle brackets. Moved lexer.h include to the top.
2596         * kjs/ustring.cpp: Removed HAVE_CONFIG_H, changed config.h to use
2597         quotes instead of angle brackets. Moved ustring.h include to the top.
2598
2599 2006-01-12  George Staikos <staikos@kde.org>
2600
2601         Reviewed by Maciej
2602
2603         - Import initial QMake file.  Doesn't fully work yet.
2604
2605 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2606
2607         Reviewed by Maciej and Darin, landed by Darin.
2608
2609         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5939
2610           final comma in javascript object prevents parsing
2611
2612         * kjs/grammar.y: Added rule to allow trailing comma in
2613         object construction.
2614
2615 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2616
2617         Reviewed by Geoff, landed by Darin.
2618
2619         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5308
2620           Number.toFixed doesn't include leading 0
2621
2622         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2623         Fixed a "<" that should have been a "<=".
2624
2625 2006-01-11  Ricci Adams  <ricciadams@apple.com>
2626
2627         Reviewed by Geoff, landed by Darin.
2628
2629         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5307
2630           Number.toFixed doesn't round 0.5 up
2631
2632         * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction):
2633         Fixed a ">" that should have been a ">=".
2634
2635 2006-01-11  Justin Haygood  <justin@xiondigital.net>
2636
2637         Reviewed and landed by Darin.
2638
2639         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6486
2640           JavaScriptCore should use system malloc on Windows
2641
2642         * kjs/config.h: Add USE_SYSTEM_MALLOC to the Win32 section.
2643
2644 2006-01-10  Darin Adler  <darin@apple.com>
2645
2646         * Makefile: Took out unneeded "export" line.
2647         * <many-files>: Changed a lot of flags (cleared bogus executable bits, set
2648           MIME types, other small corrections).
2649
2650 2006-01-09  Darin Adler  <darin@apple.com>
2651
2652         * Makefile.am: Removed.
2653
2654 2006-01-07  Anders Carlsson  <andersca@mac.com>
2655
2656         Reviewed by Maciej.
2657         
2658         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6373
2659         REGRESSION: JavaScript hang when comparing large array to null
2660         
2661         * kjs/object.h:
2662         (KJS::JSObject::isEqualToNull):
2663         Add new function which returns true if an object should be treated as null when
2664         doing comparisons.
2665         
2666         * kjs/operations.cpp:
2667         (KJS::equal):
2668         Use isEqualToNull.
2669
2670 2006-01-07  Alexey Proskuryakov  <ap@nypop.com>
2671
2672         Reviewed by Maciej.
2673
2674         - Fix WebCore development build
2675         http://bugzilla.opendarwin.org/show_bug.cgi?id=6408
2676
2677         * kxmlcore/Assertions.h: Use __VA_ARGS__ in variadic macros.
2678
2679 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
2680
2681         Reviewed by Darin.
2682
2683         - miscellaneous changes for 4% speedup on the JavaScript iBench
2684         http://bugzilla.opendarwin.org/show_bug.cgi?id=6396
2685         
2686         Changes mostly thanks to Maks Orlovich, tweaked a little by me.
2687
2688         * kjs/create_hash_table: Use the same hash as the one used by Identifier.
2689         * kjs/function.cpp:
2690         (KJS::FunctionImp::processParameters): Use the new List::copyFrom
2691         (KJS::ActivationImp::ActivationImp): track variable while iterating
2692         * kjs/internal.cpp:
2693         (KJS::StringImp::toObject): create StringInstance directly
2694         * kjs/list.cpp:
2695         (KJS::List::copy): implement in terms of copyFrom
2696         (KJS::List::copyFrom): more efficient way to copy in another list
2697         * kjs/list.h:
2698         * kjs/lookup.cpp:
2699         (keysMatch): updated to work with identifier hash
2700         (findEntry): ditto
2701         (Lookup::findEntry): ditto
2702         (Lookup::find): ditto
2703         * kjs/lookup.h:
2704
2705 2006-01-06  Maciej Stachowiak  <mjs@apple.com>
2706
2707         - fix development build failure from the previous checkin
2708
2709         * kjs/function.cpp:
2710         (KJS::ActivationImp::put): Use prototype() accessor in assert.
2711
2712 2006-01-05  Maciej Stachowiak  <mjs@apple.com>
2713
2714         Reviewed by Eric.
2715
2716         - fix remaining performance regression from Getter/Setter change
2717         http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
2718
2719         - Activation objects should not have __proto__ property
2720         http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
2721
2722         * kjs/function.cpp:
2723         (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
2724         skipping getter/setter handling and __proto__ handling, as well
2725         as inlining needed superclass stuff.
2726         (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
2727         __proto__, and do canPut directly in PropertyMap::put since there's no
2728         static property table either.
2729         * kjs/function.h:
2730         * kjs/property_map.cpp:
2731         (KJS::PropertyMap::put): Allow optionally inlining canPut check.
2732         * kjs/property_map.h:
2733
2734 2006-01-04  Geoffrey Garen  <ggaren@apple.com>
2735
2736         Patch by kimmo.t.kinnunen@nokia.com, reviewed by darin, tweaked by me.
2737
2738         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4921
2739         \u escape sequences in JavaScript identifiers
2740
2741         * kjs/function_object.cpp:
2742         (FunctionObjectImp::construct):
2743         * kjs/lexer.cpp:
2744         (Lexer::shift):
2745         (Lexer::lex):
2746         (Lexer::isWhiteSpace):
2747         (Lexer::isLineTerminator):
2748         (Lexer::isIdentStart):
2749         (Lexer::isIdentPart):
2750         (isDecimalDigit):
2751         (Lexer::scanRegExp):
2752         * kjs/lexer.h:
2753         (KJS::Lexer::):
2754
2755         * tests/mozilla/expected.html: Updated test results.
2756
2757 2005-12-30  Maciej Stachowiak  <mjs@apple.com>
2758
2759         No review, just test result update.
2760
2761         * tests/mozilla/expected.html: Updated for newly passing test from recent fixes.
2762
2763 2005-12-30  Anders Carlsson  <andersca@mac.com>
2764
2765         Reviewed by Maciej.
2766
2767         - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
2768         Getter setter test is failing
2769                 
2770         * kjs/object.cpp:
2771         (KJS::JSObject::put):
2772         Rework the getter setter part. We now walk the prototype chain, checking for
2773         getter/setter properties and only take the slow path if any are found. 
2774
2775 2005-12-30  Maks Orlovich <maksim@kde.org>
2776
2777         Reviewed and committed by Maciej.
2778
2779         - Handle negative, FP numbers with non-10 radix in toString
2780         http://bugzilla.opendarwin.org/show_bug.cgi?id=6259
2781
2782         (Merged from KJS, original work by Harri Porten)
2783         
2784         * kjs/number_object.cpp:
2785         (NumberProtoFunc::callAsFunction): rewrote Number.toString(radix) to work with  
2786         negative numbers, floating point and very large numbers.
2787
2788 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
2789
2790         Patch by Maks Orlovich, reviewed and landed by me.
2791
2792         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
2793         Fix Number.prototype.toFixed/toExponential(undefined)
2794
2795         * kjs/number_object.cpp:
2796         (NumberProtoFunc::callAsFunction):
2797
2798 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
2799
2800         Patch by Maks Orlovich, Reviewed and landed by me.
2801
2802         - http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
2803         Minor object naming updates (to match Mozilla, KJS)
2804
2805         * kjs/number_object.cpp:
2806         * kjs/regexp_object.cpp:
2807
2808 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
2809
2810         Patch by Maks Orlovich, reviewed by mjs.
2811
2812         This has 2 very minor fixes, covered by KJS testsuite:    
2813         1. Enumerates string indices in property list (with the same bug as array    
2814            object has in corresponding code). This is a mozilla emulation thing. 
2815         2. Permits properties with integer names in prototypes to be found    
2816
2817         * kjs/string_object.cpp:
2818         (StringInstance::getOwnPropertySlot):
2819         (StringInstanceImp::propList):
2820         * kjs/string_object.h:
2821
2822 2005-12-26  Geoffrey Garen  <ggaren@apple.com>
2823
2824         Reviewed by mjs.
2825
2826         - Fixed <rdar://problem/4364705> run-javascriptcore-tests crashes in 
2827         KJS::BlockNode::deref 
2828         AKA 
2829         http://bugzilla.opendarwin.org/show_bug.cgi?id=6233
2830         Reproducible stack-overflow crash in ~RefPtr<T> due to RefPtr<T> use in 
2831         linked lists
2832
2833         This patch does four things: 
2834         (1) Standardizes all our linked list nodes to use "next" as their next 
2835         pointers. 
2836         (2) Creates the ListRefPtr<T> class, a subclass of RefPtr<T> specialized
2837         to iteratively deref "next" pointers.
2838         (3) Standardizes our linked list nodes to use ListRefPtr<T> and 
2839         implement the releaseNext() function used by ~ListRefPtr<T>().
2840         (4) Adds to RefPtr<T> the release() method used by releaseNext().
2841
2842         - Modified existing mozilla test to ensure it would make deployment 
2843         builds crash as well.
2844
2845         * JavaScriptCore.xcodeproj/project.pbxproj:
2846         * kjs/nodes.cpp:
2847         (ElementNode::evaluate):
2848         (PropertyListNode::evaluate):
2849         (ArgumentListNode::evaluateList):
2850         (StatListNode::StatListNode):
2851         (StatListNode::execute):
2852         (StatListNode::processVarDecls):
2853         (VarDeclListNode::evaluate):
2854         (VarDeclListNode::processVarDecls):
2855         (VarStatementNode::execute):
2856         (VarStatementNode::processVarDecls):
2857         (BlockNode::BlockNode):
2858         (CaseClauseNode::evalStatements):
2859         (CaseClauseNode::processVarDecls):
2860         (ClauseListNode::processVarDecls):
2861         (CaseBlockNode::CaseBlockNode):
2862         (CaseBlockNode::evalBlock):
2863         (SourceElementsNode::SourceElementsNode):
2864         (SourceElementsNode::execute):
2865         (SourceElementsNode::processFuncDecl):
2866         (SourceElementsNode::processVarDecls):
2867         * kjs/nodes.h:
2868         (KJS::ElementNode::ElementNode):
2869         (KJS::ElementNode::releaseNext):
2870         (KJS::ArrayNode::ArrayNode):
2871         (KJS::PropertyListNode::PropertyListNode):
2872         (KJS::PropertyListNode::releaseNext):
2873         (KJS::ObjectLiteralNode::ObjectLiteralNode):
2874         (KJS::ArgumentListNode::ArgumentListNode):
2875         (KJS::ArgumentListNode::releaseNext):
2876         (KJS::ArgumentsNode::ArgumentsNode):
2877         (KJS::StatListNode::releaseNext):
2878         (KJS::VarDeclListNode::VarDeclListNode):
2879         (KJS::VarDeclListNode::releaseNext):
2880         (KJS::VarStatementNode::VarStatementNode):
2881         (KJS::ForNode::ForNode):
2882         (KJS::CaseClauseNode::CaseClauseNode):
2883         (KJS::ClauseListNode::ClauseListNode):
2884         (KJS::ClauseListNode::getClause):
2885         (KJS::ClauseListNode::getNext):
2886         (KJS::ClauseListNode::releaseNext):
2887         (KJS::ParameterNode::ParameterNode):
2888         (KJS::ParameterNode::releaseNext):
2889         (KJS::SourceElementsNode::releaseNext):
2890         * kjs/nodes2string.cpp:
2891         (ElementNode::streamTo):
2892         (PropertyListNode::streamTo):
2893         (ArgumentListNode::streamTo):
2894         (StatListNode::streamTo):
2895         (VarDeclListNode::streamTo):
2896         (VarStatementNode::streamTo):
2897         (CaseClauseNode::streamTo):
2898         (ClauseListNode::streamTo):
2899         (CaseBlockNode::streamTo):
2900         (SourceElementsNode::streamTo):
2901         * kxmlcore/ListRefPtr.h: Added.
2902         (KXMLCore::ListRefPtr::ListRefPtr):
2903         (KXMLCore::ListRefPtr::~ListRefPtr):
2904         (KXMLCore::ListRefPtr::operator=):
2905         * kxmlcore/RefPtr.h:
2906         (KXMLCore::RefPtr::release):
2907
2908 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
2909
2910         Reviewed by mjs.
2911
2912         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4026
2913         Math.random() not seeded.
2914
2915         Added call to sranddev() -- it executes the first time a process
2916         calls Math.random().
2917
2918         * kjs/math_object.cpp:
2919         (MathFuncImp::callAsFunction):
2920
2921 2005-12-29  Geoffrey Garen  <ggaren@apple.com>
2922
2923         Reviewed by darin.
2924
2925         - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6265
2926         Name change regression: Java doesn't know what JavaJSObject is
2927
2928         Changed strings passed to Java back to original "JSObject".
2929
2930         * bindings/jni/jni_jsobject.cpp:
2931         (JavaJSObject::convertValueToJObject):
2932         (JavaJSObject::convertJObjectToValue):
2933
2934 2005-12-28  Anders Carlsson  <andersca@mac.com>
2935
2936         Reviewed by Maciej.
2937
2938         - The JSC part of http://bugzilla.opendarwin.org/show_bug.cgi?id=6268
2939         Add undetectable document.all
2940         
2941         * kjs/operations.cpp:
2942         (KJS::equal):
2943         When comparing an object with null or undefined, call toPrimitive with 
2944         NullType as the preferred type.
2945
2946 2005-12-27  Anders Carlsson  <andersca@mac.com>
2947
2948         Reviewed by Darin.
2949
2950         * kjs/array_object.cpp:
2951         (ArrayProtoFunc::callAsFunction):
2952         Implement filter and map. Also, make the existing
2953         array iteration functions not invoke the callback for
2954         non-existing properties, just as Mozilla does now.
2955         
2956         * kjs/array_object.h:
2957         (KJS::ArrayProtoFunc::):
2958         Add filter and map.
2959         
2960         * tests/mozilla/expected.html:
2961         Update, two 1.6 tests now pass.
2962
2963 2005-12-27  Maciej Stachowiak  <mjs@apple.com>
2964
2965         - updated test results for new JS 1.6 tests
2966
2967         * tests/mozilla/expected.html:
2968
2969 2005-12-27  Anders Carlsson  <andersca@mac.com>
2970
2971         Reviewed by Maciej.
2972
2973         Add Mozilla JS 1.6 tests.
2974         
2975         * tests/mozilla/js1_6/Array/browser.js: Added.
2976         * tests/mozilla/js1_6/Array/regress-290592.js: Added.
2977         * tests/mozilla/js1_6/Array/regress-304828.js: Added.
2978         * tests/mozilla/js1_6/Array/regress-305002.js: Added.
2979         * tests/mozilla/js1_6/Array/regress-310425-01.js: Added.
2980         * tests/mozilla/js1_6/Array/regress-310425-02.js: Added.
2981         * tests/mozilla/js1_6/Array/regress-320887.js: Added.
2982         * tests/mozilla/js1_6/Array/shell.js: Added.
2983         * tests/mozilla/js1_6/README: Added.
2984         * tests/mozilla/js1_6/Regress/browser.js: Added.
2985         * tests/mozilla/js1_6/Regress/regress-301574.js: Added.
2986         * tests/mozilla/js1_6/Regress/regress-309242.js: Added.
2987         * tests/mozilla/js1_6/Regress/regress-311157-01.js: Added.
2988         * tests/mozilla/js1_6/Regress/regress-311157-02.js: Added.
2989         * tests/mozilla/js1_6/Regress/regress-314887.js: Added.
2990         * tests/mozilla/js1_6/Regress/regress-320172.js: Added.
2991         * tests/mozilla/js1_6/Regress/shell.js: Added.
2992         * tests/mozilla/js1_6/String/browser.js: Added.
2993         * tests/mozilla/js1_6/String/regress-306591.js: Added.
2994         * tests/mozilla/js1_6/String/shell.js: Added.
2995         * tests/mozilla/js1_6/browser.js: Added.
2996         * tests/mozilla/js1_6/shell.js: Added.
2997         * tests/mozilla/js1_6/template.js: Added.
2998
2999 2005-12-27  Maks Orlovich <maksim@kde.org>
3000
3001         Reviewed and landed by Maciej.
3002
3003         - fixed 6234: Can delete array index property incorrectly.
3004         http://bugzilla.opendarwin.org/show_bug.cgi?id=6234
3005
3006         * kjs/array_object.cpp:
3007         (ArrayInstance::deleteProperty): use toArrayIndex instead of toUInt32 when
3008         looking for array properties.
3009
3010 2005-12-27  Anders Carlsson  <andersca@mac.com>
3011
3012         Reviewed by Maciej.
3013
3014         * kjs/object.cpp:
3015         (KJS::JSObject::defineSetter):
3016         Remove duplicate call to putDirect.
3017
3018 2005-12-26  Maciej Stachowiak  <mjs@apple.com>
3019
3020         Reviewed by Darin and Geoff.
3021
3022         Changes by me and Anders.
3023
3024         - mostly fixed REGRESSION: 5-10% performance regression on JS iBench from getter/setter change
3025         http://bugzilla.opendarwin.org/show_bug.cgi?id=6083
3026
3027         - also fixed some warnings reported by -Winline
3028         
3029         * JavaScriptCorePrefix.h: Move new and delete definitions higher so there
3030         aren't conflicts with use in standard C++ headers
3031         * kjs/object.cpp:
3032         (KJS::throwSetterError): Moved this piece of put into a seprate function
3033         to avoid the PIC branch.
3034         (KJS::JSObject::put): Use hasGetterSetterProperties to avoid expensive stuff
3035         when not needed. Also use GetterSetter properties attribute.
3036         (KJS::JSObject::deleteProperty): Recompute whether any properties are getter/setter
3037         properties any more, if this one was one.
3038         (KJS::JSObject::defineGetter): Let the PropertyMap know that it has getter/setter
3039         properties now (and use the new attribute).
3040         (KJS::JSObject::defineSetter): Ditto.
3041         (KJS::JSObject::fillGetterPropertySlot): Out-of-line helper for getOwnPropertySlot,
3042         to avoid global variable access in the hot code path.
3043         * kjs/object.h:
3044         (KJS::): Added GetterSetter attribute.
3045         (KJS::JSCell::isObject): Moved lower to be after inline methods it uses.
3046         (KJS::JSValue::isObject): ditto
3047         (KJS::JSObject::getOwnPropertySlot): try to avoid impact of getters and setters
3048         as much as possible in the case where they are not being used
3049         * kjs/property_map.cpp:
3050         (KJS::PropertyMap::containsGettersOrSetters): New method to help with this
3051         * kjs/property_map.h:
3052         (KJS::PropertyMap::hasGetterSetterProperties): Ditto
3053         (KJS::PropertyMap::setHasGetterSetterProperties): Ditto
3054         (KJS::PropertyMap::PropertyMap): Added a crazy hack to store the
3055         global "has getter/setter properties" flag in the property map
3056         single entry, to avoid making objects any bigger.
3057         * kjs/value.h: Moved some things to object.h to make -Winline happier
3058
3059 2005-12-24  Maciej Stachowiak  <mjs@apple.com>
3060
3061         Reviewed by Eric and Dave Hyatt.
3062
3063         - make even const PassRefPtrs give transfer of ownership semantics
3064         http://bugzilla.opendarwin.org/show_bug.cgi?id=6238
3065         
3066         This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
3067         in assignment and copy construction. And this makes life way easier and removes
3068         the need for pass(). It is not really correct, but we pretty much never need a real
3069         const PassRefPtr, and this takes care of things for PassRefPtr temporaries.
3070         
3071         * kjs/identifier.cpp:
3072         (KJS::Identifier::add): No more need for pass()
3073         * kjs/property_map.cpp:
3074         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
3075         * kjs/ustring.cpp:
3076         (KJS::UString::Rep::create): Use adoptRef
3077         (KJS::UString::UString): No more need for pass
3078         (KJS::UString::append): No more need for pass
3079         (KJS::UString::substr): No more need for pass
3080         * kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh)
3081         (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference
3082         (KXMLCore::PassRefPtr::release): Made this a const method (ugh)
3083         (KXMLCore::PassRefPtr::operator=): clean up appropriately
3084         (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think
3085         it makes the behavior more clear and it is less verbose.
3086         (KXMLCore::static_pointer_cast): use adoptRef
3087         (KXMLCore::const_pointer_cast): use adoptRef
3088         * kxmlcore/RefPtr.h:
3089         (KXMLCore::RefPtr::RefPtr): take const PassRefPtr&
3090         (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
3091
3092 2005-12-25  Eric Seidel  <eseidel@apple.com>
3093
3094         Reviewed by mjs.
3095
3096         Unbreak HashTableConstIterator++ by returning const_iterator
3097
3098         * kxmlcore/HashTable.h:
3099         (KXMLCore::HashTableConstIterator::operator++): use const_iterator
3100
3101 2005-12-25  Eric Seidel  <eseidel@apple.com>
3102
3103         Reviewed by mjs.
3104
3105         Un-break HashTable copy constructor.
3106
3107         * kxmlcore/HashTable.h:
3108         (KXMLCore::::HashTable): use const_iterator instead
3109
3110 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
3111
3112         Reviewed by Eric.
3113
3114         - fixed "HashMap does not work with const pointer keys or values"
3115         http://bugzilla.opendarwin.org/show_bug.cgi?id=6222
3116         
3117         * kxmlcore/HashMapPtrSpec.h:
3118         (KXMLCore::HashMap): In all methods, explicitly cast all pointers
3119         to void * before passing to internal implementation. Use C-style
3120         casts instead of new-style casts, because the real solution would
3121         require a combo of reinterpret_cast anc const_cast.
3122
3123
3124 2005-12-23  Maciej Stachowiak  <mjs@apple.com>
3125
3126         - this time for sure
3127
3128         * kxmlcore/RefPtr.h:
3129         (KXMLCore::::swap):
3130
3131 2005-12-22  Maciej Stachowiak  <mjs@apple.com>
3132
3133         - fix build problem from last commit.
3134
3135         * kxmlcore/RefPtr.h:
3136         (KXMLCore::::swap):
3137
3138 2005-12-21  Maciej Stachowiak  <mjs@apple.com>
3139
3140         Reviewed by Darin.
3141
3142         - Make HashMap/HashSet support non-POD types
3143         http://bugzilla.opendarwin.org/show_bug.cgi?id=5332
3144
3145         The changes for support are relatively simple, but I also made extensive changes to
3146         avoid copying, so that there isn't refcount thrash when you put RefPtrs into a HashMap.
3147
3148         * kxmlcore/HashTable.h:
3149         (KXMLCore::swap): specialize swap for pairs, to swap elements individually,
3150         so that excess copies can be avoided.
3151         (KXMLCore::Mover::move): Template function to either copy or swap, used
3152         when transferring elements from old table to new.
3153         (KXMLCore::IdentityHashTranslator::hash): The old "converting lookup" templates
3154         that took two or three function parameters now take a class parameter, this is
3155         the class used to do a normal lookup.
3156         (KXMLCore::IdentityHashTranslator::equal): Ditto.
3157         (KXMLCore::IdentityHashTranslator::translate): Ditto. Translate now takes a reference
3158         to write into instead of returning a value to avoid redundant copies.
3159         (KXMLCore::HashTable::~HashTable): Use deallocateTable instead of freeing directly.
3160         (KXMLCore::HashTable::insert): Based on HashTranslator now instead of separate
3161         functions. Added a FIXME about a remaining rare excess copy.
3162         (KXMLCore::HashTable::isEmptyBucket): Use KeyTraits directly instead of unwrapping
3163         the key from Traits, to avoid creating and destroying pair, which copies.
3164         (KXMLCore::HashTable::isDeletedBucket): ditto
3165         (KXMLCore::HashTable::lookup): Use HashTranslator now instead of separate functions.
3166         (KXMLCore::HashTable::initializeBucket): Renamed from emptyBucket. Use placement new to
3167         work right for non-POD types.
3168         (KXMLCore::HashTable::deleteBucket): Use assignDeleted to avoid excess copies.
3169         (KXMLCore::HashTable::reinsert): use Mover template to copy or swap as appropriate
3170         (KXMLCore::HashTable::allocateTable): Initialize every bucket if calloc won't do.
3171         (KXMLCore::HashTable::deallocateTable): Destruct every bucket if needed.
3172         (KXMLCore::HashTable::rehash): Avoid copy before reinserting, so that swap can do its magic.
3173         (KXMLCore::HashTable::clear): use deallocateTable instead of freeing directly.
3174         (KXMLCore::HashTable::HashTable): be more dumb when copying to ensure that non-POD types
3175         work right
3176         * kxmlcore/HashFunctions.h:
3177         (KXMLCore::PointerHash): Specialize PointerHash for RefPtr
3178         * kxmlcore/HashMap.h:
3179         (KXMLCore::extractFirst): Return a reference not a full object to avoid
3180         copies.
3181         (KXMLCore::HashMapTranslator::hash): Use a special translator for insertion
3182         to defer making the pair as long as possible, thus avoiding needless copies.
3183         (KXMLCore::HashMapTranslator::equal): ditto
3184         (KXMLCore::HashMapTranslator::translate): ditto
3185         (KXMLCore::::inlineAdd): Shared by set and add to insert using HashMapTranslator
3186         (KXMLCore::::set): Use inlineAdd
3187         (KXMLCore::::add): Use inlineAdd
3188         * kxmlcore/HashMapPtrSpec.h:
3189         (KXMLCore::): Pass KeyTraits along
3190         * kxmlcore/HashSet.h:
3191         (KXMLCore::identityExtract): Return a reference not a full object to avoid copies.
3192         (KXMLCore::HashSetTranslatorAdapter::hash): Redo adapter stuff to work with
3193         the new HashTranslator approach.
3194         (KXMLCore::HashSetTranslatorAdapter::equal): ditto
3195         (KXMLCore::HashSetTranslatorAdapter::translate): ditto
3196         (KXMLCore::::insert): ditto
3197         * kxmlcore/HashTraits.h:
3198         (KXMLCore::GenericHashTraits): This is intended be used as a base class for
3199         customized traits: sensible defaults.
3200         (KXMLCore::): Use it a bunch
3201         (KXMLCore::assignDeleted): template function to allow pairs to be assigned the
3202         deleted value w/o excess copies.
3203         (KXMLCore::PairHashTraits::emptyValue): Updated
3204         (KXMLCore::PairHashTraits::deletedValue): Updated
3205         (KXMLCore::PairHashTraits::assignDeletedValue): part of assignDeleted hack
3206         (KXMLCore::DeletedValueAssigner::assignDeletedValue): Use template magic
3207         to either use use deletedValue or assignDeletedValue for the cases where we care.
3208         * kxmlcore/RefPtr.h:
3209         (KXMLCore::RefPtr::swap): Added swap method.
3210         (KXMLCore::swap): Added swap free function.
3211         * kjs/identifier.cpp:
3212         (KJS::CStringTranslator::hash): Use new HashTranslator class approach to
3213         alternate type based insertion.
3214         (KJS::CStringTranslator::equal): ditto
3215         (KJS::CStringTranslator::translate): ditto
3216         (KJS::Identifier::add): ditto
3217         (KJS::UCharBufferTranslator::hash): ditto
3218         (KJS::UCharBufferTranslator::equal): ditto
3219         (KJS::UCharBufferTranslator::translate): ditto
3220
3221         - irrelevant change:
3222         
3223         * kjs/array_object.cpp:
3224         (ArrayProtoFunc::callAsFunction): Removed a stray space.
3225
3226 2005-12-22  Anders Carlsson  <andersca@mac.com>
3227
3228         Reviewed by Eric and Darin.
3229
3230         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
3231         Would like to be able to define prototypes in headers
3232         
3233         * kjs/lookup.h:
3234         Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
3235         Also, namespace all macros by prefixing them with KJS_. 
3236
3237 2005-12-22  Darin Adler  <darin@apple.com>
3238
3239         Reviewed by Maciej.
3240
3241         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6191
3242           RefPtr/PassRefPtr have a leak issue, operator== issues
3243
3244         * kxmlcore/PassRefPtr.h:
3245         (KXMLCore::PassRefPtr::PassRefPtr): Remove non-template constructor that takes RefPtr
3246         since the constructor template that takes RefPtr should be sufficient. Add a constructor
3247         template that takes PassRefPtr&.
3248         (KXMLCore::PassRefPtr::adopt): Use PassRefPtr_Ref to avoid setting pointer first to
3249         0 and then to the pointer.
3250         (KXMLCore::PassRefPtr::operator=): Added template versions that take PassRefPtr& and
3251         RefPtr parameters.
3252         (KXMLCore::PassRefPtr::operator PassRefPtr<U>): Changed to fix leak -- old version
3253         would release and then ref.
3254         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
3255         Also remove unneeded const in raw pointer versions.
3256         (KXMLCore::operator!=): Ditto.
3257
3258         * kxmlcore/RefPtr.h:
3259         (KXMLCore::RefPtr::RefPtr): Add constructor template that takes PassRefPtr.
3260         (KXMLCore::RefPtr::operator=): Add assignment operator templates that take
3261         RefPtr and PassRefPtr.
3262         (KXMLCore::operator==): Make templates have two parameters so you can mix types.
3263         Also remove unneeded const in raw pointer versions.
3264         (KXMLCore::operator!=): Ditto.
3265
3266 2005-12-21  Timothy Hatcher  <timothy@apple.com>
3267
3268         * JavaScriptCore.xcodeproj/project.pbxproj:
3269           Set tab width to 8, indent width to 4 and uses tabs to false per file.
3270
3271 2005-12-21  Geoffrey Garen  <ggaren@apple.com>
3272
3273         Reviewed by Darin.
3274
3275         Removed evil hack for determining if a type is an integer, replaced
3276         with template metaprogramming.
3277
3278         * JavaScriptCore.xcodeproj/project.pbxproj: Set tab size to 2 for
3279         testkjs.cpp
3280         * kjs/testkjs.cpp:
3281         (main): Inserted asserts to test IsInteger. FIXME: Move these to
3282         KXMLCore unit tests directory when we create one.
3283         * kxmlcore/HashTraits.h:
3284         (KXMLCore::): Added IsInteger class for querying types.
3285
3286 2005-12-20  Maciej Stachowiak  <mjs@apple.com>
3287
3288         Reviewed by Darin.
3289
3290         - made ALWAYS_INLINE declare things inline as well as __attribute__((always_inline))
3291         http://bugzilla.opendarwin.org/show_bug.cgi?id=6159
3292
3293         * kxmlcore/AlwaysInline.h:
3294
3295 2005-12-19  Maciej Stachowiak  <mjs@apple.com>
3296
3297         Reviewed by Darin.
3298
3299         - fixed a leak in the assignment operator from PassRefPtr to RefPtr
3300         http://bugzilla.opendarwin.org/show_bug.cgi?id=6158
3301
3302         * kxmlcore/RefPtr.h:
3303         (KXMLCore::RefPtr::operator=):
3304
3305         - fix problem with PassRefPtr that darin spotted - it lacked a copy constructor
3306         and therefore was using the default one, which can lead to excess derefs
3307
3308         I fixed this by adding a copy constructor from non-const
3309         reference, and by adding a template pass() function that you have
3310         to use when raw pointer or RefPtr are passed where PassRefPtr is
3311         expected.
3312
3313         * kjs/identifier.cpp:
3314         (KJS::Identifier::add): Changed to have PassRefPtr return type and
3315         pass() the results.     
3316         * kjs/identifier.h:
3317         * kjs/property_map.cpp:
3318         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass()
3319         where required.
3320         * kjs/ustring.cpp:
3321         (KJS::UString::UString): Use pass() as needed.
3322         (KJS::UString::append): ditto
3323         (KJS::UString::substr): ditto
3324         * kjs/ustring.h:
3325         (KJS::UString::UString): Use initializer instead of assignment
3326         * kxmlcore/PassRefPtr.h:
3327         (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor
3328         (KXMLCore::pass): new template function to make it convenient to pass
3329         a PassRefPtr
3330
3331 2005-12-19  Geoffrey Garen  <ggaren@apple.com>
3332   
3333         Reviewed by Maciej.
3334
3335         Fixed <rdar://problem/4370397> Missing return statement in
3336         JSMethodNameToObjcMethodName.
3337
3338         JSMethodNameToObjcMethodName had a check for a name being too long, but
3339         the check was missing a return statement.
3340
3341         A lot of this code was confusing and some of it was wrong, so I fixed
3342         it up, added some asserts to catch this type of bug in the future, 
3343         changed some comments, and renamed some variables.
3344
3345         The two advantages of the new algorithm are (1) It makes writing past
3346         the end of the buffer virtually impossible because the test on the main
3347         loop is "while (not past end of buffer)" and (2) It's twice as fast
3348         because it doesn't call strlen. (There's no need to call strlen when
3349         we're walking the string ourselves.) 
3350         
3351         methodsNamed also supports arbitrary-length method names now. Just in 
3352         case the AppKit folks start getting REALLY verbose...
3353
3354         * bindings/objc/objc_class.mm:
3355         (KJS::Bindings::ObjcClass::methodsNamed):
3356         * bindings/objc/objc_utility.h:
3357         * bindings/objc/objc_utility.mm:
3358         (KJS::Bindings::JSMethodNameToObjcMethodName):
3359
3360 2005-12-19  Darin Adler  <darin@apple.com>
3361
3362         Originally done by both George Staikos and Alexey Proskuryakov.
3363
3364         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
3365           Sharedptr dependency can be removed
3366
3367         Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
3368         PassRefPtr were using NULL, which required including a header that
3369         defines NULL.
3370
3371         * kxmlcore/PassRefPtr.h:
3372         (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
3373         (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
3374         * kxmlcore/RefPtr.h:
3375         (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
3376         (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
3377         Also did some reformatting.
3378
3379 2005-12-19  Darin Adler  <darin@apple.com>
3380
3381         Reviewed by Geoff Garen and Eric Seidel.
3382
3383         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
3384           stop using <ostream> in WebCore, eliminating the <cmath> troubles it causes
3385
3386         * kjs/simple_number.h: Removed many unnecessary includes, including
3387         the <cmath> one to work around GCC library header bugs. We may have to
3388         add some includes elsewhere for platforms other than OS X, since our
3389         prefix header takes care of some things.
3390
3391         * kxmlcore/AlwaysInline.h: Added. Now clients that don't include
3392         simple_number.h can still get the ALWAYS_INLINE macro.
3393         * JavaScriptCore.xcodeproj/project.pbxproj: Added AlwaysInline.h.
3394
3395         * bindings/NP_jsobject.h: Removed a lot of unnecessary includes
3396         and removed C-specific stuff from this C++-only header.
3397         * bindings/jni/jni_jsobject.h: Removed a lot of unnecessary includes
3398         and did some reformatting.
3399         * bindings/objc/objc_runtime.h:  Removed an unnecessary include.
3400         * bindings/runtime.h: Removed some unneeded includes. Reformatted.
3401         * bindings/runtime.cpp: Updated to compile with header changes,
3402         including a lot of reformatting.
3403         * bindings/runtime_object.h: Removed an unnecessary include.
3404
3405 2005-12-13  Maciej Stachowiak  <mjs@apple.com>
3406
3407         Reviewed by Geoff and Adele
3408
3409         - replaced custom Identifier hashtable with HashSet
3410
3411         * kjs/identifier.cpp:
3412         (KXMLCore::):
3413         (KJS::identifierTable):
3414         (KJS::Identifier::equal):
3415         (KJS::hash):
3416         (KJS::equal):
3417         (KJS::convert):
3418         (KJS::Identifier::add):
3419         (KJS::Identifier::remove):
3420         * kjs/identifier.h:
3421         * kjs/internal.cpp:
3422         (KJS::InterpreterImp::initGlobalObject):
3423
3424 2005-12-18  Justin Haygood  <justin@xiondigital.net>
3425
3426         Reviewed, tweaked, and landed by Darin.
3427
3428         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227
3429           Array indexOf() extension for JavaScript 1.5 Core
3430
3431         * kjs/array_object.h:
3432         * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf.
3433
3434 2005-12-18  Anders Carlsson  <andersca@mac.com>
3435
3436         Reviewed by Darin and Geoffrey.
3437
3438         - fix for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4000>
3439         Object.prototype is missing isPrototypeOf
3440         
3441         * kjs/object_object.cpp:
3442         (ObjectPrototype::ObjectPrototype):
3443         Add isPrototypeOf to object prototype.
3444         
3445         (ObjectProtoFunc::callAsFunction):
3446         Implement isPrototypeOf
3447         
3448         * kjs/object_object.h:
3449         (KJS::ObjectProtoFunc::):
3450         Add id for isPrototypeOf.
3451
3452 2005-12-17  Geoffrey Garen  <ggaren@apple.com>
3453
3454         Reviewed by Darin.
3455
3456         Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6119
3457         split() function ignores case insensitive modifier.
3458
3459         Glossary:
3460         RegExpImp: The C++ object you get when JavaScript executes
3461                    "new RegExp()".
3462         RegExp:    A C++ wrapper object that performs regular expression
3463                    matching on behalf of a RegExpImp.
3464
3465         Instead of unnecessarily constructing a RegExp which (wrongly) lacks
3466         any modifiers, String.split() now uses the RegExp built in to the 
3467         RegExpImp passed to it, which has the right modifiers already.
3468
3469         I also cleaned up other bits of the string code to standardized how
3470         we handle RegExpImp arguments.
3471
3472         * ChangeLog:
3473         * kjs/string_object.cpp:
3474         (replace):
3475         (StringProtoFunc::callAsFunction):
3476
3477 2005-12-16  David Hyatt  <hyatt@apple.com>
3478
3479         Remove unused RefPtr constructors that can create an ambiguity in ustring on some platforms.
3480         
3481         Reviewed by mjs
3482
3483         * kxmlcore/RefPtr.h:
3484         (KXMLCore::RefPtr::RefPtr):
3485
3486 2005-12-15  Darin Adler  <darin@apple.com>
3487
3488         Reviewed by Maciej.
3489
3490         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
3491           speed up JavaScript parsing by not creating a UString just to parse
3492
3493         * kjs/internal.h:
3494         * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
3495         and length rather than a UString.
3496
3497         * kjs/interpreter.h:
3498         * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
3499
3500         * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
3501         "convert to raw pointer" operator in this class.
3502
3503 === Safari-521~5 ===
3504
3505 2005-12-13  Geoffrey Garen  <ggaren@apple.com>
3506
3507         Updated test results to match Anders's last fix.
3508
3509         * tests/mozilla/expected.html:
3510
3511 2005-12-13  Anders Carlsson  <andersca@mac.com>
3512
3513         * ChangeLog: Add titles for my bugzilla bugs.
3514
3515 2005-12-13  Anders Carlsson  <andersca@mac.com>