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