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