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