Patch contributed by Carsten Guenther <cguenther@gmail.com>.
[WebKit-https.git] / JavaScriptCore / ChangeLog
1 2005-06-28  Geoffrey Garen  <ggaren@apple.com>
2
3         Patch contributed by Carsten Guenther <cguenther@gmail.com>.
4
5         -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3477
6         some US-centric date formats not parsed by JavaScript (clock at news8austin.com)
7
8         Reviewed by darin.
9
10         * kjs/date_object.cpp:
11         (formatLocaleDate):
12         (day):
13         (dayFromYear):
14         (daysInYear):
15         (timeFromYear):
16         (yearFromTime):
17         (weekDay):
18         (timeZoneOffset):
19         (DateProtoFuncImp::call):
20         (DateObjectImp::construct):
21         (KJS::parseDate):
22         (ymdhms_to_seconds):
23         (KJS::makeTime):
24         (findMonth):
25         (KJS::KRFCDate_parseDate):
26         * kjs/date_object.h:
27         * tests/mozilla/expected.html: updated expected test results to reflect fix
28
29 2005-06-26  Maciej Stachowiak  <mjs@apple.com>
30
31         Reviewed by Darin.
32
33         - replace hash functions  with better ones
34
35         * JavaScriptCore.pbproj/project.pbxproj: Add new file to build.
36         * kjs/interpreter_map.cpp:
37         (KJS::InterpreterMap::computeHash): Use shared pointer hash.
38         * kjs/pointer_hash.h: Added.
39         (KJS::pointerHash): Pointer hash based on 32-bit mix and 64-bit mix hashes.
40         * kjs/protected_values.cpp:
41         (KJS::ProtectedValues::computeHash): Use shared pointer hash.
42         * kjs/ustring.cpp:
43         (KJS::UString::Rep::computeHash): Use SuperFastHash algorithm.
44
45 2005-06-22  Darin Adler  <darin@apple.com>
46
47         Change by Anders Carlsson.
48         Reviewed by me.
49
50         - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3294>
51           String.prototype.replace() fails with function as second param
52
53         * kjs/string_object.cpp: (replace): Added code to handle functions.
54
55         * tests/mozilla/expected.html: Updated since ecma_3/RegExp/regress-209067.js is fixed now.
56
57         * tests/mozilla/run-mozilla-tests: Fix a minor coding style issue that leads to a warning each
58         time we run the tests.
59
60 2005-06-21  Adele Peterson  <adele@apple.com>
61
62         rolling out fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3293, since it caused layout test failures.
63         fast/forms/element-by-name
64         fast/loader/loadInProgress
65
66         * ChangeLog:
67         * bindings/objc/objc_runtime.h:
68         * bindings/objc/objc_runtime.mm:
69         (ObjcFallbackObjectImp::hasProperty):
70         * bindings/runtime_array.cpp:
71         (RuntimeArrayImp::hasProperty):
72         * bindings/runtime_array.h:
73         * bindings/runtime_object.cpp:
74         (RuntimeObjectImp::hasProperty):
75         * bindings/runtime_object.h:
76         * kjs/array_instance.h:
77         * kjs/array_object.cpp:
78         (ArrayInstanceImp::hasProperty):
79         * kjs/function.cpp:
80         (KJS::FunctionImp::hasProperty):
81         (KJS::ActivationImp::hasProperty):
82         * kjs/function.h:
83         * kjs/object.cpp:
84         (KJS::ObjectImp::hasProperty):
85         * kjs/object.h:
86         * kjs/object_object.cpp:
87         (ObjectPrototypeImp::ObjectPrototypeImp):
88         (ObjectProtoFuncImp::call):
89         * kjs/object_object.h:
90         (KJS::ObjectProtoFuncImp::):
91         * kjs/string_object.cpp:
92         (StringInstanceImp::hasProperty):
93         * kjs/string_object.h:
94         * tests/mozilla/expected.html:
95
96 2005-06-21  Darin Adler  <darin@apple.com>
97
98         * JavaScriptCore.pbproj/project.pbxproj: Switched to a build rule rather than a build phase for
99         .y files -- this gets rid of the problem where modifying the .y file would not cause sufficient
100         compilation.
101
102         * kjs/grammar_wrapper.cpp: Removed.
103
104 2005-06-21  Adele Peterson  <adele@apple.com>
105
106         Patch from Anders Carlsson <andersca@mac.com>, reviewed by Darin.
107
108         Fixed: <http://bugzilla.opendarwin.org/show_bug.cgi?id=3450>
109         <rdar://problem/3881901> String.replace() method not working when regex pattern contains {n, m}
110
111         * pcre/pcre.c: (pcre_compile): Remember the last char length so it can be subtracted correctly if needed.
112
113 2005-06-21  Geoffrey Garen  <ggaren@apple.com>
114
115         - fixed <rdar://problem/4155532> 'delete' succeeds on functions
116         - fixed <rdar://problem/4155049> javascript function named as "opener" doesn't get called because of window.opener property
117         
118         Reviewed by cblu.
119
120         * kjs/nodes.cpp:
121         (FuncDeclNode::processFuncDecl): Functions now have DontDelete and Internal attributes set when appropriate.
122
123         Test cases:
124         * tests/mozilla/expected.html: Updated for one new success.
125         - see also test case added in WebCore.
126
127 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
128
129         Reviewed by Darin(first pass) and Hyatt.
130
131         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3576
132         (roll in support for "const" keyword from KDE tree)
133         - make processVarDecls handle deletability of variables declared
134         in an eval block the same as evaluate would
135         - make eval() call processVarDecls - needed to match mozilla and
136         to make the second change testable
137
138         I started with the KDE implementation of const but I ended up changing it a bit
139         to avoid the use of a global variable. Now instead of the global variable it distinguishes
140         const and var at the grammar level so the appropriate node can know the right kind of
141         declaration.
142
143         Test cases:
144         * tests/mozilla/expected.html: Updated for one new test that is
145         failing - we used to bail on it entirely because it checks for
146         const support before starting.
147         - see also test cases added in WebCore
148
149         * kjs/grammar.y: Add rules for const declarations.
150         * kjs/keywords.table: Add const keyword.
151         * kjs/nodes.cpp:
152         (VarDeclNode::VarDeclNode): Add parameter.
153         (VarDeclNode::evaluate): Add const support.
154         (VarDeclNode::processVarDecls): Add const support.
155         (VarStatementNode::execute): Irrelevant change.
156         (ForInNode::ForInNode): Tell our variable node that it's a variable.
157         * kjs/nodes.h:
158         (KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
159         (KJS::VarStatementNode::VarStatementNode): Irrelevant change.
160         * kjs/function.cpp:
161         (KJS::GlobalFuncImp::call): Process var decls before evaluating.
162
163 2005-06-20  Maciej Stachowiak  <mjs@apple.com>
164
165         Patch from Mark Rowe <opendarwin.org@bdash.net.nz>, reviewed by me.
166
167         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3293
168         
169         Test cases added: 
170         * tests/mozilla/expected.html: Updated for two fixed tests.
171         - also added a layout test
172
173         * bindings/objc/objc_runtime.h:
174         * bindings/objc/objc_runtime.mm:
175         (ObjcFallbackObjectImp::hasOwnProperty):
176         * bindings/runtime_array.cpp:
177         (RuntimeArrayImp::hasOwnProperty):
178         * bindings/runtime_array.h:
179         * bindings/runtime_object.cpp:
180         (RuntimeObjectImp::hasOwnProperty):
181         * bindings/runtime_object.h:
182         * kjs/array_instance.h:
183         * kjs/array_object.cpp:
184         (ArrayInstanceImp::hasOwnProperty):
185         * kjs/function.cpp:
186         (KJS::FunctionImp::hasOwnProperty):
187         (KJS::ActivationImp::hasOwnProperty):
188         * kjs/function.h:
189         * kjs/object.cpp:
190         (KJS::ObjectImp::hasProperty):
191         (KJS::ObjectImp::hasOwnProperty):
192         * kjs/object.h:
193         (KJS::Object::hasOwnProperty):
194         * kjs/object_object.cpp:
195         (ObjectPrototypeImp::ObjectPrototypeImp):
196         (ObjectProtoFuncImp::call):
197         * kjs/object_object.h:
198         (KJS::ObjectProtoFuncImp::):
199         * kjs/string_object.cpp:
200         (StringInstanceImp::hasOwnProperty):
201         * kjs/string_object.h:
202
203 2005-06-18  Darin Adler  <darin@apple.com>
204
205         Reviewed by Eric Seidel.
206
207         * pcre/get.c: (pcre_get_substring): Fix some computations so this works for UTF-16.
208         This is unused in the current JavaScriptCore, but still good to fix.
209
210 2005-06-18  Darin Adler  <darin@apple.com>
211
212         Change by Finlay Dobbie.
213         Reviewed by me.
214
215         - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3331>
216           10.3.9 Build Failure: NSString may not respond to `+stringWithCString:encoding:'
217
218         * bindings/objc/WebScriptObject.mm: (-[WebScriptObject stringRepresentation]):
219         Undo change we did a while back to work around the gcc 3.3 compiler error.
220         It no longer seems to happen, and the workaround code was 10.4-specific.
221
222 2005-06-16  Geoffrey Garen  <ggaren@apple.com>
223
224         Fixed: <rdar://problem/4151759> 'delete' fails on variables declared inside 'eval' statements.
225
226         Reviewed by cblu.
227
228         * kjs/context.h:
229         (KJS::ContextImp::codeType): Added code type accessor for execution context objects.
230         * kjs/internal.cpp:
231         (ContextImp::ContextImp): Reflects change to ContextImp::codeType.
232         * kjs/nodes.cpp:
233         (VarDeclNode::evaluate): Added separate code path for variable declarations inside 'eval' statements.
234         * tests/mozilla/expected.html: Updated expected test results to reflect fix.
235
236 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
237
238         Updated expected.html to reflect fix to <rdar://problem/4147745>.
239
240         Reviewed by cblu.
241
242         * tests/mozilla/expected.html:
243
244 2005-06-14  Geoffrey Garen  <ggaren@apple.com>
245
246         Fixed: <rdar://problem/4147745> JavaScript discards locally defined "arguments" property
247
248         No layout tests added because this change fixes existing tests:
249         ecma/ExecutionContexts/10.1.6.js
250         ecma_3/Function/regress-94506.js
251         js1_4/Functions/function-001.js
252
253         Reviewed by cblu.
254
255         * kjs/function.cpp:
256         (KJS::ActivationImp::get): get now checks for an "arguments" property defined in the local variable object
257         before trying to return the built-in arguments array.
258         
259         * kjs/function.h: ActivationImp::put no longer overrides ObjectImp::put
260
261 2005-06-10  Darin Adler  <darin@apple.com>
262
263         Change by Mark Rowe <opendarwin.org@bdash.net.nz>.
264         Reviewed by me.
265
266         - further improvements to exception file/line number fix
267
268         * kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
269         * kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
270         (Node::setExceptionDetailsIfNeeded): Added.
271
272 2005-06-09  Darin Adler  <darin@apple.com>
273
274         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
275         Reviewed by me.
276
277         * kjs/nodes.cpp: Get rid of unneeded this->.
278
279 2005-06-08  Maciej Stachowiak  <mjs@apple.com>
280
281         Change by Mark Rowe <opendarwin.org@bdash.net.nz>
282         Reviewed by me.
283
284         - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3327
285         (Exception When Setting Style to Invalid Value Lacks Line/File Information)
286
287         * kjs/nodes.cpp: Include source file and line number when making exception in
288         KJS_CHECKEXCEPTIONVALUE.
289
290 2005-06-07  Darin Adler  <darin@apple.com>
291
292         Change by Toby Peterson <toby@opendarwin.org>.
293         Reviewed by me.
294
295         * JavaScriptCore.pbproj/project.pbxproj: Allow bison 2.0, which generates the file
296         with a different name.
297
298 2005-06-07  Darin Adler  <darin@apple.com>
299
300         Change by Toby Peterson <toby@opendarwin.org>.
301         Reviewed by me.
302
303         * kjs/grammar.y: Remove bogus extra line from grammar.y. Toby got this change from KDE KJS.
304
305 2005-06-06  Darin Adler  <darin@apple.com>
306
307         * tests/mozilla/run-mozilla-tests: Wrote a perl version of this so we don't require
308         the "jst" tool to run the tests.
309
310 2005-06-04  Darin Adler  <darin@apple.com>
311
312         Reviewed by Maciej.
313
314         - add libicu headers
315
316         * JavaScriptCore.pbproj/project.pbxproj: Added icu directory to header search path.
317
318         * icu/README: Added.
319         * icu/unicode/platform.h: Added.
320         * icu/unicode/uchar.h: Added.
321         * icu/unicode/uconfig.h: Added.
322         * icu/unicode/umachine.h: Added.
323         * icu/unicode/urename.h: Added.
324         * icu/unicode/utf.h: Added.
325         * icu/unicode/utf16.h: Added.
326         * icu/unicode/utf8.h: Added.
327         * icu/unicode/utf_old.h: Added.
328         * icu/unicode/utypes.h: Added.
329         * icu/unicode/uversion.h: Added.
330
331 2005-05-19  Darin Adler  <darin@apple.com>
332
333         Reviewed by Maciej.
334         
335         - turned off exceptions and RTTI; seems to cut JavaScriptCore code size by about 22%
336
337         * JavaScriptCore.pbproj/project.pbxproj: Turn off exceptions and RTTI for both
338         the framework and testkjs tool.
339
340 2005-05-18  Darin Adler  <darin@apple.com>
341
342         Reviewed by Maciej.
343
344         - got rid of code that depended on RTTI
345
346         * kjs/collector.cpp:
347         (KJS::className): Added. Gets class name in a KJS way, rather than a C++ RTTI way.
348         (KJS::Collector::rootObjectClasses): Use className instead of typeid names.
349
350 2005-05-18  Darin Adler  <darin@apple.com>
351
352         Reviewed by Maciej.
353
354         - fix a failure seen in the Mozilla JavaScript tests where a live object was garbage-collected
355           when the only reference to it was in an argList on the stack
356
357         * kjs/list.h: Moved the operator= function into the .cpp file since it's too big to be
358         a good choice to inline.
359         * kjs/list.cpp: (KJS::List::operator=): Moved this formerly-inline function into a separate
360         file and added missing code to update valueRefCount. It's the latter that fixes the bug.
361
362 2005-05-16  Darin Adler  <darin@apple.com>
363
364         Reviewed by Adele.
365
366         - fixed issues preventing us from compiling with newer versions of gcc 4.0
367
368         * kjs/ustring.cpp:
369         (KJS::operator==): Remove redundant and illegal KJS:: prefix on this function's definition.
370         (KJS::operator<): Ditto.
371         (KJS::compare): Ditto.
372
373 2005-05-09  Darin Adler  <darin@apple.com>
374
375         Reviewed by John.
376
377         - turn on conservative GC unconditionally and start on SPI changes to
378           eliminate the now-unneeded smart pointers since we don't ref count any more
379
380         * kjs/value.h: Removed macros to turn conservative GC on and off.
381         Removed ref and deref functions.
382         (KJS::ValueImp::ValueImp): Removed non-conservative-GC code path.
383         (KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly.
384         (KJS::ValueImp::isNull): Ditto.
385         (KJS::ValueImp::isBoolean): Ditto.
386         (KJS::ValueImp::isNumber): Ditto.
387         (KJS::ValueImp::isString): Ditto.
388         (KJS::ValueImp::isObject): Ditto.
389         (KJS::Value::Value): Removed non-conservative-GC code path and made constructor no
390         longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with
391         conservative GC and eases the transition.
392         (KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value.
393         (KJS::ValueImp::marked): Removed non-conservative-GC code path.
394
395         * kjs/value.cpp:
396         (KJS::ValueImp::mark): Removed non-conservative-GC code path.
397         (KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly.
398         (KJS::ValueImp::isBoolean): Ditto.
399         (KJS::ValueImp::isNumber): Ditto.
400         (KJS::ValueImp::isString): Ditto.
401         (KJS::ValueImp::asString): Ditto.
402         (KJS::ValueImp::isObject): Ditto.
403         (KJS::undefined): Ditto.
404         (KJS::null): Ditto.
405         (KJS::boolean): Ditto.
406         (KJS::string): Ditto.
407         (KJS::zero): Ditto.
408         (KJS::one): Ditto.
409         (KJS::two): Ditto.
410         (KJS::number): Ditto.
411
412         * kjs/object.h: Made constructor no longer explicit so we can quietly create Object
413         wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition.
414         (KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object.
415         (KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function.
416         (KJS::ValueImp::asObject): Ditto.
417
418         * kjs/object.cpp:
419         (KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path.
420         (KJS::ObjectImp::putDirect): Ditto.
421         (KJS::error): Added. Function in the new SPI style to create an error object.
422
423         * kjs/internal.h: Added the new number-constructing functions as friends of NumberImp.
424         There may be a more elegant way to do this later; what's important now is the new SPI.
425
426         * kjs/collector.h:  Remove non-conservative-GC code path and also take out some
427         unneeded APPLE_CHANGES.
428
429         * bindings/runtime_root.cpp:
430         (KJS::Bindings::addNativeReference): Remove non-conservative-GC code path.
431         (KJS::Bindings::removeNativeReference): Ditto.
432         (RootObject::removeAllNativeReferences): Ditto.
433         * bindings/runtime_root.h:
434         (KJS::Bindings::RootObject::~RootObject): Ditto.
435         (KJS::Bindings::RootObject::setRootObjectImp): Ditto.
436         * kjs/collector.cpp:
437         (KJS::Collector::allocate): Ditto.
438         (KJS::Collector::collect): Ditto.
439         (KJS::Collector::numGCNotAllowedObjects): Ditto.
440         (KJS::Collector::numReferencedObjects): Ditto.
441         (KJS::Collector::rootObjectClasses): Ditto.
442         * kjs/internal.cpp:
443         (NumberImp::create): Ditto.
444         (InterpreterImp::globalInit): Ditto.
445         (InterpreterImp::globalClear): Ditto.
446         * kjs/list.cpp:
447         (KJS::List::markProtectedLists): Ditto.
448         (KJS::List::clear): Ditto.
449         (KJS::List::append): Ditto.
450         * kjs/list.h:
451         (KJS::List::List): Ditto.
452         (KJS::List::deref): Ditto.
453         (KJS::List::operator=): Ditto.
454         * kjs/protect.h:
455         (KJS::gcProtect): Ditto.
456         (KJS::gcUnprotect): Ditto.
457
458 2005-05-09  Chris Blumenberg  <cblu@apple.com>
459
460         Workaround gcc 3.3 internal compiler errors.
461
462         Reviewed by darin.
463
464         * bindings/objc/WebScriptObject.mm:
465         (-[WebScriptObject stringRepresentation]): call [NSString stringWithCString:encoding] rather than using @""
466
467 2005-05-09  Darin Adler  <darin@apple.com>
468
469         * Makefile.am: Don't set up PBXIntermediatesDirectory explicitly;
470         Not needed to make builds work, spews undesirable error messages too.
471
472 2005-05-06  Darin Adler  <darin@apple.com>
473
474         Reviewed by Maciej.
475
476         - make building multiple trees with make work better
477
478         * Makefile.am: Set up Xcode build directory before invoking xcodebuild.
479
480 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
481
482         Reviewed by Darin.
483
484         <rdar://problem/4086570> Crash in JavaScriptCore with RSS Visualizer
485         
486         * kjs/internal.cpp:
487         (InterpreterImp::mark): mark staticNaN, it is usually protected by the Number
488         prototype but there is a small window where it can get collected.
489
490 2005-05-04  Darin Adler  <darin@apple.com>
491
492         Reviewed by Dave Hyatt.
493
494         - another gcc-4.0-related fix
495
496         * bindings/runtime_root.h: Take off extra namespace prefixes that apparently cause problems
497         compiling with gcc 4.0, although I have not observed the problems.
498
499 2005-05-04  Darin Adler  <darin@apple.com>
500
501         Reviewed by Dave Hyatt.
502
503         - fixed build rules to match other projects
504
505         * JavaScriptCore.pbproj/project.pbxproj: Set deployment target to 10.3 in the build styles.
506         When built without a build style (by Apple B&I) we want to get the target from the
507         environment. But when built with a build style (by Safari engineers and others), we want
508         to use 10.3.
509
510         * Makefile.am: Took out extra parameters that make command-line building different from
511         Xcode building. Now that this is fixed, you should not get a full rebuild if you switch
512         from command line to Xcode or back.
513
514 2005-05-04  Maciej Stachowiak  <mjs@apple.com>
515
516         - revert presumably accidental change to mozilla JS test expected results, this
517         was making the tests fail.
518
519         * tests/mozilla/expected.html:
520
521 2005-05-03  Richard Williamson   <rjw@apple.com>
522
523         Fixed <rdar://problem/4102644> Crash in LiveConnect below KJS::Bindings::JavaInstance::stringValue() const
524
525         Correctly handle accessing nil objects from a Java object array.
526
527         Reviewed by John.
528
529         * bindings/jni/jni_runtime.cpp:
530         (JavaArray::valueAt):
531
532 2005-05-01  Darin Adler  <darin@apple.com>
533
534         - move to Xcode native targets and stop checking in generated files
535
536         * JavaScriptCore.pbproj/project.pbxproj: Updated to use native targets and generate all the generated
537         files, so we don't have to check them in any more.
538         * Info.plist: Added. Native targets use a separate file for this.
539
540         * Makefile.am: Removed pcre and kjs SUBDIRS. Also removed code that deleted the embedded copy of this
541         framework, since we haven't been embedding it for some time.
542
543         * kjs/grammar_wrapper.cpp: Added. Shell used to compile grammar.cpp since we can't add a generated file
544         easily to the list of files to be compiled.
545
546         * kjs/.cvsignore: Removed.
547         * kjs/Makefile.am: Removed.
548         * kjs/array_object.lut.h: Removed.
549         * kjs/date_object.lut.h: Removed.
550         * kjs/grammar.cpp: Removed.
551         * kjs/grammar.cpp.h: Removed.
552         * kjs/grammar.h: Removed.
553         * kjs/lexer.lut.h: Removed.
554         * kjs/math_object.lut.h: Removed.
555         * kjs/number_object.lut.h: Removed.
556         * kjs/string_object.lut.h: Removed.
557         * pcre/.cvsignore: Removed.
558         * pcre/Makefile.am: Removed.
559         * pcre/chartables.c: Removed.
560
561 2005-04-28  Darin Adler  <darin@apple.com>
562
563         Reviewed by Dave Harrison.
564
565         - fixed problems preventing us from compiling with gcc 4.0
566
567         * JavaScriptCore.pbproj/project.pbxproj: Removed -Wmissing-prototypes from
568         WARNING_CPLUSPLUSFLAGS since it's now a C-only warning.
569
570         * bindings/jni/jni_jsobject.cpp:
571         (JSObject::getSlot): Changed some %d to %ld where the parameters where long ints.
572         (JSObject::setSlot): Ditto.
573         * bindings/jni/jni_utility.cpp:
574         (KJS::Bindings::getJavaVM): Ditto.
575         (KJS::Bindings::getJNIEnv): Ditto.
576         * bindings/objc/objc_utility.mm: Fixed include of <JavascriptCore/internal.h> that needed the
577         letter "S" capitalized.
578         * kjs/bool_object.cpp: (BooleanProtoFuncImp::call): Rearranged how this function returns to
579         avoid incorrect gcc 4.0 warning.
580         * kjs/collector.cpp: (KJS::Collector::markStackObjectsConservatively): Changed code to check
581         the alignment of the passed-in pointers to only require pointer-level alignment, not 8-byte alignment.
582         Prevents a crash on garbage collect when compiled with gcc 4.0.
583         * kjs/nodes.cpp:
584         (WhileNode::execute): Added a redundant return after an infinite loop to work around incorrect gcc 4.0 warning.
585         (ForNode::execute): Ditto.
586         (SwitchNode::execute):Rearranged how this function returns to avoid incorrect gcc 4.0 warning.
587         (LabelNode::execute): Ditto.
588         * kjs/string_object.cpp: (replace): Ditto.
589
590 2005-04-26  Richard Williamson   <rjw@apple.com>
591
592         Fixed <rdar://problem/4098713> Scripting API is incompatible with Mozilla
593         
594         We were incompatible with Mozilla's implementation of the scripting APIs in
595         two ways:
596
597         Their NPN_SetException has the following signature:
598
599             void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
600
601         ours has:
602
603             void NPN_SetException (NPObject * npobj, const NPString *message);
604
605         Also, they expect the string returned from NPN_UTF8FromIdentifier() to be freed by caller.
606         We do not.
607
608         I changed both behaviors to match Mozilla.
609
610         Reviewed by Chris.
611
612         * bindings/NP_jsobject.cpp:
613         (_NPN_SetException):
614         * bindings/npruntime.cpp:
615         (_NPN_UTF8FromIdentifier):
616         (_NPN_IntFromIdentifier):
617         (_NPN_SetExceptionWithUTF8):
618         * bindings/npruntime.h:
619         * bindings/npruntime_impl.h:
620
621 2005-04-26  Maciej Stachowiak  <mjs@apple.com>
622
623         Reviewed by Chris.
624
625         <rdar://problem/4092136> reproducible crash in KJS::kjs_fast_realloc loading maps.google.com
626         
627         * kjs/string_object.cpp:
628         (StringObjectFuncImp::call): Allocate adopted ustring buffer properly.
629
630 2005-04-22  Darin Adler  <darin@apple.com>
631
632         Reviewed by Maciej.
633
634         * kjs/ustring.cpp: (KJS::UString::UTF8String): Fix off-by-one error in surrogate pair logic.
635
636 2005-04-22  Darin Adler  <darin@apple.com>
637
638         Reviewed by John.
639
640         - fixed <rdar://problem/4090046> JavaScript throw statement causes parse error when no semicolon is present
641
642         * kjs/grammar.y: Added an additional rule for throw like the ones we have for all the other semicolon rules.
643         Not sure why we missed this one earlier.
644
645         * kjs/grammar.cpp: Regenerated.
646
647 === JavaScriptCore-412.1 ===
648
649 2005-04-20  Darin Adler  <darin@apple.com>
650
651         Reviewed by Maciej.
652
653         - speedups, total 12% on JavaScript iBench
654
655         I ran the benchmark under Shark and followed its advice a lot, mainly.
656
657         * kjs/collector.cpp:
658         (KJS::Collector::allocate): Take out special case for 0; costing speed but unexercised.
659         Use numLiveObjectsAtLastCollect instead of numAllocationsSinceLastCollect so we don't
660         have to bump it each time we call allocate. Put numLiveObjects into a local variable to
661         cut down on global variable accesses. Make "next" cell pointer be a byte offset rather
662         than a pointer so we don't need a special case for NULL. Allow freeList to point to some
663         bogus item when the entire block is full rather than going out of our way to make it
664         point to NULL.
665         (KJS::Collector::markProtectedObjects): Get table size and pointer into locals outside
666         the loop to avoid re-loading them over and over again.
667         (KJS::Collector::collect): Put numLiveObjects into a local variable to cut down on global
668         variable accesses. Make "next" cell pointer be a byte offset as above. Put numLiveObjects
669         into a local variable to cut down on global variable accesses. Set numLiveObjectsAtLastCollect
670         rather than numAllocationsSinceLastCollect.
671         (KJS::Collector::numReferencedObjects): Get table size and pointer into locals outside
672         the loop to avoid re-loading them over and over again.
673         (KJS::Collector::rootObjectClasses): Ditto.
674
675         * kjs/internal.h: Make Value be a friend of NumberImp so it can construct number objects
676         directly, avoiding the conversion from Number to Value.
677
678         * kjs/internal.cpp: (StringImp::toObject): Don't use Object::dynamicCast, because we know
679         the thing is an object and we don't want to do all the extra work; just cast directly.
680
681         * kjs/list.cpp: (KJS::List::List): Construct valueRefCount in a way that avoids the need for
682         a branch -- in the hot case this just meant avoiding checking a variable we just set to false.
683
684         * kjs/lookup.cpp: (keysMatch): Marked this inline.
685
686         * kjs/nodes.cpp: Disabled KJS_BREAKPOINT, to avoid calling hitStatement all the time.
687         (BooleanNode::evaluate): Make a Value directly, rather than making a Boolean which is converted
688         into a Value.
689         (NumberNode::evaluate): Ditto.
690         (StringNode::evaluate): Ditto.
691         (ArrayNode::evaluate): Ditto.
692         (FunctionCallNode::evaluate): Use new inline baseIfMutable to avoid unnecessary getBase function.
693         Also just use a pointer for func, rather than an Object.
694         (PostfixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
695         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
696         integer and back.
697         (DeleteNode::evaluate): Make a Value directly.
698         (TypeOfNode::evaluate): Use new inline baseIfMutable and make Value directly.
699         (PrefixNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
700         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
701         integer and back.
702         (UnaryPlusNode::evaluate): Make a Value directly.
703         (NegateNode::evaluate): Change code so that it doesn't make an excess Number, and so that it
704         passes a "known to be integer" boolean in, often avoiding a conversion from floating point to
705         integer and back.
706         (BitwiseNotNode::evaluate): Make a Value directly.
707         (LogicalNotNode::evaluate): Ditto.
708         (ShiftNode::evaluate): Don't convert to a double before making a Value.
709         (RelationalNode::evaluate): Make a Value directly.
710         (EqualNode::evaluate): Ditto.
711         (BitOperNode::evaluate): Ditto.
712         (AssignNode::evaluate): Make a Value directly. Change code so that it passes a "known to be integer"
713         boolean in, often avoiding a conversion from floating point to integer and back.
714         (VarDeclNode::evaluate): Make a Value directly.
715         (ForNode::execute): Remove unused local variable.
716
717         * kjs/operations.h:
718         (KJS::isNaN): Inlined.
719         (KJS::isInf): Ditto.
720         (KJS::isPosInf): Ditto.
721         (KJS::isNegInf): Ditto.
722
723         * kjs/operations.cpp: Change isNaN, isInf, isPosInf, and isNegInf to be inlines.
724         (KJS::equal): Rewrite to avoid creating values and recursing back into the function.
725         (KJS::relation): Rearranged code so that we don't need explicit isNaN checks.
726         (KJS::add): Changed code to make Value directly, and so that it passes a "known to be integer"
727         boolean in, often avoiding a conversion from floating point to integer and back.
728         (KJS::mult): Ditto.
729
730         * kjs/property_map.cpp:
731         (KJS::PropertyMap::~PropertyMap): Get size and entries pointer outside loop to avoid
732         re-getting them inside the loop.
733         (KJS::PropertyMap::clear): Ditto. Clear value pointer in addition to key, so we can just
734         look at the value pointer in the mark function.
735         (KJS::PropertyMap::get): Get sizeMask and entries pointer outside loop to avoid
736         re-getting them inside the loop.
737         (KJS::PropertyMap::put): Ditto.
738         (KJS::PropertyMap::insert): Ditto.
739         (KJS::PropertyMap::remove): Ditto.
740         (KJS::PropertyMap::mark): Get size and entries pointer outside loop to avoid
741         re-getting them inside the loop. Don't bother checking key for 0, since we already have
742         to check value for 0. (Also had to change clear() to set value to 0.)
743         (KJS::PropertyMap::addEnumerablesToReferenceList): Get size and entries pointer outside
744         loop to avoid re-getting them inside the loop.
745         (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Ditto.
746         (KJS::PropertyMap::save): Ditto.
747
748         - other changes
749
750         * kjs/protected_values.h: Remove unneeded class name qualifiers.
751
752         * kjs/reference.h:
753         (KJS::Reference::baseIfMutable): New inline function: replaces isMutable().
754         (KJS::Reference::Reference): Inlined.
755         * kjs/reference.cpp:
756         (KJS::Reference::getValue): Rewrite to not use getBase.
757         (KJS::Reference::putValue): Ditto.
758         (KJS::Reference::deleteValue): Dittol
759
760         * kjs/simple_number.h:
761         (KJS::SimpleNumber::integerFits): Added. For use when the parameter is known to be integral.
762
763         * kjs/string_object.cpp: (StringProtoFuncImp::call): Create the number without first converting
764         to double in various cases that involve integers.
765
766         * kjs/ustring.h:
767         (KJS::UString::attach): Inlined.
768         (KJS::UString::release): Inlined.
769         * kjs/ustring.cpp:
770         (KJS::UString::find): Get first character outside the loop instead of re-fetching it each time.
771
772         * kjs/value.cpp:
773         (Value::Value): Added overloads for all the various specific types of values, so you don't have
774         to convert from, say, Number to Value, just to create one.
775         (Number::Number): Added an overload that takes a boolean to indicate the number is already
776         known to be an integer.
777
778         * kjs/value.h: Added more Value constructors, added a version of toNumber that returns
779         a boolean to indicate if the number is known to be an integer (because it was a "simple number").
780         (KJS::ValueImp::marked): Inlined.
781         (KJS::ValueImp::dispatchType): Inlined.
782         (KJS::ValueImp::dispatchToPrimitive): Inlined.
783         (KJS::ValueImp::dispatchToBoolean): Inlined.
784         (KJS::ValueImp::dispatchToNumber): Inlined.
785         (KJS::ValueImp::dispatchToString): Inlined.
786         (KJS::ValueImp::dispatchToUInt32): Inlined.
787
788 2005-04-14  Maciej Stachowiak  <mjs@apple.com>
789
790         - make fast_malloc.h a private header, not project
791
792         * JavaScriptCore.pbproj/project.pbxproj:
793
794 2005-04-12  Maciej Stachowiak  <mjs@apple.com>
795
796         Reviewed by Richard.
797
798         <rdar://problem/4089734> JavaScript iBench can be sped up ~10% with custom allocator
799
800         - use custom single-threaded malloc for all non-GC JavaScriptCore
801         allocations, for a 9.1% speedup on JavaScript iBench
802         
803         * JavaScriptCore.pbproj/project.pbxproj:
804         * kjs/collector.cpp:
805         (KJS::Collector::allocate): Use dlmalloc to allocate the collector blocks.
806         (KJS::Collector::collect): And dlfree to free it.
807         * kjs/fast_malloc.cpp: Added, just the standard dlmalloc here.
808         * kjs/fast_malloc.h: Added. Declarations for the functions. Also added a handy
809         macro to give a class custom operator new/delete
810         * kjs/identifier.cpp:
811         (KJS::Identifier::add): Use dlmalloc/dlfree.
812         * kjs/nodes.h: make nodes KJS_FAST_ALLOCATED.
813         * kjs/property_map.cpp:
814         (KJS::PropertyMap::~PropertyMap): Use dlmalloc/dlfree.
815         (KJS::PropertyMap::rehash): ditto
816         * kjs/scope_chain.h:
817         * kjs/ustring.cpp:
818         (KJS::UString::Rep::createCopying): New named constructor that copies a passed-in
819         buffer, to hide allocation details from webcore.
820         (KJS::UString::UString): use createCopying when appropriate.
821         (KJS::UString::Rep::destroy): Use dlmalloc/dlfree.
822         (KJS::UString::expandedSize): likewise
823         (KJS::UString::expandCapacity): likewise
824         (KJS::UString::expandPreCapacity): likewise
825         (KJS::UString::spliceSubstringsWithSeparators): likewise
826         (KJS::UString::append): likewise
827         (KJS::UString::operator=): likewise
828         (KJS::UString::detach): likewise
829         * kjs/ustring.h: make UString and UString::Rep KJS_FAST_ALLOCATED.
830
831 2005-04-11  Maciej Stachowiak  <mjs@apple.com>
832
833         Reviewed by John.
834
835         <rdar://problem/4086819> Avoid using protect count hash table so much for 5.6% JS iBench speedup
836
837         - Avoid using protected values hash for the two most common cases
838         - Bump up ListImp high water mark, new testing shows 508 ListImps are
839         created during JS iBench.
840
841         Net result is a 5.6% speedup on JavaScript iBench
842         
843         * kjs/collector.cpp:
844         (KJS::Collector::collect): mark protected lists as appropriate.
845         * kjs/context.h:
846         * kjs/list.cpp:
847         (KJS::ListImp::markValues): Moved implementation from List::markValues
848         (KJS::List::markProtectedLists): Implemented - scan pool and overflow
849         list.
850         (KJS::allocateListImp): link lists outside the pool into a separate
851         doubly linked list to be able to mark protected lists
852         (KJS::deallocateListImp): do the corresponding delinking
853         (KJS::List::derefValues): do nothing in conservative GC mode
854         (KJS::List::refValues): do nothing in conservative GC mode
855         (KJS::List::markValues): call ListImp version
856         (KJS::List::append):
857         * kjs/list.h:
858
859 === Safari-412 ===
860
861 === Safari-411 ===
862
863 === Safari-410 ===
864
865 === Safari-409 ===
866
867 === Safari-408 ===
868
869 === Safari-407 ===
870
871 2005-03-16  Jens Alfke  <jens@apple.com>
872
873         Reviewed by Kevin.
874
875         Fix for <rdar://problem/4025212> "REGRESSION (163-164): search not performed correctly; united.com"
876         JavaScript unescape("") was returning a messed-up String object that appeared identical to an empty string, but would in some cases act as 'null' when passed to native functions, in this case the Option() constructor.
877         In the implementation of unescape, the UString holding the result was not initialized to "", so it started out as a null string. If nothing was appended to it, it remained null, resulting in a JavaScript String object with some bad behaviors (namely, converting it to a DOMStringImpl results in a NULL pointer.)
878         Darin says this regression occurred when we replaced our own implementation of unescape() with code from KJS.
879
880         * kjs/function.cpp:
881         (KJS::GlobalFuncImp::call):
882
883 2005-03-15  Richard Williamson   <rjw@apple.com>
884
885         Fixed <rdar://problem/4053276> WebScripting protocol in WebKit cannot convert Boolean in Javascript to BOOL in Objective-C
886
887         Added JavaScript boolean to type that can be converted to
888         ObjC scalar parameters.
889
890         Reviewed by Ken Kocienda.
891
892         * bindings/objc/objc_utility.mm:
893         (KJS::Bindings::convertValueToObjcValue):
894
895 === Safari-406 ===
896
897 === Safari-405 ===
898
899 === Safari-403 ===
900
901 === Safari-402 ===
902
903 === Safari-401 ===
904
905 === Safari-400 ===
906
907 === Safari-188 ===
908
909 2005-02-21  Darin Adler  <darin@apple.com>
910
911         * kjs/date_object.cpp: (timetUsingCF): Fixed indenting.
912
913 2005-02-17  Richard Williamson   <rjw@apple.com>
914
915         Fixed <rdar://problem/4003251> Safari crashed at www.icelandair.com in LiveConnect code converting a Java object to a string
916
917         Added nil check.
918
919         Reviewed by John Sullivan.
920
921         * bindings/jni/jni_runtime.cpp:
922         (JavaField::valueFromInstance):
923
924 === Safari-187 ===
925
926 2005-02-11  Richard Williamson   <rjw@apple.com>
927
928         Fixed <rdar://problem/3985118> DOM objects not being marshaled on JS->native calls
929
930         Re-factored how 'native' wrappers for JS objects are created.  The interpreter now
931         creates these wrappers.  The WebCore subclass of the interpreter now overrides
932         createLanguageInstanceForValue() and creates a DOM ObjC wrapper for DOM objects.
933
934         Reviewed by Ken.
935
936         * bindings/c/c_utility.cpp:
937         (convertValueToNPVariant):
938         * bindings/jni/jni_instance.cpp:
939         (JavaInstance::invokeMethod):
940         * bindings/jni/jni_objc.mm:
941         (KJS::Bindings::dispatchJNICall):
942         * bindings/jni/jni_runtime.cpp:
943         (JavaField::valueFromInstance):
944         (JavaArray::valueAt):
945         * bindings/objc/WebScriptObject.mm:
946         (-[WebScriptObject _setExecutionContext:KJS::Bindings::]):
947         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
948         * bindings/objc/WebScriptObjectPrivate.h:
949         * bindings/objc/objc_utility.h:
950         * bindings/objc/objc_utility.mm:
951         (KJS::Bindings::convertObjcValueToValue):
952         (KJS::Bindings::createObjcInstanceForValue):
953         * bindings/runtime.cpp:
954         (Instance::createBindingForLanguageInstance):
955         (Instance::createRuntimeObject):
956         (Instance::createLanguageInstanceForValue):
957         * bindings/runtime.h:
958         * kjs/interpreter.cpp:
959         (Interpreter::createLanguageInstanceForValue):
960         * kjs/interpreter.h:
961
962 === Safari-186 ===
963
964 2005-02-10  Darin Adler  <darin@apple.com>
965
966         "Reviewed" by Richard (he told me the file was obsolete).
967
968         - got rid of an obsolete file
969
970         * bindings/npsap.h: Removed.
971
972 === Safari-185 ===
973
974 === Safari-183 ===
975
976 2005-02-03  Richard Williamson   <rjw@apple.com>
977
978         Fixed <rdar://problem/3972905> CrashTracer: ...36 crashes at com.apple.WebCore: khtml::CSSStyleSelector::applyDeclarations + 120
979
980         Revert to old (and correct) behavior of returning runtime object
981         when passed as a parameter, rather than it's corresponding DOM
982         object.
983
984         Reviewed by Chris.
985
986         * bindings/objc/WebScriptObject.mm:
987         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
988
989 === Safari-182 ===
990
991 2005-01-28  Richard Williamson   <rjw@apple.com>
992
993         Fixed <rdar://problem/3980389> JavaScript bindings access incorrect runtime object
994
995         Only use special 'back door' property to get the runtime object if thisObj isn't
996         already a runtime object.
997
998         <gratuitous> Cleaned up a couple of strcmp on ClassInfo name.  Used == on
999         ClassInfo pointer instead.
1000
1001         Reviewed by Chris.
1002
1003         * bindings/c/c_utility.cpp:
1004         (convertValueToNPVariant):
1005         * bindings/objc/WebScriptObject.mm:
1006         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1007         * bindings/runtime_method.cpp:
1008         (RuntimeMethodImp::call):
1009
1010 === Safari-181 ===
1011
1012 2005-01-26  Richard Williamson   <rjw@apple.com>
1013
1014         Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test
1015
1016         I added a member variable to ObjectImp.  This changed it's size and consequently
1017         hampered the optimizations built into the garbage collector.  Objects no longer
1018         fit within the allocators cell size, and thus allocation fell back to a slower
1019         allocator.
1020
1021         As a result of this fix I also dramatically cleaned up how runtime objects are
1022         accessed.  The path mostly *removes* code.
1023         
1024         Reviewed by Chris.
1025
1026         * bindings/runtime_method.cpp:
1027         (RuntimeMethodImp::call):
1028         * bindings/runtime_object.cpp:
1029         (RuntimeObjectImp::get):
1030         (RuntimeObjectImp::put):
1031         (RuntimeObjectImp::canPut):
1032         (RuntimeObjectImp::hasProperty):
1033         (RuntimeObjectImp::defaultValue):
1034         * bindings/runtime_object.h:
1035         * kjs/object.cpp:
1036         (KJS::ObjectImp::ObjectImp):
1037         * kjs/object.h:
1038
1039 2005-01-20  Darin Adler  <darin@apple.com>
1040
1041         Reviewed by me, changes by Han Ming Ong.
1042
1043         - <rdar://problem/3964302> SWB: A few files need to be updated to be compilable under GCC 4.0
1044
1045         * bindings/objc/WebScriptObjectPrivate.h: Make members public.
1046         * kjs/lookup.h: Change "value.h" to "object.h" because we need KJS::Object to compile a template.
1047
1048 2005-01-20  Richard Williamson   <rjw@apple.com>
1049
1050         Fixed <rdar://problem/3964634> undefined property value from binding seems to evaluate to true in an if statement
1051
1052         The comprehensive fix for this problem requires new API, as described in 3965326.  However,
1053         given that we can't add new API at this point, the 'ObjcFallbackObjectImp' will behave
1054         like and Undefined object if  invokeUndefinedMethodFromWebScript:withArguments: isn't
1055         implemented on the bound object.
1056
1057         Reviewed by Chris.
1058
1059         * bindings/objc/objc_runtime.h:
1060         * bindings/objc/objc_runtime.mm:
1061         (ObjcFallbackObjectImp::type):
1062         (ObjcFallbackObjectImp::implementsCall):
1063         (ObjcFallbackObjectImp::toBoolean):
1064         * bindings/testbindings.mm:
1065         (+[MyFirstInterface isSelectorExcludedFromWebScript:]):
1066         (+[MyFirstInterface isKeyExcludedFromWebScript:]):
1067
1068 === Safari-180 ===
1069
1070 2005-01-19  Richard Williamson   <rjw@apple.com>
1071
1072         Fixed <rdar://problem/3853676> Browser Crash when accessing CCWeb Progress Page - KJS::Bindings::convertValueToJValue
1073
1074         Fixed the following problems with LiveConnect that are demonstrated by the application
1075         described in 3853676.
1076
1077         1.  If a nil object is passed in an array from Java to JavaScript we will crash.
1078         2.  We sometimes will incorrectly attempt to access a generic JavaScript as a Java runtime object wrapper.
1079         3.  We will sometimes fail to find the correct static method ID.
1080
1081         Reviewed by Maciej.
1082
1083         * bindings/jni/jni_jsobject.cpp:
1084         (JSObject::convertJObjectToValue):
1085         (JSObject::listFromJArray):
1086         * bindings/jni/jni_runtime.cpp:
1087         (JavaField::valueFromInstance):
1088         (JavaField::setValueToInstance):
1089         * bindings/jni/jni_utility.cpp:
1090         (KJS::Bindings::getMethodID):
1091         (KJS::Bindings::convertValueToJValue):
1092         * bindings/runtime_array.h:
1093
1094 2005-01-18  Richard Williamson   <rjw@apple.com>
1095
1096         Fixed several issues all arising from analysis of plugin detection code at ifilm.com:
1097
1098         Fixed <rdar://problem/3958592> can't script plug-ins if plug-in is invoked with <object> element instead of <embed>
1099         Fixed <rdar://problem/3958597> <object> elements with IDs do not show up as named properties of the document
1100         Fixed <rdar://problem/3960973> DOM objects for plugin elements are not accessible
1101         Fixed <rdar://problem/3958601> need an additional class ID in WebCore for the Real plug-in
1102
1103         We now support accessing scriptable plugin objects that are specified with <applet>, <embed>, or <object>
1104         tags.  Also, if any of these elements are named they can be accessed from the document or window objects.
1105         Finally, DOM methods are properties will be forwarded appropriately for the plugin's root scriptable object.
1106
1107         Reviewed by Chris.
1108
1109         * bindings/objc/objc_instance.h:
1110         * bindings/objc/objc_instance.mm:
1111         (ObjcInstance::supportsSetValueOfUndefinedField):
1112         * bindings/runtime.h:
1113         (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
1114         * bindings/runtime_object.cpp:
1115         (RuntimeObjectImp::RuntimeObjectImp):
1116         (RuntimeObjectImp::get):
1117         (RuntimeObjectImp::put):
1118         (RuntimeObjectImp::canPut):
1119         (RuntimeObjectImp::hasProperty):
1120         (RuntimeObjectImp::defaultValue):
1121         * bindings/runtime_object.h:
1122         (KJS::RuntimeObjectImp::fallbackObject):
1123         * kjs/object.cpp:
1124         (KJS::ObjectImp::ObjectImp):
1125         * kjs/object.h:
1126         (KJS::ObjectImp::forwardingScriptMessage):
1127         (KJS::ObjectImp::setForwardingScriptMessage):
1128
1129 2005-01-18  Richard Williamson   <rjw@apple.com>
1130
1131         Back out a change that was incorrectly committed yesterday.
1132
1133         Reviewed by Chris.
1134
1135         * bindings/objc/objc_utility.mm:
1136         (KJS::Bindings::convertValueToObjcValue):
1137
1138 2005-01-17  Richard Williamson   <rjw@apple.com>
1139
1140         Fixed <rdar://problem/3753030> Need to ensure same origin for plugin binding invocations (origin security rules)
1141
1142         Keep track of originating execution context and target execution
1143         context for native JS object wrappers, and perform appropriate
1144         security checks.
1145
1146         Reviewed by David Harrison.
1147
1148         * bindings/NP_jsobject.cpp:
1149         (_isSafeScript):
1150         (_NPN_CreateScriptObject):
1151         (_NPN_Invoke):
1152         (_NPN_Evaluate):
1153         (_NPN_GetProperty):
1154         (_NPN_SetProperty):
1155         (_NPN_RemoveProperty):
1156         (_NPN_HasProperty):
1157         (_NPN_HasMethod):
1158         (_NPN_SetException):
1159         * bindings/NP_jsobject.h:
1160         * bindings/c/c_instance.cpp:
1161         (CInstance::CInstance):
1162         (CInstance::stringValue):
1163         * bindings/c/c_instance.h:
1164         * bindings/c/c_utility.cpp:
1165         (convertValueToNPVariant):
1166         * bindings/jni/jni_instance.cpp:
1167         (JavaInstance::JavaInstance):
1168         (JavaInstance::valueOf):
1169         * bindings/jni/jni_instance.h:
1170         * bindings/objc/WebScriptObject.mm:
1171         (-[WebScriptObject _initializeWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1172         (-[WebScriptObject _initWithObjectImp:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1173         (-[WebScriptObject KJS::Bindings::]):
1174         (-[WebScriptObject _setOriginExecutionContext:KJS::Bindings::]):
1175         (-[WebScriptObject _isSafeScript]):
1176         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1177         (-[WebScriptObject evaluateWebScript:]):
1178         (-[WebScriptObject setValue:forKey:]):
1179         (-[WebScriptObject valueForKey:]):
1180         (-[WebScriptObject removeWebScriptKey:]):
1181         (-[WebScriptObject stringRepresentation]):
1182         (-[WebScriptObject webScriptValueAtIndex:]):
1183         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1184         (+[WebScriptObject _convertValueToObjcValue:KJS::originExecutionContext:Bindings::executionContext:Bindings::]):
1185         * bindings/objc/WebScriptObjectPrivate.h:
1186         * bindings/objc/objc_instance.h:
1187         * bindings/objc/objc_runtime.mm:
1188         (convertValueToObjcObject):
1189         * bindings/objc/objc_utility.mm:
1190         (KJS::Bindings::convertValueToObjcValue):
1191         * bindings/runtime.cpp:
1192         (Instance::Instance):
1193         (Instance::operator=):
1194         * bindings/runtime.h:
1195         (KJS::Bindings::Instance::Instance):
1196         (KJS::Bindings::Instance::setExecutionContext):
1197         (KJS::Bindings::Instance::executionContext):
1198         * bindings/runtime_root.cpp:
1199         (RootObject::setInterpreter):
1200         * bindings/runtime_root.h:
1201         * kjs/interpreter.h:
1202         (KJS::Interpreter::isGlobalObject):
1203         (KJS::Interpreter::interpreterForGlobalObject):
1204         (KJS::Interpreter::isSafeScript):
1205
1206 === Safari-179 ===
1207
1208 2005-01-13  Vicki Murley <vicki@apple.com>
1209
1210         Reviewed by Adele.
1211
1212         - fix <rdar://problem/3946836> Safari about box lists 2004 instead of 2005
1213  
1214         * JavaScriptCore.pbproj/project.pbxproj: bump "2004" to "2005"
1215
1216 2005-01-12  Richard Williamson   <rjw@apple.com>
1217
1218         Avoid additional work on dealloc by adding early out to
1219         removeNativeReference().  (This will save time on dealloc
1220         for all ObjC DOM objects.)
1221
1222         Reviewed by Darin.
1223
1224         * bindings/runtime_root.cpp:
1225         (KJS::Bindings::removeNativeReference):
1226
1227 2005-01-12  Richard Williamson   <rjw@apple.com>
1228
1229         Fixed <rdar://problem/3923356> REGRESSION: Java/JavaScript security checks working incorrectly
1230
1231         We were always returning the first "root" object for all runtime
1232         objects.  Changed 0 in loop to i, the index.
1233
1234         Reviewed by David Harrison.
1235
1236         * bindings/runtime_root.cpp:
1237         (KJS::Bindings::rootForImp):
1238
1239 2005-01-11  Richard Williamson   <rjw@apple.com>
1240
1241         Fixed <rdar://problem/3887930> Must use new Java plug-in API to get/set fields so exception handling works (fixes many LiveConnect crashes)
1242
1243         Use the new dispatching API to invoke JNI, rather than calling JNI
1244         directly.
1245
1246         Reviewed by David Harrison.
1247
1248         * bindings/jni/jni_instance.cpp:
1249         (JavaInstance::invokeMethod):
1250         * bindings/jni/jni_runtime.cpp:
1251         (JavaField::dispatchValueFromInstance):
1252         (JavaField::valueFromInstance):
1253         (JavaField::dispatchSetValueToInstance):
1254         (JavaField::setValueToInstance):
1255         * bindings/jni/jni_runtime.h:
1256         * bindings/jni/jni_utility.cpp:
1257         (KJS::Bindings::convertValueToJValue):
1258
1259 === Safari-178 ===
1260
1261 === Safari-177 ===
1262
1263 === Safari-176 ===
1264
1265 2004-12-17  Maciej Stachowiak  <mjs@apple.com>
1266
1267         Reviewed by Kevin.
1268
1269         <rdar://problem/3926869> Opening caches window after running PLT causes crash
1270         
1271         * kjs/protected_values.cpp:
1272         (KJS::ProtectedValues::getProtectCount): Don't include simple numbers in
1273         the protected value table.
1274         (KJS::ProtectedValues::increaseProtectCount): Ditto.
1275         (KJS::ProtectedValues::decreaseProtectCount): Ditto.
1276
1277 2004-12-16  Darin Adler  <darin@apple.com>
1278
1279         Reviewed by Maciej.
1280
1281         - fixed <rdar://problem/3920764> Unimplemented String methods toLocaleLowerCase and toLocaleUpperCase
1282
1283         * kjs/string_object.h: Added toLocaleLowerCase and toLocaleUpperCase.
1284         * kjs/string_object.cpp: (StringProtoFuncImp::call): Made locale versions be synonmyms for the
1285         non-locale-specific versions.
1286         * kjs/string_object.lut.h: Regenerated.
1287
1288 2004-12-14  Richard Williamson   <rjw@apple.com>
1289
1290         Pass URL of plugin view when call into JNI.
1291
1292         Reviewed by Chris.
1293
1294         * bindings/jni/jni_objc.mm:
1295         (KJS::Bindings::dispatchJNICall):
1296
1297 2004-12-13  Richard Williamson   <rjw@apple.com>
1298
1299         Fixed <rdar://problem/3827799> repro. crash with IBM Rational ClearCase Web under Safari (Java/LiveConnect-related)
1300
1301         Add support for calling static Java methods from JavaScript.
1302
1303         Reviewed by Maciej.
1304
1305         * bindings/jni/jni_instance.cpp:
1306         (JavaInstance::invokeMethod):
1307         * bindings/jni/jni_runtime.cpp:
1308         (JavaMethod::JavaMethod):
1309         * bindings/jni/jni_runtime.h:
1310         (KJS::Bindings::JavaMethod::isStatic):
1311         * bindings/jni/jni_utility.cpp:
1312         (callJNIStaticMethod):
1313         (KJS::Bindings::callJNIBooleanMethod):
1314         (KJS::Bindings::callJNIStaticBooleanMethod):
1315         * bindings/jni/jni_utility.h:
1316
1317 2004-12-13  Richard Williamson   <rjw@apple.com>
1318
1319         Fixed <rdar://problem/3887767> LiveConnect doesn't propagate Java exceptions back to JavaScript (prevents security suite from running)
1320
1321         Reviewed by John.
1322
1323         * bindings/jni/jni_instance.cpp:
1324         (JavaInstance::invokeMethod):
1325         * bindings/jni/jni_objc.mm:
1326         (KJS::Bindings::dispatchJNICall):
1327         * bindings/jni/jni_runtime.h:
1328         * bindings/jni/jni_utility.h:
1329
1330 === Safari-175 ===
1331
1332 2004-12-07  Maciej Stachowiak  <mjs@apple.com>
1333
1334         Reviewed by Darin.
1335
1336         <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
1337
1338         The fix was to implement copy constructor and assignment operator,
1339         the ones that worked on the base class did not replace the
1340         defaults apparently!
1341         
1342         * kjs/protect.h:
1343         (KJS::ProtectedValue::ProtectedValue):
1344         (KJS::ProtectedValue::operator=):
1345         (KJS::ProtectedObject::ProtectedObject):
1346         (KJS::ProtectedObject::operator=):
1347         
1348         Also fixed a bug in the GC test mode that compares the results of
1349         the old collector and the new collector.
1350
1351         * kjs/value.cpp:
1352         (ValueImp::mark):
1353
1354 === Safari-173 ===
1355
1356 2004-11-23  Richard Williamson   <rjw@apple.com>
1357
1358         Fixed <rdar://problem/3890385> field and method cache incorrectly capped (c bindings)
1359
1360         Reviewed by Ken.
1361
1362         * bindings/c/c_class.cpp:
1363         (CClass::_commonInit):
1364
1365 2004-11-21  Maciej Stachowiak  <mjs@apple.com>
1366
1367         Reviewed by Ken.
1368
1369         <rdar://problem/3889696> Enable conservative garbage collection for JavaScript
1370         
1371         * kjs/collector.cpp:
1372         (KJS::Collector::Thread::Thread):
1373         (KJS::destroyRegisteredThread):
1374         (KJS::initializeRegisteredThreadKey):
1375         (KJS::Collector::registerThread):
1376         (KJS::Collector::markStackObjectsConservatively):
1377         (KJS::Collector::markCurrentThreadConservatively):
1378         (KJS::Collector::markOtherThreadConservatively):
1379         * kjs/collector.h:
1380         * kjs/internal.cpp:
1381         (lockInterpreter):
1382         * kjs/value.h:
1383
1384 === Safari-172 ===
1385
1386 2004-11-15  Richard Williamson   <rjw@apple.com>
1387
1388         Fixed <rdar://problem/3880561> Default string value of ObjC object in JS should be [obj description].
1389
1390         Reviewed by Hyatt.
1391
1392         * bindings/objc/objc_instance.mm:
1393         (ObjcInstance::stringValue):
1394         * bindings/objc/objc_utility.h:
1395         * bindings/objc/objc_utility.mm:
1396         (KJS::Bindings::convertNSStringToString):
1397         (KJS::Bindings::convertObjcValueToValue):
1398
1399 === Safari-171 ===
1400
1401 2004-11-09  Chris Blumenberg  <cblu@apple.com>
1402
1403         Fixed: <rdar://problem/3872724> soft link against JavaVM to save ~2MB RSHRD
1404
1405         Reviewed by rjw.
1406
1407         * ChangeLog:
1408         * JavaScriptCore.pbproj/project.pbxproj: don't link against JavaVM
1409         * bindings/softlinking.c: Added.
1410         (loadFramework): new
1411         (getFunctionPointer): new
1412         (JNI_GetCreatedJavaVMs): load JavaVM if not already loaded, get _JNI_GetCreatedJavaVMs symbol if we don't already have it, call JNI_GetCreatedJavaVMs
1413
1414 === Safari-170 ===
1415
1416 2004-11-04  Darin Adler  <darin@apple.com>
1417
1418         Reviewed by Ken.
1419
1420         - fixed <rdar://problem/3865365> since -[WebScriptObject dealloc] does not call [super dealloc], the build will fail due to a warning
1421         - fixed behavior so that [[WebScriptObject alloc] initWithCoder:] doesn't leak WebUndefined instances
1422           and incidentally so that [[WebScriptObject alloc] init] returns the single shared instance rather
1423           than allocating a new one
1424
1425         * bindings/objc/WebScriptObject.mm: Removed some stray semicolons.
1426         (+[WebUndefined allocWithZone:]): Made this the common bottleneck that returns the single instance
1427         of WebUndefined, since it's the single method that normally allocates new instances. Calls super to
1428         actually allocate only the very first time it's called.
1429         (-[WebUndefined initWithCoder:]): Simplified to just return self (no reason to re-lookup the single
1430         shared instance since there can be only one).
1431         (-[WebUndefined copyWithZone:]): Ditto.
1432         (-[WebUndefined retain]): Ditto.
1433         (-[WebUndefined retainCount]): Use UINT_MAX constant here (matches usage in NSObject.m for retain count
1434         of class).
1435         (-[WebUndefined autorelease]): Simplified to just return self (see above).
1436         (-[WebUndefined copy]): No need to override this since it just turns around and calls copyWithZone:.
1437         (-[WebUndefined dealloc]): Added an assertion since this method should never be called. Also added
1438         a call to [super dealloc] after return; to make the new -Wdealloc-check compiler happy (fixing the
1439         bug mentioned above).
1440         (+[WebUndefined undefined]): Reimplemented; calls allocWithZone:NULL to get to the shared instance.
1441         No need to call init, since that's a no-op for this class.
1442
1443 2004-11-03  David Harrison  <harrison@apple.com>
1444
1445         Reviewed by Darin.
1446         
1447         Eliminate the use of a marker file to determine how to build.
1448
1449         * .cvsignore:
1450         * Makefile.am:
1451
1452 2004-11-01  Richard Williamson   <rjw@apple.com>
1453
1454         Fixed <rdar://problem/3861469> Latest Real player crashes Safari on some sites.
1455
1456         Reviewed by Ken.
1457
1458         * bindings/c/c_instance.cpp:
1459         (CInstance::invokeMethod):
1460         (CInstance::invokeDefaultMethod):
1461         Initialize out parameters to void type.
1462
1463         * bindings/c/c_runtime.cpp:
1464         (CField::valueFromInstance):
1465         (CField::setValueToInstance):
1466         Initialize out parameters to void type.
1467         Also added additional checks to protect against classes that 
1468         don't implement all functions.
1469
1470 2004-11-01  Richard Williamson   <rjw@apple.com>
1471
1472         Fixed <rdar://problem/3861257> WebUndefined should be returned for undefined values
1473
1474         Reviewed by John.
1475
1476         * ChangeLog:
1477         * bindings/objc/WebScriptObject.mm:
1478         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
1479         Added additional conversion Undefined -> WebUndefined.
1480         * bindings/objc/objc_utility.mm:
1481         (KJS::Bindings::convertObjcValueToValue):
1482         Added additional conversion WebUndefined -> Undefined.
1483
1484 2004-11-01  Darin Adler  <darin@apple.com>
1485
1486         - fixed <rdar://problem/3855573> Remove reference to "WebScriptMethods" from WebScriptObject.h comments
1487
1488         * bindings/objc/WebScriptObject.h: Removed unneeded #ifdef protection for multiple includes (since
1489         this is an Objective-C header and we use #import for those). Fixed comments as requested in the bug
1490         report to match the contents of the file.
1491
1492 === Safari-169 ===
1493
1494 === Safari-168 ===
1495
1496 2004-10-22  Ken Kocienda  <kocienda@apple.com>
1497
1498         Reviewed by me
1499
1500         * JavaScriptCore.pbproj/project.pbxproj:  
1501         Add GCC_ENABLE_OBJC_GC and GCC_FAST_OBJC_DISPATCH flags.
1502
1503 === Safari-167 ===
1504
1505 2004-10-13  Richard Williamson   <rjw@apple.com>
1506
1507         Moved boolean checks prior to NSNumber checks.  booleans are
1508         NSNumbers.
1509
1510         Follow on to <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number.
1511
1512         Reviewed by John.
1513
1514         * bindings/objc/objc_utility.mm:
1515         (KJS::Bindings::convertObjcValueToValue):
1516
1517 2004-10-12  Richard Williamson   <rjw@apple.com>
1518
1519         Fixed access to DOM object via WebScriptObject API.
1520         The execution context for DOM objects wasn't being found.       
1521         <rdar://problem/3831372> The valueForKey method for @"offsetLeft" on a paragraph element causes a crash.
1522
1523         Reviewed by Chris.
1524
1525         * bindings/objc/WebScriptObject.mm:
1526         (_didExecute):
1527         (-[WebScriptObject KJS::Bindings::]):
1528         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1529         (-[WebScriptObject evaluateWebScript:]):
1530         (-[WebScriptObject setValue:forKey:]):
1531         (-[WebScriptObject valueForKey:]):
1532         (-[WebScriptObject stringRepresentation]):
1533         * bindings/objc/WebScriptObjectPrivate.h:
1534
1535 2004-10-09  Darin Adler  <darin@apple.com>
1536
1537         Reviewed by Kevin.
1538
1539         - fixed <rdar://problem/3804661> REGRESSION: JavaScriptCore framework now has two init routines
1540
1541         * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was
1542         creating an init routine.
1543
1544         * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not
1545         require a global constructor that creates an init routine.
1546
1547 2004-10-09  Darin Adler  <darin@apple.com>
1548
1549         Reviewed by Kevin.
1550
1551         - fixed <rdar://problem/3822618> REGRESSION (164-165): expedia.com's popup help doesn't work
1552
1553         * kjs/reference.cpp: (Reference::putValue): Change so that references not found in any object
1554         work with the window object of the page the function is in, not the page of the caller. This
1555         is what all other browsers do. This code was hidden before by the "everything is defined on
1556         window object" hack in WebCore.
1557
1558 2004-10-07  Richard Williamson   <rjw@apple.com>
1559
1560         Added simple JavaScript call tracing.  Very useful for
1561         debugging complex pages.
1562
1563         Tracing is only available in development builds and is
1564         enabled by:
1565
1566         (gdb) set traceJavaScript = 1
1567
1568         or programatically
1569
1570         setTraceJavaScript(true)
1571
1572         Function, args, and return values are printed to console.  Very
1573         verbose.
1574
1575         Reviewed by Ken.
1576
1577         * kjs/function_object.cpp:
1578         (FunctionProtoFuncImp::call):
1579         * kjs/object.cpp:
1580         (KJS::Object::call):
1581
1582 === Safari-166 ===
1583
1584 2004-10-05  Richard Williamson   <rjw@apple.com>
1585
1586         Fixed <rdar://problem/3819234> NPN_SetException (and throwException:) isn't implemented
1587
1588         Reviewed by Chris.
1589
1590         * bindings/NP_jsobject.cpp:
1591         (_NPN_SetException):
1592         * bindings/npruntime.cpp:
1593         (_NPN_SetExceptionWithUTF8):
1594         * bindings/objc/WebScriptObject.mm:
1595         (+[WebScriptObject throwException:]):
1596         * kjs/internal.h:
1597         (KJS::InterpreterImp::context):
1598
1599 2004-10-05  Richard Williamson   <rjw@apple.com>
1600
1601         Fixed <rdar://problem/3821515> binding layer needs to convert NSNumber-bools to js type boolean not number
1602
1603         Reviewed by Ken.
1604
1605         * bindings/objc/objc_utility.mm:
1606         (KJS::Bindings::convertObjcValueToValue):
1607
1608 2004-10-04  Darin Adler  <darin@apple.com>
1609
1610         Reviewed by Ken.
1611
1612         - rolled in a fix the KDE folks did for the operations that generate HTML fragments
1613
1614         * kjs/string_object.cpp: (StringProtoFuncImp::call): Added quote marks to generated HTML.
1615
1616         - rolled out an old workaround we don't need any more
1617
1618         * JavaScriptCore.pbproj/project.pbxproj: Remove -Wno-long-double because the <math.h> issue that
1619         required it is no longer there.
1620
1621 2004-09-30  Richard Williamson  <rjw@apple.com>
1622
1623         Fixed <rdar://problem/3821215> NPN hasMethod and hasProperty functions should take NPObjects, not NPClass
1624
1625         Reviewed by Chris.
1626
1627         * bindings/NP_jsobject.cpp:
1628         (_NPN_GetProperty):
1629         (_NPN_HasProperty):
1630         (_NPN_HasMethod):
1631         * bindings/c/c_class.cpp:
1632         (CClass::methodsNamed):
1633         (CClass::fieldNamed):
1634         * bindings/c/c_class.h:
1635         * bindings/c/c_instance.cpp:
1636         (CInstance::invokeMethod):
1637         * bindings/jni/jni_class.cpp:
1638         (JavaClass::methodsNamed):
1639         * bindings/jni/jni_class.h:
1640         * bindings/npruntime.h:
1641         * bindings/objc/objc_class.h:
1642         * bindings/objc/objc_class.mm:
1643         (ObjcClass::methodsNamed):
1644         * bindings/runtime.h:
1645         * bindings/runtime_object.cpp:
1646         (RuntimeObjectImp::get):
1647         (RuntimeObjectImp::hasProperty):
1648
1649 2004-09-29  Chris Blumenberg  <cblu@apple.com>
1650
1651         Prepended underscores to NPN methods so that when the QT plug-in loads these symbols, it uses the non-underscore versions in WebKit. Without this, the QT plug-in was failing to load when launching Safari from the command-line.
1652
1653         Reviewed by rjw.
1654
1655         * JavaScriptCore.pbproj/project.pbxproj:
1656         * bindings/NP_jsobject.cpp:
1657         (_NPN_CreateScriptObject):
1658         (_NPN_InvokeDefault):
1659         (_NPN_Invoke):
1660         (_NPN_Evaluate):
1661         (_NPN_GetProperty):
1662         (_NPN_SetProperty):
1663         (_NPN_RemoveProperty):
1664         (_NPN_HasProperty):
1665         (_NPN_HasMethod):
1666         * bindings/c/c_class.cpp:
1667         (CClass::methodsNamed):
1668         (CClass::fieldNamed):
1669         * bindings/c/c_instance.cpp:
1670         (CInstance::CInstance):
1671         (CInstance::~CInstance):
1672         (CInstance::operator=):
1673         (CInstance::invokeMethod):
1674         (CInstance::invokeDefaultMethod):
1675         * bindings/c/c_runtime.cpp:
1676         * bindings/c/c_runtime.h:
1677         (KJS::Bindings::CField::name):
1678         (KJS::Bindings::CMethod::name):
1679         * bindings/npruntime.cpp:
1680         (_NPN_GetStringIdentifier):
1681         (_NPN_GetStringIdentifiers):
1682         (_NPN_GetIntIdentifier):
1683         (_NPN_IdentifierIsString):
1684         (_NPN_UTF8FromIdentifier):
1685         (_NPN_IntFromIdentifier):
1686         (NPN_InitializeVariantWithObject):
1687         (_NPN_ReleaseVariantValue):
1688         (_NPN_CreateObject):
1689         (_NPN_RetainObject):
1690         (_NPN_ReleaseObject):
1691         (_NPN_SetExceptionWithUTF8):
1692         (_NPN_SetException):
1693
1694 2004-09-26  Darin Adler  <darin@apple.com>
1695
1696         * kjs/string_object.cpp: (StringProtoFuncImp::call): Remove strange use of high() and
1697         low() to get Unicode value of character, and just use unicode().
1698
1699 2004-09-26  Darin Adler  <darin@apple.com>
1700
1701         - refine charAt/charCodeAt fix slightly
1702
1703         * kjs/string_object.cpp: (StringProtoFuncImp::call): Treat undefined the same was as an
1704         omitted parameter, as we do everywhere else, and as other browsers do here.
1705
1706 2004-09-26  Darin Adler  <darin@apple.com>
1707
1708         Reviewed by Kevin.
1709
1710         - fixed <rdar://problem/3816097> REGRESSION: mailblocks, and presumably many other pages, failing because variable not found
1711
1712         * kjs/internal.cpp: (InterpreterImp::evaluate): Process variable declarations before executing
1713         the program. We were doing this properly for functions, but not entire programs.
1714
1715         - fixed <rdar://problem/3814706> REGRESSION: text fields in mailblocks wizards do not accept keystrokes due to use of charCodeAt()
1716
1717         * kjs/string_object.cpp: (StringProtoFuncImp::call): Changed the implementation of charAt
1718         and charCodeAt to treat a missing parameter as an index of 0, rather than an invalid index.
1719
1720         * tests/mozilla/expected.html: Update for two tests that now pass with these changes.
1721
1722 === Safari-165 ===
1723
1724 === Safari-164 ===
1725
1726 2004-09-14  Richard Williamson   <rjw@apple.com>
1727
1728         1.  Add class parameter to object allocation function.  This is somewhat redundant, given that
1729         the allocation function is in the class function vector, but people wanted to use the same
1730         allocation function for different classes.
1731         
1732         2.  Renamed NPN_Class to NPN_Invoke to match the name in the function vector.
1733         
1734         3.  Add support for a default function on an object.  This is a feature that ActiveX supports,
1735         and will allow JavaScript code to be written that will look exactly the same for both ActiveX
1736         plugins and Netscape or WebKit plugins.  There are implementations included for the 'C' and
1737         'Objective-C' bindings.
1738         
1739         There bugs are covered by
1740         
1741         <rdar://problem/3776343> Support for default functions in the JavaScript bindings
1742         <rdar://problem/3779186> NPN_Call needs to be renamed to NPN_Invoke
1743         <rdar://problem/3674754> Need to implement latest npruntime.h
1744
1745         Reviewed by John.
1746
1747         * bindings/NP_jsobject.cpp:
1748         (jsAllocate):
1749         (NPN_InvokeDefault):
1750         (NPN_Invoke):
1751         * bindings/c/c_class.cpp:
1752         * bindings/c/c_instance.cpp:
1753         (CInstance::CInstance):
1754         (CInstance::operator=):
1755         (CInstance::invokeMethod):
1756         (CInstance::invokeDefaultMethod):
1757         * bindings/c/c_instance.h:
1758         * bindings/c/c_runtime.cpp:
1759         * bindings/c/c_runtime.h:
1760         * bindings/jni/jni_instance.cpp:
1761         (JavaInstance::invokeDefaultMethod):
1762         * bindings/jni/jni_instance.h:
1763         * bindings/npruntime.cpp:
1764         (NPN_CreateObject):
1765         * bindings/npruntime.h:
1766         * bindings/objc/WebScriptObject.h:
1767         * bindings/objc/objc_class.mm:
1768         (ObjcClass::fallbackObject):
1769         * bindings/objc/objc_instance.h:
1770         * bindings/objc/objc_instance.mm:
1771         (ObjcInstance::invokeDefaultMethod):
1772         * bindings/objc/objc_runtime.h:
1773         * bindings/objc/objc_runtime.mm:
1774         (ObjcFallbackObjectImp::ObjcFallbackObjectImp):
1775         (ObjcFallbackObjectImp::get):
1776         (ObjcFallbackObjectImp::put):
1777         (ObjcFallbackObjectImp::canPut):
1778         (ObjcFallbackObjectImp::implementsCall):
1779         (ObjcFallbackObjectImp::call):
1780         (ObjcFallbackObjectImp::hasProperty):
1781         (ObjcFallbackObjectImp::deleteProperty):
1782         (ObjcFallbackObjectImp::defaultValue):
1783         * bindings/runtime.h:
1784         (KJS::Bindings::Class::fallbackObject):
1785         (KJS::Bindings::Instance::getValueOfUndefinedField):
1786         (KJS::Bindings::Instance::setValueOfUndefinedField):
1787         (KJS::Bindings::Instance::valueOf):
1788         * bindings/runtime_object.cpp:
1789         (RuntimeObjectImp::implementsCall):
1790         (RuntimeObjectImp::call):
1791         * bindings/runtime_object.h:
1792
1793 2004-09-13  Maciej Stachowiak  <mjs@apple.com>
1794
1795         Reviewed by Darin.
1796
1797         <rdar://problem/3794735> Gmail- sending a very long message with Safari is so slow it seems like a hang
1798         
1799         * kjs/string_object.cpp:
1800         (StringProtoFuncImp::call): Replaced implementation of replace()
1801         method with function below...
1802         (replace): In order to avoid excessive allocation and copying,
1803         figure out the ranges of the original string and replacement
1804         strings to be assembled, instead of constantly creating new
1805         strings at each substitution. The old behavior is basically O(N^2)
1806         for a global replace on a pattern that matches many places in the
1807         string.
1808         (regExpIsGlobal): Helper function for the above.
1809         (expandSourceRanges): ditto
1810         (pushSourceRange): ditto
1811         (expandReplacements): ditto
1812         (pushReplacement): ditto
1813         * kjs/ustring.cpp:
1814         (KJS::UString::spliceSubstringsWithSeparators): New method that
1815         pieces together substring ranges of this string together with
1816         specified separators, all at one go.
1817         * kjs/ustring.h:
1818         (KJS::UString::Range::Range): Added new helper class to represent
1819         substring choices.
1820
1821 2004-09-14  Maciej Stachowiak  <mjs@apple.com>
1822
1823         Reviewed by Darin.
1824
1825         - fixed <rdar://problem/3800315> encode-URI-test layout test is failing
1826         
1827         * kjs/function.cpp:
1828         (KJS::GlobalFuncImp::call): Make sure to escape null
1829         characters. This is a bug in the new code that made part of the
1830         test fail.
1831
1832 2004-09-13  Darin Adler  <darin@apple.com>
1833
1834         Reviewed by Kevin and Maciej.
1835
1836         - new function to support fix for DIG bug in WebCore
1837
1838         * kjs/scope_chain.h: Added new push function that pushes another entire scope chain.
1839         * kjs/scope_chain.cpp: (KJS::ScopeChain::push): Ditto.
1840
1841 2004-09-12  Darin Adler  <darin@apple.com>
1842
1843         * tests/mozilla/expected.html: Updated test results for 3 more tests that pass with the new version
1844         of escape and unescape.
1845
1846 2004-09-12  Darin Adler  <darin@apple.com>
1847
1848         Reviewed by Maciej.
1849
1850         - fixed <rdar://problem/3798209> any non-ASCII characters are garbled in the result of toLocaleString
1851
1852         * kjs/date_object.cpp:
1853         (formatLocaleDate): Replaced two old functions that used LongDateTime with this one new function that
1854         uses CFDateFormatter.
1855         (DateProtoFuncImp::call): Call the new formatLocaleDate instead of both formatLocaleDate and formatLocaleTime.
1856
1857 2004-09-09  Maciej Stachowiak  <mjs@apple.com>
1858
1859         Reviewed by Richard.
1860
1861         <rdar://problem/3493140> REGRESSION (85-100): cedille displays %-escaped in JavaScript message at hotmail.com
1862
1863         * kjs/function.cpp:
1864         (KJS::GlobalFuncImp::call): Replace our escape() and unescape() implementations with
1865         ones from KDE KJS, which have the proper latin-1 behavior to match Win IE.
1866         * kjs/lexer.cpp:
1867         (Lexer::isHexDigit): Made static and non-const.
1868         * kjs/lexer.h:
1869
1870 === Safari-163 ===
1871
1872 2004-09-06  Darin Adler  <darin@apple.com>
1873
1874         * JavaScriptCore.pbproj/project.pbxproj: Bump MACOSX_DEPLOYMENT_TARGET to 10.3.
1875
1876 === Safari-162 ===
1877
1878 2004-09-01  Richard Williamson   <rjw@apple.com>
1879
1880         Add pid to exception messages (to help debug dashboard clients).
1881
1882         Reviewed by Chris.
1883
1884         * kjs/interpreter.cpp:
1885         (Interpreter::evaluate):
1886
1887 === Safari-161 ===
1888
1889 2004-08-20  Richard Williamson   <rjw@apple.com>
1890
1891         Implemented new JNI abstraction.  We no longer invoke Java methods
1892         directly with JNI, rather we call into the plugin.  This allows the
1893         plugin to dispatch the call to the appropriate VM thread.  This
1894         change should (will?) fix a whole class of threading related problems with
1895         the Java VM.
1896
1897         Reviewed by Hyatt.
1898
1899         * JavaScriptCore.pbproj/project.pbxproj:
1900         * bindings/c/c_instance.h:
1901         (KJS::Bindings::CInstance::setExecutionContext):
1902         (KJS::Bindings::CInstance::executionContext):
1903         * bindings/jni/jni_instance.cpp:
1904         (JavaInstance::JavaInstance):
1905         (JavaInstance::invokeMethod):
1906         (JavaInstance::setExecutionContext):
1907         (JavaInstance::executionContext):
1908         * bindings/jni/jni_instance.h:
1909         * bindings/jni/jni_jsobject.cpp:
1910         (JSObject::convertJObjectToValue):
1911         * bindings/jni/jni_runtime.cpp:
1912         (JavaField::JavaField):
1913         (JavaArray::convertJObjectToArray):
1914         (JavaField::valueFromInstance):
1915         (JavaArray::JavaArray):
1916         (JavaArray::valueAt):
1917         * bindings/jni/jni_runtime.h:
1918         (KJS::Bindings::JavaArray::operator=):
1919         (KJS::Bindings::JavaArray::executionContext):
1920         * bindings/jni/jni_utility.h:
1921         * bindings/objc/objc_instance.h:
1922         (KJS::Bindings::ObjcInstance::setExecutionContext):
1923         (KJS::Bindings::ObjcInstance::executionContext):
1924         * bindings/runtime.cpp:
1925         (Instance::createBindingForLanguageInstance):
1926         * bindings/runtime.h:
1927         * bindings/runtime_root.h:
1928         (KJS::Bindings::RootObject::nativeHandle):
1929
1930 === Safari-158 ===
1931
1932 2004-08-19  Vicki Murley  <vicki@apple.com>
1933
1934         Reviewed by John.
1935
1936         * kjs/property_map.cpp:
1937         (KJS::PropertyMap::put): initialize deletedElementIndex to zero, to make the compiler happy
1938
1939 2004-08-17  Darin Adler  <darin@apple.com>
1940
1941         Reviewed by Adele.
1942
1943         - fixed <rdar://problem/3746676> SAP WebDynpro app hangs inside JavaScript property map hash table code (deleted sentinel problem)
1944
1945         * kjs/property_map.h: Added some private functions.
1946         * kjs/property_map.cpp:
1947         (KJS::PropertyMap::clear): Set sentinelCount to 0.
1948         (KJS::PropertyMap::put): Complete search for the element before choosing to use the deleted-element sentinel.
1949         Also keep sentinel count up to date when we destroy a sentinel by overwriting with a new added element.
1950         (KJS::PropertyMap::expand): Added. Calls rehash with a size 2x the old size, or 16.
1951         (KJS::PropertyMap::rehash): Added. Refactored the rehash code into a separate function.
1952         (KJS::PropertyMap::remove): Add one to sentinelCount, and rehash if 1/4 or more of the elements are
1953         deleted-element sentinels.
1954         (KJS::PropertyMap::checkConsistency): Check the sentinelCount.
1955
1956 2004-08-16  Maciej Stachowiak  <mjs@apple.com>
1957
1958         Code change by Eric Albert, reviewd by me.
1959
1960         <rdar://problem/3571960> washingtonpost.com claims I don't have cookies enabled and won't let me read articles
1961
1962         * kjs/date_object.cpp:
1963         (timetUsingCF): Clamp time to LONG_MAX (getting rid of time_t
1964         entirely would be even better, but is not required to fix this bug.
1965
1966 === Safari-157 ===
1967
1968 2004-08-16  Richard Williamson   <rjw@apple.com>
1969
1970         Fixed <rdar://problem/3581092> cash in KJS::Bindings::JSObject::eval at tcvetantcvetkov.com
1971
1972         Adds bullet proofing to protect against evaluation of bogus JS in all the flavors of bindings (Java, C, and ObjC).
1973
1974         Reviewed by Chris.
1975
1976         * bindings/NP_jsobject.cpp:
1977         (NPN_Evaluate):
1978         * bindings/jni/jni_jsobject.cpp:
1979         (JSObject::eval):
1980         * bindings/objc/WebScriptObject.mm:
1981         (-[WebScriptObject evaluateWebScript:]):
1982
1983 2004-08-15  Richard Williamson   <rjw@apple.com>
1984
1985         More updates to np headers.  Implemented new NPN functions.
1986
1987         Reviewed by Darin.
1988
1989         * bindings/NP_jsobject.cpp:
1990         (NPN_HasProperty):
1991         (NPN_HasMethod):
1992         * bindings/npapi.h:
1993         * bindings/npruntime.h:
1994
1995 2004-08-13  Darin Adler  <darin@apple.com>
1996
1997         - fix build so we can compile again
1998
1999         * bindings/npapi.h: Added. Richard forgot to check this in. The one I'm checking in here
2000         is good enough so that we can compile, but it's only a stopgap measure, because I think
2001         Richard has a newer one he wants to check in.
2002
2003 2004-08-12  Richard Williamson   <rjw@apple.com>
2004
2005         Bring npruntime.h and friends closer to compliance with
2006         latest spec.
2007
2008         Reviewed by Maciej.
2009
2010         * JavaScriptCore.pbproj/project.pbxproj:
2011         * bindings/NP_jsobject.cpp:
2012         (jsAllocate):
2013         (_NPN_CreateScriptObject):
2014         (NPN_Call):
2015         (NPN_Evaluate):
2016         (NPN_GetProperty):
2017         (NPN_SetProperty):
2018         (NPN_RemoveProperty):
2019         * bindings/NP_jsobject.h:
2020         * bindings/c/c_instance.cpp:
2021         (CInstance::invokeMethod):
2022         * bindings/c/c_utility.cpp:
2023         (convertNPVariantToValue):
2024         * bindings/npruntime.cpp:
2025         (NPN_IdentifierIsString):
2026         (NPN_VariantIsVoid):
2027         (NPN_VariantIsNull):
2028         (NPN_VariantIsUndefined):
2029         (NPN_VariantIsBool):
2030         (NPN_VariantIsInt32):
2031         (NPN_VariantIsDouble):
2032         (NPN_VariantIsString):
2033         (NPN_VariantIsObject):
2034         (NPN_VariantToBool):
2035         (NPN_VariantToString):
2036         (NPN_VariantToInt32):
2037         (NPN_VariantToDouble):
2038         (NPN_VariantToObject):
2039         (NPN_InitializeVariantAsVoid):
2040         (NPN_InitializeVariantAsNull):
2041         (NPN_InitializeVariantAsUndefined):
2042         (NPN_InitializeVariantWithBool):
2043         (NPN_InitializeVariantWithInt32):
2044         (NPN_InitializeVariantWithDouble):
2045         (NPN_InitializeVariantWithString):
2046         (NPN_InitializeVariantWithStringCopy):
2047         (NPN_InitializeVariantWithObject):
2048         (NPN_InitializeVariantWithVariant):
2049         (NPN_ReleaseVariantValue):
2050         (NPN_CreateObject):
2051         * bindings/npruntime.h:
2052         (_NPString::):
2053         (_NPString::_NPVariant::):
2054         * bindings/npruntime_priv.h: Added.
2055
2056 2004-08-12  Darin Adler  <darin@apple.com>
2057
2058         Reviewed by Adele.
2059
2060         - fixed 3 problems with parse functions that I just wrote, fixing 3 more Mozilla JavaScript tests
2061
2062         * kjs/function.cpp:
2063         (KJS::parseDigit): Fix typo, 'Z' instead of 'z', that prevented lowercase hex digits from working.
2064         (KJS::parseInt): Add octal support. Specification says it's optional, but I guess not.
2065         (KJS::parseFloat): Fix check for "0x" in parseFloat to return 0 rather than NaN. Also add code
2066         to skip leading "+" or "-".
2067
2068 === Safari-156 ===
2069
2070 2004-08-12  Darin Adler  <darin@apple.com>
2071
2072         Reviewed by Ken.
2073
2074         - fixed 43 Mozilla JavaScript tests
2075
2076         * kjs/date_object.h: Change parseDate and timeClip to take and return doubles.
2077         * kjs/date_object.cpp:
2078         (DateObjectImp::construct): Change to use a timeClip function that takes and returns a double rather
2079         than constructing a number object to pass to it.
2080         (DateObjectFuncImp::call): Change to use a parseDate function that returns a double.
2081         (KJS::parseDate): Change to return a double instead of creating the Number object here.
2082         (KJS::timeClip): Implement this as specified in the language standard.
2083
2084         * kjs/error_object.cpp: (NativeErrorImp::NativeErrorImp): Set the DontDelete, ReadOnly, and DontEnum
2085         flags on the prototype property.
2086
2087         * kjs/function.cpp:
2088         (KJS::FunctionImp::get): Return null rather than undefined for arguments when the function is not
2089         currently in scope.
2090         (KJS::isStrWhiteSpace): Added. Matches specification for StrWhiteSpace. Could move it to some utility
2091         file later.
2092         (KJS::parseDigit): Added. Helper function for parseInt.
2093         (KJS::parseInt): Added. Integer parser that puts result in a double so we're not limited to what
2094         strtoll can handle. Also matches standard more closely.
2095         (KJS::parseFloat): Added. Handles "0x" properly and passes flag to make empty string turn into NaN
2096         instead of 0.
2097         (KJS::GlobalFuncImp::call): Use the new parseInt and parseFloat.
2098
2099         * kjs/function_object.cpp: (FunctionPrototypeImp::FunctionPrototypeImp): Add a length property.
2100
2101         * kjs/lexer.h: Added error flag and sawError() function for detecting errors.
2102         * kjs/lexer.cpp:
2103         (Lexer::setCode): Clear error state.
2104         (Lexer::lex): Set error state if the lexer encounters an error
2105
2106         * kjs/internal.cpp:
2107         (NumberImp::toString): Roll in change from KDE version to special case 0 so we handle -0 correctly.
2108         (Parser::parse): Use new lexer error method so those errors are treated like parser errors.
2109
2110         * kjs/math_object.cpp: (MathFuncImp::call): Change min and max to treat -0 as less than +0.
2111         Change round to round values between -0.5 and -0 to -0 instead of +0.
2112
2113         * kjs/nodes.h: Add evaluateReference function to GroupNode.
2114         * kjs/nodes.cpp: (GroupNode::evaluateReference): Pass references through groups (parenthesized
2115         expressions) properly so that expressions like "delete (x.y)" work. Before, the parentheses
2116         would change x.y into a value that can't be deleted as a side effect.
2117
2118         * kjs/string_object.cpp: Change parameter count for indexOf and lastIndexOf from 2 to 1 to match
2119         the specification.
2120
2121         * kjs/testkjs.cpp: Rolled in changes from KDE to add a "quit" function to the test tool and
2122         get rid of the fixed size limit for code.
2123
2124         * kjs/ustring.cpp: (KJS::UString::substr): Added optimized case for substr(0, length) so it just
2125         returns the string without creating a new Rep, since I'm using substr in a place where it will
2126         often be passed a 0.
2127
2128         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed one wrong entry in the Unicode table I added to
2129         the other day that was making a couple tests fail.
2130         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
2131         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
2132         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
2133         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
2134         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
2135
2136         * kjs/string_object.lut.h: Regenerated.
2137
2138 2004-08-11  Darin Adler  <darin@apple.com>
2139
2140         - fixed a tiny problem with the UTF-16 PCRE check-in
2141
2142         * pcre/maketables.c: (pcre_maketables): Fix mistake in table-generating code that sometimes caused
2143         the ctype_meta flag to get set in items that should not have it.
2144
2145         * pcre/chartables.c: Regenerated.
2146
2147 2004-08-10  Richard Williamson   <rjw@apple.com>
2148
2149         Fixed <rdar://problem/3674747> Need to implement invokeUndefinedMethodFromWebScript:withArguments:
2150
2151         The following WebScripting methods are now supported on bound
2152         objects:
2153
2154         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args;
2155         - (void)setValue:(id)value forUndefinedKey:(NSString *)key
2156         - (id)valueForUndefinedKey:(NSString *)key
2157
2158         Reviewed by Chris.
2159
2160         * bindings/c/c_class.cpp:
2161         (CClass::fieldNamed):
2162         * bindings/c/c_class.h:
2163         * bindings/jni/jni_class.cpp:
2164         (JavaClass::fieldNamed):
2165         * bindings/jni/jni_class.h:
2166         * bindings/objc/objc_class.h:
2167         (KJS::Bindings::ObjcClass::isa):
2168         * bindings/objc/objc_class.mm:
2169         (ObjcClass::methodsNamed):
2170         (ObjcClass::fieldNamed):
2171         (ObjcClass::fallbackObject):
2172         * bindings/objc/objc_instance.h:
2173         * bindings/objc/objc_instance.mm:
2174         (ObjcInstance::invokeMethod):
2175         (ObjcInstance::setValueOfField):
2176         (ObjcInstance::setValueOfUndefinedField):
2177         (ObjcInstance::getValueOfField):
2178         (ObjcInstance::getValueOfUndefinedField):
2179         * bindings/objc/objc_runtime.h:
2180         (KJS::Bindings::ObjcField::~ObjcField):
2181         (KJS::Bindings::ObjcField::ObjcField):
2182         (KJS::Bindings::ObjcField::operator=):
2183         (KJS::Bindings::FallbackObjectImp::classInfo):
2184         * bindings/objc/objc_runtime.mm:
2185         (ObjcField::ObjcField):
2186         (ObjcField::name):
2187         (ObjcField::type):
2188         (ObjcField::valueFromInstance):
2189         (ObjcField::setValueToInstance):
2190         (FallbackObjectImp::FallbackObjectImp):
2191         (FallbackObjectImp::get):
2192         (FallbackObjectImp::put):
2193         (FallbackObjectImp::canPut):
2194         (FallbackObjectImp::implementsCall):
2195         (FallbackObjectImp::call):
2196         (FallbackObjectImp::hasProperty):
2197         (FallbackObjectImp::deleteProperty):
2198         (FallbackObjectImp::defaultValue):
2199         * bindings/runtime.h:
2200         (KJS::Bindings::Class::fallbackObject):
2201         (KJS::Bindings::Instance::getValueOfUndefinedField):
2202         (KJS::Bindings::Instance::setValueOfUndefinedField):
2203         * bindings/runtime_object.cpp:
2204         (RuntimeObjectImp::get):
2205         (RuntimeObjectImp::put):
2206         (RuntimeObjectImp::canPut):
2207         (RuntimeObjectImp::hasProperty):
2208         * bindings/testbindings.mm:
2209         (-[MyFirstInterface valueForUndefinedKey:]):
2210         (-[MyFirstInterface setValue:forUndefinedKey:]):
2211
2212 2004-08-10  Darin Adler  <darin@apple.com>
2213
2214         Reviewed by Dave.
2215
2216         - switch PCRE to do UTF-16 directly instead of converting to/from UTF-8 for speed
2217
2218         * pcre/pcre.h: Added PCRE_UTF16 switch, set to 1. Added pcre_char typedef, which is char
2219         or uint16_t depending on the mode, and used appropriate in the 7 public functions
2220         that need to use it.
2221         * pcre/pcre.c: Add UTF-16 support to all functions.
2222         * pcre/study.c: Ditto.
2223
2224         * pcre/internal.h: Added ichar typedef, which is unsigned char or uint16_t depending on
2225         the mode. Changed declarations to use symbolic constants and typedefs so we size
2226         things to ichar when needed.
2227
2228         * pcre/maketables.c: (pcre_maketables): Change code to make tables that are
2229         sized to 16-bit characters instead of 8-bit.
2230
2231         * pcre/get.c:
2232         (pcre_copy_substring): Use pcre_char instead of char.
2233         (pcre_get_substring_list): Ditto.
2234         (pcre_free_substring_list): Ditto.
2235         (pcre_get_substring): Ditto.
2236         (pcre_free_substring): Ditto.
2237
2238         * pcre/dftables.c: (main): Used a bit more const, and use ICHAR sizes instead
2239         of hard-coding 8-bit table sizes.
2240
2241         * pcre/chartables.c: Regenerated.
2242
2243         * kjs/ustring.h: Remove functions that convert UTF-16 to/from UTF-8 offsets.
2244         * kjs/ustring.cpp: Change the shared empty string to have a unicode pointer that
2245         is not null. The null string still has a null pointer. This prevents us from
2246         passing a null through to the regular expression engine (which results in a null
2247         error even when the string length is 0).
2248
2249         * kjs/regexp.cpp:
2250         (KJS::RegExp::RegExp): Null-terminate the pattern and pass it.
2251         (KJS::RegExp::match): Use the 16-bit string directly, no need to convert to UTF-8.
2252
2253 2004-08-09  Darin Adler  <darin@apple.com>
2254
2255         Reviewed by Maciej.
2256
2257         - fixed 28 Mozilla JavaScript tests
2258
2259         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Check for undefined rather than
2260         checking the number of arguments for the join method.
2261
2262         * kjs/lexer.cpp: (Lexer::lex): Parse hexadecimal and octal constants in doubles rather
2263         than integers, so we aren't limited to 32 bits.
2264
2265         * kjs/math_object.cpp: (MathFuncImp::call): Get rid of many unneeded special cases in
2266         the implementation of the pow operation. Also simplied a case that was handling positive
2267         and negative infinity separately.
2268
2269         * kjs/nodes.cpp: (ShiftNode::evaluate): Keep the result of shifts in a double instead of
2270         putting them in a long, so that unsigned shift will work properly.
2271
2272         * kjs/number_object.cpp: Add the DontDelete and ReadOnly flags to the numeric constants.
2273
2274         * kjs/operations.cpp:
2275         (KJS::isPosInf): Added an implementation inside APPLE_CHANGES that does not depend on the
2276         sign of isinf; our isinf function returns +1 even for negative infinity.
2277         (KJS::isNegInf): And again.
2278         (KJS::relation): Put in a nice simple implementation of comparison inside APPLE_CHANGES.
2279         Our floating point already handles the various infinity cases correctly.
2280
2281         * kjs/regexp_object.cpp:
2282         (RegExpProtoFuncImp::call): Add missing return before Null() in Exec method.
2283         (RegExpObjectImp::arrayOfMatches): Put undefined rather than an empty string into the
2284         array in cases where we did not match.
2285         (RegExpObjectImp::construct): Set the DontDelete, ReadOnly, and DontEnum flags for
2286         "global", "ignoreCase", "multiline", and "source".
2287
2288         * kjs/string_object.cpp: (StringProtoFuncImp::call): For the match method, turn a null
2289         string into undefined rather than an empty string. For the slice method, handle an
2290         undefined parameter for the limit properly as decribed in the specification, and add
2291         the limit to one case that didn't have the limit at all. For the methods that generate
2292         HTML strings, use lowercase tags instead of uppercase.
2293
2294         * kjs/ustring.cpp:
2295         (KJS::UChar::toLower): Use u_tolower from the ICU library.
2296         (KJS::UChar::toUpper): Use u_toupper from the ICU library.
2297         (KJS::UString::append): Fix some math that caused a buffer overflow.
2298         (KJS::convertUTF16OffsetsToUTF8Offsets): Ignore negative numbers (-1 is used as a special
2299         flag) rather than converting them all to 0.
2300         (KJS::convertUTF8OffsetsToUTF16Offsets): Ditto.
2301
2302         * tests/mozilla/jsDriver.pl: Fixed the relative links to point to our actual test files.
2303
2304         * tests/mozilla/ecma/String/15.5.4.11-1.js: Fixed the Unicode table in this test to match
2305         the Unicode specification in a few cases where it was wrong before.
2306         * tests/mozilla/ecma/String/15.5.4.11-2.js: Ditto.
2307         * tests/mozilla/ecma/String/15.5.4.11-3.js: Ditto.
2308         * tests/mozilla/ecma/String/15.5.4.11-5.js: Ditto.
2309         * tests/mozilla/ecma/String/15.5.4.11-6.js: Ditto.
2310         * tests/mozilla/ecma/String/15.5.4.12-1.js: Ditto.
2311         * tests/mozilla/ecma/String/15.5.4.12-2.js: Ditto.
2312         * tests/mozilla/ecma/String/15.5.4.12-3.js: Ditto.
2313         * tests/mozilla/ecma/String/15.5.4.12-4.js: Ditto.
2314         * tests/mozilla/ecma/String/15.5.4.12-5.js: Ditto.
2315
2316         * JavaScriptCore.pbproj/project.pbxproj: Link to libicu.
2317
2318         * kjs/number_object.lut.h: Regenerated.
2319
2320 2004-08-09  Darin Adler  <darin@apple.com>
2321
2322         Reviewed by Maciej.
2323
2324         - fixed <rdar://problem/3753467> REGRESSION (137-138): reproducible buffer overrun in UString manipulation code
2325
2326         * kjs/ustring.cpp: (KJS::UString::append): Fix incorrect size computation. Without it
2327         we get a buffer overflow.
2328
2329 === Safari-155 ===
2330
2331 2004-08-05  Richard Williamson   <rjw@apple.com>
2332
2333         Fixed part of 3674747.  The QT guys need this for feature freeze.
2334
2335         This patch implements support for the
2336
2337         - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
2338
2339         method of objects bound to JavaScript.
2340
2341         Reviewed by John.
2342
2343         * ChangeLog:
2344         * bindings/objc/objc_class.mm:
2345         (ObjcClass::methodsNamed):
2346         (ObjcClass::fieldNamed):
2347         * bindings/objc/objc_instance.mm:
2348         (ObjcInstance::invokeMethod):
2349         * bindings/objc/objc_runtime.h:
2350         (KJS::Bindings::ObjcMethod::~ObjcMethod):
2351         (KJS::Bindings::ObjcMethod::isFallbackMethod):
2352         (KJS::Bindings::ObjcMethod::javaScriptName):
2353         * bindings/objc/objc_runtime.mm:
2354         (ObjcMethod::ObjcMethod):
2355         (ObjcMethod::getMethodSignature):
2356         (ObjcMethod::setJavaScriptName):
2357         * bindings/testbindings.mm:
2358
2359 2004-08-04  Vicki Murley  <vicki@apple.com>
2360
2361         Reviewed by mjs.
2362  
2363         - fix <rdar://problem/3649789> SAP WebGUI has problems loading first page because of parse error        
2364
2365         * kjs/lexer.cpp:
2366         (Lexer::lex): if the current character is a '\' and the next character is a line terminator,
2367         go to the next line and continue parsing the string (instead of failing).  This matches 
2368         behavior in Mac IE and Mozilla.
2369
2370 2004-08-03  Kevin Decker  <kdecker@apple.com>
2371
2372         Reviewed by Darin.
2373
2374         Rolled in changes from the latest KJS sources that support additional 
2375         Number.prototype functions. 
2376
2377         Specifically this patch covers the follow parts of the ECMA 3 spec:
2378         15.7.4.5, 15.7.4.6, and 15.7.4.7 
2379         
2380         Fixes:
2381         <rdar://problem/3663716> missing Number.toFixed (and toPrecision, toExponential)
2382         <rdar://problem/3749492> missing Number.toPrecision prototype implementation
2383         <rdar://problem/3749591> missing Number.toExponential prototype implementation
2384
2385         * kjs/identifier.h: Added toFixed, toPrecision, and toExponential to the
2386         list of supported identifiers (a macro).
2387         * kjs/number_object.cpp: Implemented support for toFixed(), toPrecision(),
2388         and toExponential(). 
2389         (NumberPrototypeImp::NumberPrototypeImp):
2390         (NumberProtoFuncImp::call):
2391         * kjs/number_object.h: Added property names for toFixed, toPrecision,
2392         and toExponential. 
2393         (KJS::NumberProtoFuncImp::):
2394         * tests/mozilla/expected.html: Update results.
2395
2396 2004-08-03  Darin Adler  <darin@apple.com>
2397
2398         Reviewed by Ken.
2399
2400         - added support for copying RegExp objects so 7 more Mozilla regexp tests pass
2401
2402         * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Check for case where
2403         we are supposed to just copy the regular expression object, and do so.
2404         Also tighten up arguments check to handle case where an actual "undefined"
2405         is passed rather than just omitting an argument.
2406
2407         * tests/mozilla/expected.html: Update results.
2408
2409 2004-08-02  Darin Adler  <darin@apple.com>
2410
2411         * tests/mozilla/.cvsignore: Added.
2412         * tests/mozilla/expected.html: Update results.
2413
2414 2004-08-02  Darin Adler  <darin@apple.com>
2415
2416         Reviewed by Ken.
2417
2418         - fixed RegExp.toString so 3 more Mozilla regexp tests pass
2419
2420         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call):
2421         Append the flags here so more tests paseed.
2422
2423 2004-08-02  Darin Adler  <darin@apple.com>
2424
2425         Reviewed by Ken.
2426
2427         - fixed a couple things making 5 Mozilla regexp tests pass
2428
2429         * kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): Implement toString
2430         for the prototype.
2431         (RegExpObjectImp::construct): Fix bug where the string "undefined" would
2432         be used as the flags string when no parameter was passed.
2433
2434         * kjs/regexp_object.h: (KJS::RegExpPrototypeImp::classInfo):
2435         Added a class info object for RegExp prototype so it can return
2436         a string instead of raising an exception when converting to a string.
2437
2438         * tests/mozilla/expected.html: Update results.
2439
2440 2004-08-02  Darin Adler  <darin@apple.com>
2441
2442         Reviewed by Kevin.
2443
2444         - fix crashes in mozilla tests due to mishandling NaN
2445
2446         * kjs/array_object.cpp: (ArrayProtoFuncImp::call): Rerranged range checks after
2447         calls to toInteger so that NaN will get turned into something that fits in an integer.
2448         These were the ones John already fixed, but his fix used isnan and the new fix is
2449         more efficient.
2450
2451         * kjs/number_object.cpp: (NumberProtoFuncImp::call): Rearranged radix range checks
2452         after a call to toInteger to handle NaN properly. Also removed separate check
2453         for undefined that's not needed.
2454
2455         * kjs/string_object.cpp: (StringProtoFuncImp::call): More of the same kinds of changes
2456         as in the above two files, but for a lot more functions. Also changed one place with
2457         an explicit check for undefined to instead just check isNaN.
2458
2459         * tests/mozilla/run-mozilla-tests: Changed to invoke jst using $SYMROOTS for people
2460         like me who don't keep $SYMROOTS in their $PATH.
2461
2462 === Safari-154 ===
2463
2464 === Safari-153 ===
2465
2466 2004-07-26  Kevin Decker  <kdecker@apple.com>
2467
2468         Changes done by Darin, reviewed by Kevin.
2469
2470         - changed testkjs to build in Xcode rather than from Makefile
2471
2472         * .cvsignore: Removed obsolete files from this list.
2473         * Makefile.am: Removed code to build testkjs; we do this in Xcode now.
2474         Changed to build target "All" rather than default target. This makes us
2475         build the testkjs test tool.
2476         * dummy.cpp: Removed.
2477         * kjs/.cvsignore: Removed obsolete files from this list, including
2478         the testkjs tool, which is now built in the symroots directory.
2479         * kjs/testkjs.cpp: Added copyright notice that was missing, since we have
2480         changed this file. Also this has the nice side effect of causing the tool
2481         to be rebuilt in the new location even if there are no other changes in
2482         your tree when you check this out.
2483         * tests/mozilla/run-mozilla-tests: Invoke perl explicitly so this works
2484         without setting the execute bit on jsDriver.pl.
2485
2486 2004-07-22  Kevin Decker  <kdecker@apple.com>
2487
2488         Reviewed by Darin
2489         
2490         Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions). 
2491
2492         * kjs/function_object.cpp:
2493         (FunctionObjectImp::construct):
2494         * kjs/function_object.h:
2495         * kjs/object.cpp:
2496         (KJS::ObjectImp::construct):
2497         * kjs/object.h:
2498         (KJS::Object::construct):
2499
2500 2004-07-21  Darin Adler  <darin@apple.com>
2501
2502         * bindings/npruntime.h: Fixed typo.
2503
2504 2004-07-19  John Sullivan  <sullivan@apple.com>
2505
2506         Reviewed by Maciej.
2507         
2508         - bulletproofed array.slice() against NAN arguments. Harri noticed this
2509         vulnerability in my patch for 3714644
2510
2511         * kjs/array_object.cpp:
2512         (ArrayProtoFuncImp::call):
2513         handle NAN parameters passed to slice() by clamping to 0 and length.
2514
2515 2004-07-19  Richard Williamson   <rjw@apple.com>
2516
2517         Fixed 3733349.  Prevent Java applet callbacks into JavaScript after applet
2518         has been destroyed.
2519
2520         Reviewed by John.
2521
2522         * bindings/jni/jni_jsobject.cpp:
2523         (JSObject::invoke):
2524         (JSObject::JSObject):
2525
2526 2004-07-16  John Sullivan  <sullivan@apple.com>
2527
2528         Reviewed by Maciej.
2529         
2530         - fixed <rdar://problem/3714644> REGRESSION (125.8-146): bugzilla submit link 
2531         hangs browser with javascript
2532
2533         * kjs/array_object.cpp:
2534         (ArrayProtoFuncImp::call):
2535         Check for undefined type for args[0] the same way we were already checking
2536         for args[1]. In this case, args was zero-length, but we were treating
2537         args[0] like an integer anyway. Resulted in some code looping from a NAN
2538         value to 4, taking approximately forever.
2539
2540         * JavaScriptCore.pbproj/project.pbxproj:
2541         version wars
2542         
2543 === Safari-152 ===
2544
2545 2004-07-14  Maciej Stachowiak  <mjs@apple.com>
2546
2547         Reviewed by John.
2548
2549         <rdar://problem/3711474>: (REGRESSION (125-146): JavaScript 'toString(16)' is broken)
2550         <rdar://problem/3644873>: (REGRESSION (125-140u): secondary list doesn't fill in at Southwest.com)
2551
2552         * kjs/number_object.cpp:
2553         (NumberProtoFuncImp::call): Initialize radix from dradix, not from itself!
2554
2555 2004-07-13  Kevin Decker  <kdecker@apple.com>
2556
2557         Reviewed by kocienda.
2558
2559         - made testkjs and JavaScriptCore a subtarget of 'All'
2560         - testkjs now builds in $SYMROOTS
2561
2562         * JavaScriptCore.pbproj/project.pbxproj:
2563
2564 === Safari-151 ===
2565
2566 2004-06-24  Chris Blumenberg  <cblu@apple.com>
2567
2568         Ignore .mode1 files in JavaScriptCore.pbproj
2569
2570         Reviewed by kocienda.
2571
2572         * JavaScriptCore.pbproj/.cvsignore:
2573
2574 2004-06-23  Richard Williamson   <rjw@apple.com>
2575
2576         Implemented changes for latest npruntime.h.
2577         
2578         Reviewed by Chris.
2579
2580         * JavaScriptCore.pbproj/project.pbxproj:
2581         * bindings/NP_jsobject.cpp:
2582         (listFromVariantArgs):
2583         (identiferFromNPIdentifier):
2584         (_NPN_CreateScriptObject):
2585         (NPN_Call):
2586         (NPN_Evaluate):
2587         (NPN_GetProperty):
2588         (NPN_SetProperty):
2589         (NPN_RemoveProperty):
2590         * bindings/NP_jsobject.h:
2591         * bindings/c/c_class.cpp:
2592         (CClass::methodsNamed):
2593         (CClass::fieldNamed):
2594         * bindings/c/c_instance.cpp:
2595         (CInstance::invokeMethod):
2596         * bindings/c/c_utility.cpp:
2597         (convertNPVariantToValue):
2598         * bindings/c/c_utility.h:
2599         * bindings/npruntime.cpp:
2600         (stringIdentifierEqual):
2601         (stringIdentifierHash):
2602         (getStringIdentifierDictionary):
2603         (intIdentifierEqual):
2604         (intIdentifierHash):
2605         (getIntIdentifierDictionary):
2606         (NPN_GetStringIdentifier):
2607         (NPN_GetStringIdentifiers):
2608         (NPN_GetIntIdentifier):
2609         (NPN_IdentifierIsString):
2610         (NPN_UTF8FromIdentifier):
2611         (NPN_VariantToInt32):
2612         (NPN_VariantToDouble):
2613         (NPN_SetException):
2614         * bindings/npruntime.h:
2615         * bindings/objc/WebScriptObject.mm:
2616         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2617         * bindings/runtime_object.cpp:
2618         (RuntimeObjectImp::~RuntimeObjectImp):
2619         * bindings/runtime_root.cpp:
2620         (KJS::Bindings::rootForInterpreter):
2621         * bindings/testbindings.cpp:
2622         (initializeIdentifiers):
2623         (logMessage):
2624         (setDoubleValue):
2625         (setIntValue):
2626         (setBooleanValue):
2627
2628 === JavaScriptCore-146.1 ===
2629
2630 2004-06-16  Richard Williamson   <rjw@apple.com>
2631
2632         Fixed <rdar://problem/3702287> Crash returning nil from bound ObjC
2633
2634         This turned out to be a show stopper for Dashboard.  Accessing a nil
2635         ObjC property from JS caused a crash.  Similar to the problem
2636         3696112 fixed below.
2637         
2638         Reviewed by Trey.
2639
2640         * bindings/objc/objc_runtime.mm:
2641         (KJS::Bindings::ObjcField::valueFromInstance):
2642
2643 === Safari-146 ===
2644
2645 2004-06-16  Richard Williamson   <rjw@apple.com>
2646
2647         Fixed <rdar://problem/3696112>: nil from an Objective-C class seems to get wrapped as a JavaScript proxy that will not print.
2648
2649         This turned out to be a show stopper for Dashboard.  We now
2650         return Undefined() when nil is returned from a ObjC method
2651         that returns an object type.
2652         
2653         Reviewed by Maciej.
2654
2655         * bindings/objc/objc_utility.mm:
2656         (KJS::Bindings::convertObjcValueToValue):
2657
2658 === Safari-145 ===
2659
2660 2004-06-15  Richard Williamson   <rjw@apple.com>
2661
2662         Fixed <rdar://problem/3695875>: Objective-C instances that are exported to JavaScript are too promiscuous
2663
2664         No longer need to check respondsToSelector: for
2665         isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript:
2666         because these now have a default implementation on NSObject.
2667
2668         Reviewed by Trey.
2669
2670         * bindings/objc/objc_class.mm:
2671         (ObjcClass::methodsNamed):
2672         (ObjcClass::fieldNamed):
2673
2674 2004-06-14  Darin Adler  <darin@apple.com>
2675
2676         Reviewed by Maciej.
2677
2678         - fixed some things for GC that Patrick missed, or that happened after the branch
2679
2680         * bindings/objc/WebScriptObject.mm:
2681         (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
2682         (-[WebScriptObject finalize]): Added.
2683
2684         - added some missing nil checks
2685
2686         * bindings/objc/objc_instance.mm:
2687         (ObjcInstance::ObjcInstance): Check for nil.
2688         (ObjcInstance::~ObjcInstance): Check for nil.
2689         (ObjcInstance::operator=): Check for nil.
2690
2691 2004-06-14  Darin Adler  <darin@apple.com>
2692
2693         Reviewed by me, code changes by Patrick Beard.
2694
2695         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
2696
2697         * bindings/objc/objc_instance.mm:
2698         (ObjcInstance::ObjcInstance): Use CFRetain instead of retain.
2699         (ObjcInstance::~ObjcInstance): Use CFRelease instead of release.
2700         (ObjcInstance::operator=): More of the same.
2701         (ObjcInstance::end): Use [pool drain] if compiling on Tiger.
2702
2703         * bindings/objc/objc_runtime.mm:
2704         (ObjcArray::ObjcArray): Use CFRetain instead of retain.
2705         (ObjcArray::~ObjcArray): Use CFRelease instead of release.
2706         (ObjcArray::operator=): More of the same.
2707
2708         * bindings/testbindings.mm: Fixed incorrect license.
2709         (main): Use [pool drain] if compiling on Tiger.
2710
2711 === Safari-144 ===
2712
2713 2004-06-10  Kevin Decker  <kdecker@apple.com>
2714
2715         Reviewed by John.
2716
2717         * kjs/lexer.cpp: 
2718         (Lexer::setCode):
2719             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
2720         * kjs/lexer.h:
2721         (KJS::Lexer::lineNo):
2722             - fixed <rdar://problem/3682398>: (error console line numbers are offset by 1)
2723
2724 === JavaScriptCore-143.2 ===
2725
2726 2004-06-07  Darin Adler  <darin@apple.com>
2727
2728         - fixed <rdar://problem/3682489>: (JavaScriptGlue no longer compiles because Interpreter::evaluate parameters changed)
2729
2730         * kjs/interpreter.h: Added an overload to make JavaScriptGlue compile.
2731         * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): Implemented the overload.
2732
2733 === JavaScriptCore-143.1 ===
2734
2735 2004-06-04  Kevin Decker  <kdecker@apple.com>
2736
2737         Reviewed by Darin
2738         
2739         - fixed <rdar://problem/3680594>
2740
2741         * kjs/object.cpp:
2742         (KJS::Error::create):
2743
2744 === Safari-143 ===
2745
2746 2004-06-04  Darin Adler  <darin@apple.com>
2747
2748         * kjs/testkjs.cpp: (main): Fix build breakage by adding URL and line number parameters.
2749
2750 2004-06-04  Kevin Decker  <kdecker@apple.com>
2751
2752         Reviewed by Dave.
2753
2754         - ObjC bindings do not (yet) pass along sourceurl or line numbers
2755         - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
2756         - changed the wording of an error message
2757         - the lexer, parser, and interpreter have been made "sourceURL aware"
2758         - stored the url into Error
2759          
2760         * bindings/NP_jsobject.cpp:
2761         (NPN_Evaluate):
2762         * bindings/jni/jni_jsobject.cpp:
2763         (JSObject::eval):
2764         * bindings/objc/WebScriptObject.mm:
2765         (-[WebScriptObject evaluateWebScript:]):
2766         * kjs/function.cpp:
2767         (GlobalFuncImp::call):
2768         * kjs/function_object.cpp:
2769         (FunctionObjectImp::construct):
2770         * kjs/internal.cpp:
2771         (Parser::parse):
2772         (InterpreterImp::checkSyntax):
2773         (InterpreterImp::evaluate):
2774         * kjs/internal.h:
2775         * kjs/interpreter.cpp:
2776         (Interpreter::evaluate):
2777         * kjs/interpreter.h:
2778         * kjs/lexer.cpp:
2779         (Lexer::setCode):
2780         * kjs/lexer.h:
2781         (KJS::Lexer::sourceURL):
2782         * kjs/nodes.cpp:
2783         (Node::Node):
2784         (Node::throwError):
2785         (FunctionCallNode::evaluate):
2786         * kjs/nodes.h:
2787         * kjs/object.cpp:
2788         (KJS::Error::create):
2789         * kjs/object.h:
2790
2791 2004-06-04  Richard Williamson   <rjw@apple.com>
2792
2793         Fixed crash when attempting to access properties on nil
2794         object.
2795         
2796         Reviewed by John.
2797
2798         * bindings/objc/objc_instance.mm:
2799         (ObjcInstance::getClass):
2800         * bindings/runtime_object.cpp:
2801         (RuntimeObjectImp::get):
2802         * bindings/testM.js:
2803         * bindings/testbindings.mm:
2804         (-[MyFirstInterface getString]):
2805
2806 2004-05-27  Kevin Decker  <kdecker@apple.com>
2807
2808         Reviewed by Ken.
2809
2810         -revised generated error message content
2811         
2812         * kjs/error_object.cpp:
2813         (ErrorProtoFuncImp::call):
2814         * kjs/internal.cpp:
2815         (Parser::parse):
2816         * kjs/object.cpp:
2817         (KJS::Error::create):
2818
2819 === Safari-142 ===
2820
2821 2004-05-27  Richard Williamson   <rjw@apple.com>
2822
2823         Renamed WebScriptMethods to WebScripting based on feedback from Nancy.
2824
2825         Reviewed by Chris.
2826
2827         * bindings/objc/WebScriptObject.h:
2828
2829 2004-05-27  Darin Adler  <darin@apple.com>
2830
2831         Reviewed by Maciej.
2832
2833         - moved to new symlink technique for embedding frameworks
2834
2835         * JavaScriptCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step
2836         because we don't need it any more.
2837
2838 2004-05-24  Richard Williamson   <rjw@apple.com>
2839
2840         Changed RuntimeArrayImp to inherit from ArrayInstanceImp and
2841         fixed ClassInfo to correctly reflect inheritance.  This is required
2842         because of the runtime checks in JSC for arrays, i.e. in
2843         the Function objects apply method.
2844
2845         Reviewed by Ken.
2846
2847         * bindings/jni/jni_runtime.cpp:
2848         (JavaArray::convertJObjectToArray):
2849         * bindings/objc/objc_utility.mm:
2850         (KJS::Bindings::convertObjcValueToValue):
2851         * bindings/runtime_array.cpp:
2852         (RuntimeArrayImp::RuntimeArrayImp):
2853         * bindings/runtime_array.h:
2854         * bindings/testM.js: Added.
2855         * bindings/testbindings.mm:
2856         (+[MyFirstInterface webScriptNameForSelector:]):
2857         (-[MyFirstInterface logMessages:]):
2858         (-[MyFirstInterface logMessage:prefix:]):
2859         (-[MyFirstInterface callJSObject::]):
2860
2861 2004-05-22  Darin Adler  <darin@apple.com>
2862
2863         Reviewed by Maciej.
2864
2865         - fixed <rdar://problem/3664260>: (JS needs to listen to timezone change notifications)
2866
2867         * kjs/date_object.cpp: (CopyLocalTimeZone): As per Chris Kane and Jordan Hubbard, use <notify.h>
2868         with a hardcoded string of "com.apple.system.timezone", and do CFTimeZoneResetSystem since
2869         CoreFoundation doesn't do this itself. Turns out this affects the default time zone as long as
2870         it hasn't been set explicitly.
2871
2872 === Safari-141 ===
2873
2874 2004-05-20  Richard Williamson   <rjw@apple.com>
2875
2876         Implemented WebScriptObject/DOM wrapper voodoo.  DOM wrappers
2877         can now be referenced like any other WebScriptObject, meaning
2878         you can do JS operations on them.
2879
2880         All added implementation of finalizeForWebScript.
2881
2882         Reviewed by Ken.
2883
2884         * bindings/objc/WebScriptObject.h:
2885         * bindings/objc/WebScriptObject.mm:
2886         (-[WebScriptObject _initializeWithObjectImp:KJS::root:Bindings::]):
2887         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2888         (-[WebScriptObject KJS::]):
2889         (-[WebScriptObject dealloc]):
2890         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2891         (-[WebScriptObject evaluateWebScript:]):
2892         (-[WebScriptObject setValue:forKey:]):
2893         (-[WebScriptObject valueForKey:]):
2894         (-[WebScriptObject stringRepresentation]):
2895         * bindings/objc/WebScriptObjectPrivate.h:
2896         * bindings/objc/objc_instance.mm:
2897         (ObjcInstance::~ObjcInstance):
2898
2899 2004-05-19  Richard Williamson   <rjw@apple.com>
2900
2901         Removed extraneous tabs that were added (by XCode?).
2902
2903         * bindings/objc/WebScriptObject.h:
2904
2905 2004-05-19  Darin Adler  <darin@apple.com>
2906
2907         - fixed headers with licenses mangled by Xcode auto-indenting
2908
2909         * bindings/jni/jni_jsobject.cpp:
2910         * bindings/jni/jni_jsobject.h:
2911         * bindings/runtime_array.h:
2912         * bindings/runtime_root.cpp:
2913         * bindings/runtime_root.h:
2914
2915 2004-05-18  Richard Williamson   <rjw@apple.com>
2916
2917         Added exception logging.  Also check for exception and
2918         set results as appropriate.
2919
2920         Reviewed by Maciej (partially reviewed).
2921
2922         * bindings/objc/WebScriptObject.mm:
2923         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2924         (-[WebScriptObject evaluateWebScript:]):
2925         (-[WebScriptObject setValue:forKey:]):
2926         (-[WebScriptObject valueForKey:]):
2927
2928 2004-05-18  Richard Williamson   <rjw@apple.com>
2929
2930         Finsished implementing support for windowScriptObject.
2931         Had to make WebScriptObjectPrivate.h accessible from
2932         WebCore.
2933
2934         Reviewed by Maciej.
2935
2936         * JavaScriptCore.pbproj/project.pbxproj:
2937         * bindings/objc/WebScriptObjectPrivate.h:
2938
2939 2004-05-18  Richard Williamson   <rjw@apple.com>
2940
2941         Use KVC to set/get values instead of directly accessing
2942         ivars.
2943
2944         Reviewed by Maciej.
2945
2946         * bindings/objc/WebScriptObject.mm:
2947         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2948         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2949         * bindings/objc/objc_runtime.mm:
2950         (ObjcField::valueFromInstance):
2951         (convertValueToObjcObject):
2952         (ObjcField::setValueToInstance):
2953
2954 2004-05-17  Richard Williamson   <rjw@apple.com>
2955
2956         Implemented new API for WebScriptObject.
2957
2958         Fixed <rdar://problem/3657145>: (objc to javascript method calls do not cause updates.)
2959         Fixed <rdar://problem/3654887>: (Update to JSC to refer to new JSObject LiveConnect object)  (w/ help from Vicki)
2960
2961         Reviewed by Hyatt.
2962
2963         * JavaScriptCore.pbproj/project.pbxproj:
2964         * bindings/c/c_instance.cpp:
2965         (CInstance::invokeMethod):
2966         * bindings/jni/jni_instance.cpp:
2967         (JavaInstance::invokeMethod):
2968         * bindings/jni/jni_jsobject.cpp:
2969         (JSObject::convertValueToJObject):
2970         * bindings/jni/jni_utility.cpp:
2971         (KJS::Bindings::getJNIField):
2972         * bindings/objc/WebScriptObject.mm:
2973         (_didExecute):
2974         (-[WebScriptObject _initWithObjectImp:KJS::root:Bindings::]):
2975         (-[WebScriptObject KJS::]):
2976         (-[WebScriptObject dealloc]):
2977         (+[WebScriptObject throwException:]):
2978         (listFromNSArray):
2979         (-[WebScriptObject callWebScriptMethod:withArguments:]):
2980         (-[WebScriptObject evaluateWebScript:]):
2981         (-[WebScriptObject setValue:forKey:]):
2982         (-[WebScriptObject valueForKey:]):
2983         (-[WebScriptObject stringRepresentation]):
2984         (+[WebScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
2985         (+[WebUndefined undefined]):
2986         (-[WebUndefined initWithCoder:]):
2987         (-[WebUndefined encodeWithCoder:]):
2988         (-[WebUndefined copyWithZone:]):
2989         (-[WebUndefined retain]):
2990         (-[WebUndefined release]):
2991         (-[WebUndefined retainCount]):
2992         (-[WebUndefined autorelease]):
2993         (-[WebUndefined dealloc]):
2994         (-[WebUndefined copy]):
2995         (-[WebUndefined replacementObjectForPortCoder:]):
2996         * bindings/objc/WebScriptObjectPrivate.h: Added.
2997         * bindings/objc/objc_class.mm:
2998         (ObjcClass::methodsNamed):
2999         (ObjcClass::fieldNamed):
3000         * bindings/objc/objc_instance.mm:
3001         (ObjcInstance::invokeMethod):
3002         * bindings/objc/objc_jsobject.h:
3003         * bindings/objc/objc_jsobject.mm:
3004         * bindings/objc/objc_runtime.mm:
3005         (ObjcField::valueFromInstance):
3006         * bindings/objc/objc_utility.mm:
3007         (KJS::Bindings::JSMethodNameToObjCMethodName):
3008         (KJS::Bindings::convertValueToObjcValue):
3009         (KJS::Bindings::convertObjcValueToValue):
3010         * bindings/runtime.cpp:
3011         (Instance::setDidExecuteFunction):
3012         (Instance::didExecuteFunction):
3013         (Instance::setValueOfField):
3014         * bindings/runtime.h:
3015         * bindings/testbindings.mm:
3016         (+[MyFirstInterface webScriptNameForSelector:]):
3017         (-[MyFirstInterface callJSObject::]):
3018
3019 2004-05-14  Vicki Murley  <vicki@apple.com>
3020
3021         Reviewed by mjs.
3022  
3023         <rdar://problem/3642427>: framework marketing number should be 2.0 for DoubleBarrel release
3024
3025         * JavaScriptCore.pbproj/project.pbxproj: change CFBundleShortVersionString to 2.0
3026
3027 === Safari-140 ===
3028
3029 2004-05-13  Richard Williamson   <rjw@apple.com>
3030
3031         Fixed indentation.
3032
3033         Reviewed by Chris.
3034
3035         * ChangeLog:
3036         * bindings/objc/WebScriptObject.h:
3037
3038 2004-05-13  Richard Williamson   <rjw@apple.com>
3039
3040         Approved API changes.  Currently unimplemented.
3041
3042         Reviewed by Chris.
3043
3044         * ChangeLog:
3045         * JavaScriptCore.pbproj/project.pbxproj:
3046         * bindings/objc/WebScriptObject.h: Added.
3047         * bindings/objc/WebScriptObject.mm: Added.
3048         (+[WebScriptObject throwException:]):
3049         (-[WebScriptObject callWebScriptMethod:withArguments:]):
3050         (-[WebScriptObject evaluateWebScript:]):
3051         (-[WebScriptObject stringRepresentation]):
3052         (+[WebUndefined undefined]):
3053         (-[WebUndefined initWithCoder:]):
3054         (-[WebUndefined encodeWithCoder:]):
3055         (-[WebUndefined copyWithZone:]):
3056
3057 2004-05-07  Vicki Murley  <vicki@apple.com>
3058
3059         Reviewed by darin.
3060
3061         Turn off GC since it uses ppc only instructions (which breaks 
3062         the B&I build).   
3063     
3064         * kjs/value.h: set USE_CONSERVATIVE_GC to 0
3065
3066 === Safari-139 ===
3067
3068 2004-05-07  Maciej Stachowiak  <mjs@apple.com>
3069
3070         Reviewed by Darin.
3071
3072         - add -funroll-loops=16 compiler option for approx .5% speedup on
3073         HTML iBench and .5-1% speedup on JS iBench.
3074         
3075         * JavaScriptCore.pbproj/project.pbxproj:
3076
3077 2004-04-25  Maciej Stachowiak  <mjs@apple.com>
3078
3079         Reviewed by Darin.
3080
3081         Enable full conservative GC mode in addition to test mode. When
3082         conservative GC is enabled, we now get an 11% speed improvement on
3083         the iBench. Also fix some spots I missed before.
3084
3085         Specific noteworth changes:
3086         
3087         * kjs/collector.cpp:
3088         (KJS::Collector::markStackObjectsConservatively): Check possible
3089         cell pointers for 8-byte aligment and verify they are not 0.
3090
3091         * kjs/protected_values.cpp:
3092         (KJS::ProtectedValues::increaseProtectCount): Move null-tolerance from here...
3093         (KJS::ProtectedValues::decreaseProtectCount): ...and here...
3094         * kjs/protect.h:
3095         (KJS::gcProtectNullTolerant): ...to here...
3096         (KJS::gcUnprotectNullTolerant): ...and here, because not all callers need the null
3097         tolerance, and doing the check is expensive.
3098
3099         * kjs/protected_values.cpp:
3100         (KJS::ProtectedValues::computeHash): Replace hash function with a much faster one
3101         that is still very good.
3102
3103         * kjs/protect.h:
3104         (KJS::gcProtect):
3105         (KJS::gcUnprotect):
3106         (KJS::ProtectedValue::ProtectedValue):
3107         (KJS::ProtectedValue::~ProtectedValue):
3108         (KJS::ProtectedValue::operator=):
3109         (KJS::ProtectedObject::ProtectedObject):
3110         (KJS::ProtectedObject::~ProtectedObject):
3111         (KJS::ProtectedObject::operator=):
3112         (KJS::ProtectedReference::ProtectedReference):
3113         (KJS::ProtectedReference::~ProtectedReference):
3114         (KJS::ProtectedReference::operator=):
3115         * kjs/protected_values.cpp:
3116         (KJS::ProtectedValues::getProtectCount):
3117         (KJS::ProtectedValues::increaseProtectCount):
3118         (KJS::ProtectedValues::decreaseProtectCount):
3119         (KJS::ProtectedValues::computeHash):
3120         * bindings/runtime_root.cpp:
3121         (KJS::Bindings::addNativeReference):
3122         (KJS::Bindings::removeNativeReference):
3123         (RootObject::removeAllNativeReferences):
3124         * bindings/runtime_root.h:
3125         (KJS::Bindings::RootObject::~RootObject):
3126         (KJS::Bindings::RootObject::setRootObjectImp):
3127         * kjs/collector.cpp:
3128         (KJS::Collector::allocate):
3129         (KJS::Collector::collect):
3130         * kjs/collector.h:
3131         * kjs/internal.cpp:
3132         (NumberImp::create):
3133         (InterpreterImp::globalInit):
3134         (InterpreterImp::globalClear):
3135         (InterpreterImp::mark):
3136         * kjs/list.cpp:
3137         (KJS::List::derefValues):
3138         (KJS::List::refValues):
3139         (KJS::List::append):
3140         * kjs/object.cpp:
3141         (KJS::ObjectImp::setInternalValue):
3142         (KJS::ObjectImp::putDirect):
3143         * kjs/value.cpp:
3144         (ValueImp::mark):
3145         (ValueImp::marked):
3146         * kjs/value.h:
3147         (KJS::ValueImp::ValueImp):
3148         (KJS::ValueImp::~ValueImp):
3149         (KJS::ValueImp::):
3150         (KJS::Value::Value):
3151         (KJS::Value::~Value):
3152         (KJS::Value::operator=):
3153
3154 2004-04-30  Richard Williamson   <rjw@apple.com>
3155
3156         Asking an NSInvocation for it's return value when return type
3157         is void throws an exception.  Added check for void return types
3158         to avoid this exception.
3159
3160         Reviewed by Ken.
3161
3162         * bindings/objc/objc_instance.mm:
3163         (ObjcInstance::invokeMethod):
3164
3165 2004-04-29  Richard Williamson   <rjw@apple.com>
3166
3167         Fixed several bad problems with the ObjC bindings.  In particular, conversion
3168         to/from JavaScriptObject (soon to be WebScriptObject) was completely broken.
3169
3170         Reviewed by Chris.
3171
3172         * bindings/objc/objc_jsobject.h:
3173         * bindings/objc/objc_jsobject.mm:
3174         (-[JavaScriptObject initWithObjectImp:KJS::root:Bindings::]):
3175         (-[JavaScriptObject KJS::]):
3176         (+[JavaScriptObject _convertValueToObjcValue:KJS::root:Bindings::]):
3177         (-[JavaScriptObject call:arguments:]):
3178         (-[JavaScriptObject evaluate:]):
3179         (-[JavaScriptObject getMember:]):
3180         (-[JavaScriptObject getSlot:]):
3181         * bindings/objc/objc_runtime.mm:
3182         (ObjcField::valueFromInstance):
3183         (ObjcField::setValueToInstance):
3184         * bindings/objc/objc_utility.mm:
3185         (KJS::Bindings::convertValueToObjcValue):
3186         (KJS::Bindings::convertObjcValueToValue):
3187         * bindings/runtime.h:
3188         * bindings/runtime_root.cpp:
3189         (KJS::Bindings::rootForInterpreter):
3190         (KJS::Bindings::addNativeReference):
3191         (KJS::Bindings::removeNativeReference):
3192         * bindings/runtime_root.h:
3193         * bindings/testbindings.mm:
3194         (-[MyFirstInterface logMessage:]):
3195         (-[MyFirstInterface setJSObject:]):
3196         (-[MyFirstInterface callJSObject::]):
3197
3198 2004-04-24  Darin Adler  <darin@apple.com>
3199
3200         Reviewed by Dave.
3201
3202         * kjs/ustring.cpp: (KJS::UString::append): Fix one case that was allocating a buffer
3203         that is 2x too big.
3204
3205 2004-04-23  Maciej Stachowiak  <mjs@apple.com>
3206
3207         Reviewed by Darin.
3208
3209         Implementation of conservative GC, based partly on code from
3210         Darin. It's turned off for now, so it shouldn't have any effect on
3211         the normal build.
3212         
3213         * JavaScriptCore.pbproj/project.pbxproj:
3214         * kjs/collector.cpp:
3215         (KJS::Collector::markStackObjectsConservatively):
3216         (KJS::Collector::markProtectedObjects):
3217         (KJS::Collector::collect):
3218         * kjs/collector.h:
3219         * kjs/protect.h:
3220         (KJS::gcProtect):
3221         (KJS::gcUnprotect):
3222         * kjs/protected_values.cpp: Added.
3223         (KJS::ProtectedValues::getProtectCount):
3224         (KJS::ProtectedValues::increaseProtectCount):
3225         (KJS::ProtectedValues::insert):
3226         (KJS::ProtectedValues::decreaseProtectCount):
3227         (KJS::ProtectedValues::expand):
3228         (KJS::ProtectedValues::shrink):
3229         (KJS::ProtectedValues::rehash):
3230         (KJS::ProtectedValues::computeHash):
3231         * kjs/protected_values.h: Added.
3232         * kjs/value.cpp:
3233         (ValueImp::useConservativeMark):
3234         (ValueImp::mark):
3235         (ValueImp::marked):
3236         * kjs/value.h:
3237         (KJS::ValueImp::):
3238
3239 === Safari-138 ===
3240
3241 2004-04-22  Richard Williamson   <rjw@apple.com>
3242
3243         Fixed build snafu (re-declaration of NPBool in npruntime.h and
3244         npapi.h).
3245
3246         * bindings/npruntime.h:
3247
3248 2004-04-22  Richard Williamson   <rjw@apple.com>
3249
3250         Updated plugin binding API to reflect latest revision from
3251         working group.
3252         
3253         Biggest change is the introduction of NPVariant used to represent
3254         value types.  NPVariant replaces the use of NPObject for the
3255         exchange of values between scripting environment and native code.
3256
3257         Reviewed by John.
3258
3259         * JavaScriptCore.pbproj/project.pbxproj:
3260         * bindings/NP_jsobject.cpp:
3261         (identiferFromNPIdentifier):
3262         (NPN_Call):
3263         (NPN_Evaluate):
3264         (NPN_GetProperty):
3265         (NPN_SetProperty):
3266         (NPN_ToString):
3267         (NPN_GetPropertyAtIndex):
3268         (NPN_SetPropertyAtIndex):
3269         * bindings/c/c_class.cpp:
3270         (CClass::methodsNamed):
3271         (CClass::fieldNamed):
3272         * bindings/c/c_instance.cpp:
3273         (CInstance::invokeMethod):
3274         (CInstance::defaultValue):
3275         * bindings/c/c_runtime.cpp:
3276         (CField::valueFromInstance):
3277         (CField::setValueToInstance):
3278         * bindings/c/c_utility.cpp:
3279         (convertNPStringToUTF16):
3280         (convertUTF8ToUTF16):
3281         (coerceValueToNPVariantStringType):
3282         (convertValueToNPVariant):
3283         (convertNPVariantToValue):
3284         * bindings/c/c_utility.h:
3285         * bindings/npruntime.cpp:
3286         (NPN_GetIdentifier):
3287         (NPN_GetIdentifiers):
3288         (NPN_UTF8FromIdentifier):
3289         (NPN_VariantIsVoid):
3290         (NPN_VariantIsNull):
3291         (NPN_VariantIsUndefined):
3292         (NPN_VariantIsBool):
3293         (NPN_VariantIsInt32):
3294         (NPN_VariantIsDouble):
3295         (NPN_VariantIsString):
3296         (NPN_VariantIsObject):
3297         (NPN_VariantToBool):
3298         (NPN_VariantToString):
3299         (NPN_VariantToInt32):
3300         (NPN_VariantToDouble):
3301         (NPN_VariantToObject):
3302         (NPN_InitializeVariantAsVoid):
3303         (NPN_InitializeVariantAsNull):
3304         (NPN_InitializeVariantAsUndefined):
3305         (NPN_InitializeVariantWithBool):
3306         (NPN_InitializeVariantWithInt32):
3307         (NPN_InitializeVariantWithDouble):
3308         (NPN_InitializeVariantWithString):
3309         (NPN_InitializeVariantWithStringCopy):
3310         (NPN_InitializeVariantWithObject):
3311         (NPN_InitializeVariantWithVariant):
3312         (NPN_ReleaseVariantValue):
3313         (NPN_CreateObject):
3314         (NPN_RetainObject):
3315         (NPN_ReleaseObject):
3316         (NPN_IsKindOfClass):
3317         (NPN_SetExceptionWithUTF8):
3318         (NPN_SetException):
3319         * bindings/npruntime.h:
3320         (_NPString::):
3321         (_NPString::_NPVariant::):
3322         * bindings/testbindings.cpp:
3323         (logMessage):
3324         (setDoubleValue):
3325         (setIntValue):
3326         (setStringValue):
3327         (setBooleanValue):
3328         (getDoubleValue):
3329         (getIntValue):
3330         (getStringValue):
3331         (getBooleanValue):
3332         (myGetProperty):
3333         (mySetProperty):
3334         (myInvoke):
3335         (myAllocate):
3336
3337 2004-04-22  Darin Adler  <darin@apple.com>
3338
3339         Reviewed by Maciej.
3340
3341         - fixed <rdar://problem/3627473>: "REGRESSION (125-137): memory trasher in UString::append, causing many different crashes"
3342
3343         * kjs/ustring.cpp:
3344         (KJS::UString::expandCapacity): Fix sizeof(UChar *) that should be sizeof(UChar).
3345         Was resulting in a buffer 2x the needed size.
3346         (KJS::UString::expandPreCapacity): Ditto.
3347         (KJS::UString::append): Fix malloc that is missing a sizeof(UChar).
3348
3349 2004-04-21  Maciej Stachowiak  <mjs@apple.com>
3350
3351         Reviewed by Darin.
3352
3353         Preliminary change for conservative GC. Create "protected"
3354         subclasses to GC-protect objects when on heap, since we will soon
3355         remove the built-in refcounting of the normal wrapper classes. Use
3356         them where needed.
3357         
3358         * JavaScriptCore.pbproj/project.pbxproj:
3359         * kjs/context.h:
3360         * kjs/internal.h:
3361         (KJS::InterpreterImp::globalObject):
3362         * kjs/interpreter.h:
3363         * kjs/property_map.cpp:
3364         * kjs/reference.h:
3365         * kjs/reference_list.cpp:
3366
3367 2004-04-19  Maciej Stachowiak  <mjs@apple.com>
3368
3369         Reviewed by Dave.
3370
3371         Optimize prepend using the shared substring optimization. Also,
3372         limit the applicability of shared append and shared prepend. If
3373         you overdo it, it does more harm than good, because you create a
3374         bunch of strings that are disqualified from future shared
3375         append/prepend, for not much immediate savings in allocate/copy
3376         expense.
3377         
3378         * kjs/ustring.cpp:
3379         (KJS::):
3380         (KJS::UString::Rep::create):
3381         (KJS::UString::expandedSize):
3382         (KJS::UString::usedPreCapacity):
3383         (KJS::UString::expandCapacity):
3384         (KJS::UString::expandPreCapacity):
3385         (KJS::UString::UString):
3386         (KJS::UString::append):
3387         (KJS::UString::operator=):
3388         * kjs/ustring.h:
3389         (KJS::UString::Rep::data):
3390
3391 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
3392         Reviewed by Richard.
3393
3394         No more need for Completion or Reference to privately inherit from
3395         Value, none of the superclass functionality is used.
3396
3397         * kjs/completion.h:
3398         * kjs/reference.h:
3399
3400 === Safari-137 ===
3401
3402 2004-04-16  Richard Williamson   <rjw@apple.com>
3403
3404         Added interpreter lock protection around object creation.
3405
3406         Reviewed by Chris.
3407
3408         * bindings/runtime.cpp:
3409         (Instance::createRuntimeObject):
3410
3411 2004-04-16  Maciej Stachowiak  <mjs@apple.com>
3412
3413         Reviewed by Ken.
3414
3415         Another JavaScript speed improvement: use the mechanism from
3416         string append optimization to make taking a substring fast, again
3417         sharing the buffer.
3418
3419         A further 22% improvement on the 24fun string speed test.
3420         
3421         * kjs/ustring.cpp:
3422         (KJS::):
3423         (KJS::UString::Rep::create):
3424         (KJS::UString::UString):
3425         (KJS::UString::append):
3426         (KJS::UString::operator=):
3427         (KJS::UString::substr):
3428         * kjs/ustring.h:
3429         (KJS::UString::Rep::data):
3430
3431 2004-04-13  Maciej Stachowiak  <mjs@apple.com>
3432
3433         Reviewed by Darin.
3434
3435         - fixed <rdar://problem/3600695>: String manipulation in JavaScript 24fun test is very slow (slow)
3436         - fixed <rdar://problem/3600691>: Table generation test is really slow
3437         - fixed <rdar://problem/3600661>: 24fun date test is really slow
3438
3439         80% speedup on the string test, lesser speedups on the other two.
3440         
3441         Two different optimizations here:
3442
3443         1) Avoid large overhead of scanning strings to see if they are all
3444         ASCII before numeric conversion.
3445         
3446         * kjs/nodes.cpp:
3447         (AssignNode::evaluate): Don't convert to integer until we know for
3448         sure the operation will need it. Attempting to convert strings to
3449         numbers is a waste when they are being appended with +=.
3450
3451         2) Avoid huge cost of appending strings.
3452
3453         This is done by allowing multiple strings to share a buffer but
3454         actually use different ranges of it. The first time a string is
3455         appended to, we start leaving at least 10% extra space in the
3456         buffer, so doing N appends to the same string takes O(log N)
3457         mallocs instead of O(N).
3458         
3459         * kjs/identifier.cpp:
3460         (KJS::Identifier::equal):
3461         (KJS::Identifier::add):
3462         * kjs/ustring.cpp:
3463         (KJS::):
3464         (KJS::UCharReference::operator=):
3465         (KJS::UCharReference::ref):
3466         (KJS::UString::Rep::create):
3467         (KJS::UString::Rep::destroy):
3468         (KJS::UString::expandedSize):
3469         (KJS::UString::usedCapacity):
3470         (KJS::UString::expandCapacity):
3471         (KJS::UString::UString):
3472         (KJS::UString::null):
3473         (KJS::UString::append):
3474         (KJS::UString::operator=):
3475         (KJS::UString::toStrictUInt32):
3476         (KJS::UString::detach):
3477         (KJS::KJS::operator==):
3478         * kjs/ustring.h:
3479         (KJS::UString::Rep::data):
3480         (KJS::UString::Rep::hash):
3481
3482 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
3483
3484         Reviewed by John.
3485
3486         - fix deployment build by avoiding deployment-only warning.
3487
3488         * kjs/scope_chain.cpp:
3489         (KJS::ScopeChain::bottom):
3490
3491 2004-04-09  Maciej Stachowiak  <mjs@apple.com>
3492
3493         Reviewed by John.
3494
3495         Changed things so that newly created objects get a prototype based
3496         on the scope chain of the current function, rather than the
3497         interpreter that started execution. This fixes the following bugs:
3498         
3499         <rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
3500         <rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)
3501
3502         * JavaScriptCore.pbproj/project.pbxproj:
3503         * kjs/array_object.cpp:
3504         (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
3505         (ArrayProtoFuncImp::ArrayProtoFuncImp):
3506         (ArrayProtoFuncImp::call):
3507         (ArrayObjectImp::construct):
3508         * kjs/bool_object.cpp:
3509         (BooleanObjectImp::construct):
3510         * kjs/date_object.cpp:
3511         (DateProtoFuncImp::DateProtoFuncImp):
3512         (DateProtoFuncImp::call):
3513         (DateObjectImp::construct):
3514         * kjs/error_object.cpp:
3515         (ErrorObjectImp::construct):
3516         * kjs/function.cpp:
3517         (FunctionImp::FunctionImp):
3518         (FunctionImp::call):
3519         (DeclaredFunctionImp::construct):
3520         (ArgumentsImp::ArgumentsImp):
3521         (GlobalFuncImp::call):
3522         * kjs/function_object.cpp:
3523         (FunctionProtoFuncImp::call):
3524         (FunctionObjectImp::construct):
3525         * kjs/internal.cpp:
3526         (BooleanImp::toObject):
3527         (StringImp::toObject):
3528         (NumberImp::toObject):
3529         (InterpreterImp::InterpreterImp):
3530         (InterpreterImp::clear):
3531     &