2008-06-03 Maciej Stachowiak <mjs@apple.com>
[WebKit.git] / JavaScriptCore / ChangeLog
1 2008-06-03  Maciej Stachowiak  <mjs@apple.com>
2
3         Reviewed by Oliver.
4
5         * VM/Machine.cpp:
6         (KJS::Machine::privateExecute): Document throw and catch opcodes.
7
8 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
9
10         Reviewed by Alexey Proskuryakov.
11
12         Removed JSObject::call, since it just called JSObject::callAsFunction.
13
14         SunSpider reports no change.
15
16 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
17
18         Reviewed by Darin Adler.
19         
20         A little cleanup in the CodeGenerator.
21
22         * VM/CodeGenerator.cpp: A few changes here.
23
24         (1) Removed remaining cases of the old hack of putting "this" into the
25         symbol table; replaced with explicit tracking of m_thisRegister.
26
27         (2) Made m_thisRegister behave the same for function, eval, and program
28         code, removing the static programCodeThis() function.
29
30         (3) Added a feature to nix a ScopeNode's declaration stacks when done
31         compiling, to save memory.
32
33         (4) Removed code that copied eval declarations into special vectors: we
34         just use the originals in the ScopeNode now.
35         
36         * VM/CodeGenerator.h: Removed unneded parameters from the CodeGenerator
37         constructor: we just use get that data from the ScopeNode now.
38
39         * VM/Machine.cpp:
40         (KJS::Machine::execute): When executing an eval node, don't iterate a
41         special copy of its declarations; iterate the originals, instead.
42
43         * kjs/nodes.cpp: Moved responsibility for knowing what AST data to throw
44         away into the CodeGenerator. Nodes no longer call shrinkCapacity on
45         their data directly.
46         
47         * kjs/nodes.h: Changed FunctionStack to ref its contents, so declaration
48         data stays around even after we've thrown away the AST, unless we explicitly
49         throw away the declaration data, too. This is useful for eval code, which
50         needs to reference its declaration data at execution time. (Soon, it will
51         be useful for program code, too, since program code should do the same.)
52
53 2008-06-02  Adam Roben  <aroben@apple.com>
54
55         Build fix for non-AllInOne builds
56
57         * kjs/array_object.cpp: Added a missing #include.
58
59 2008-06-02  Kevin McCullough  <kmccullough@apple.com>
60
61         Took out accidental confilct lines I checked in.
62
63         * ChangeLog:
64
65 2008-06-02  Kevin McCullough  <kmccullough@apple.com>
66
67         Reviewed by Darin.
68
69         <rdar://problem/5969992> JSProfiler: Remove the recursion limit in the
70         profiler
71         Implement Next Sibling pointers as groundwork for removing the recursion
72         limit in the profiler.
73
74         * profiler/ProfileNode.cpp: Also I renamed parentNode and headNode since
75         'node' is redundant.
76         (KJS::ProfileNode::ProfileNode): Initialize the nextSibling.
77         (KJS::ProfileNode::willExecute): If there are already children then the
78         new child needs to be the nextSibling of the last child.
79         (KJS::ProfileNode::didExecute):
80         (KJS::ProfileNode::addChild): Ditto.
81         (KJS::ProfileNode::stopProfiling):
82         (KJS::ProfileNode::sortTotalTimeDescending): For all of the sorting
83         algorithms once the children are sorted their nextSibling pointers need
84         to be reset to reflect the new order.
85         (KJS::ProfileNode::sortTotalTimeAscending):
86         (KJS::ProfileNode::sortSelfTimeDescending):
87         (KJS::ProfileNode::sortSelfTimeAscending):
88         (KJS::ProfileNode::sortCallsDescending):
89         (KJS::ProfileNode::sortCallsAscending):
90         (KJS::ProfileNode::sortFunctionNameDescending):
91         (KJS::ProfileNode::sortFunctionNameAscending):
92         (KJS::ProfileNode::resetChildrensSiblings): This new function simply
93         loops over all of the children and sets their nextSibling pointers to
94         the next child in the Vector
95         (KJS::ProfileNode::debugPrintData):
96         * profiler/ProfileNode.h:
97         (KJS::ProfileNode::parent):
98         (KJS::ProfileNode::setParent):
99         (KJS::ProfileNode::nextSibling):
100         (KJS::ProfileNode::setNextSibling):
101         (KJS::ProfileNode::totalPercent):
102         (KJS::ProfileNode::selfPercent):
103
104 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
105
106         Reviewed by Maciej Stachowiak.
107
108         Removed the recursion limit from JSObject::call, since the VM does
109         recursion checking now.
110
111         This should allow us to remove JSObject::call entirely, netting a small
112         speedup.
113
114         * kjs/object.cpp:
115         (KJS::JSObject::call):
116
117 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
118
119         Reviewed by Adele Peterson.
120
121         Added a specific affordance for avoiding stack overflow when converting
122         recursive arrays to string, in preparation for removing generic stack
123         overflow checking from JSObject::call.
124         
125         Tested by fast/js/toString-stack-overflow.html.
126
127 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
128
129         Reviewed by Alice Liu.
130         
131         Refactored some hand-rolled code to call ScopeChain::globalObject instead.
132
133 2008-06-02  Geoffrey Garen  <ggaren@apple.com>
134
135         Reviewed by Darin Adler.
136         
137         Fixed ASSERT due to execution continuing after an exception is thrown
138         during array sort.
139
140         * kjs/array_instance.cpp:
141         (KJS::AVLTreeAbstractorForArrayCompare::compare_key_key): Don't call the
142         custom comparator function if an exception has been thrown. Just return
143         1 for everything, so the sort completes quickly. (The result will be
144         thrown away.)
145
146 2008-05-30  Timothy Hatcher  <timothy@apple.com>
147
148         Made the starting line number of scripts be 1-based throughout the engine.
149         This cleans up script line numbers so they are all consistent now and fixes
150         some cases where script execution was shown as off by one line in the debugger.
151
152         No change in SunSpider.
153
154         Reviewed by Oliver Hunt.
155
156         * API/minidom.c:
157         (main): Pass a line number of 1 instead of 0 to parser().parse().
158         * API/testapi.c:
159         (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
160         to use 1 instead of 2 for the line number.
161         * VM/Machine.cpp:
162         (KJS::callEval): Pass a line number of 1 instead of 0.
163         (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
164         lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
165         * kjs/DebuggerCallFrame.cpp:
166         (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
167         0 to parser().parse().
168         * kjs/Parser.cpp:
169         (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
170         the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
171         for release builds to maintain compatibility with the JavaScriptCore API.
172         * kjs/function.cpp:
173         (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
174         * kjs/function_object.cpp:
175         (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
176         * kjs/lexer.cpp:
177         (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
178         * kjs/testkjs.cpp:
179         (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
180         (functionLoad): Ditto.
181         (prettyPrintScript): Ditto.
182         (runWithScripts): Ditto.
183         * profiler/Profiler.cpp:
184         (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
185
186 2008-05-30  Alexey Proskuryakov  <ap@webkit.org>
187
188         Reviewed by Darin.
189
190         https://bugs.webkit.org/show_bug.cgi?id=19180
191         speed up SunSpider by optimizing immediate number cases
192
193         Also fixed a JavaScriptCore regression seen on PowerPC - we didn't clip left shift
194         parameter to 0...31.
195
196         0.5% improvement on SunSpider overall, although a 8.5 regression on bitops-3bit-bits-in-byte.
197
198         * VM/Machine.cpp:
199         (KJS::Machine::privateExecute):
200
201         * kjs/JSImmediate.h:
202         (KJS::JSImmediate::toTruncatedUInt32): Added. Same as getTruncatedInt32, but casts the result
203         to unsigned.
204
205 2008-05-30  Alexey Proskuryakov  <ap@webkit.org>
206
207         Reviewed by Oliver Hunt.
208
209         https://bugs.webkit.org/show_bug.cgi?id=19180
210         speed up SunSpider by optimizing immediate number cases
211
212         Also fixed two JavaScriptCore regressions seen on PowerPC - we didn't clip right shift
213         parameter to 0...31.
214
215         1.6% improvement on SunSpider, without significant regressions on any tests.
216
217         * VM/Machine.cpp:
218         (KJS::Machine::privateExecute):
219         Added fast paths for >>, ==, ===, !=, !==. Changed order of memory accesses in many
220         cases, making them less dependent on gcc's ability to properly assign registers. With this,
221         I could move exception checks back into slow code paths, and saw less randomness in general.
222
223         * kjs/JSImmediate.h:
224         (KJS::JSImmediate::rightShiftImmediateNumbers):
225         Added.
226
227 2008-05-29  Maciej Stachowiak  <mjs@apple.com>
228
229         Reviewed by Oliver.
230
231         - fixed <rdar://problem/5972943> REGRESSION(r33979): Flash clips do not play on cnn.com
232         
233         Finally blocks could clobber registers that had to remain live
234         until they returned. This patch takes a conservative approach and
235         makes sure that finally blocks do not reuse any registers that
236         were previously allocated for the function. In the future this
237         could probably be tightened up to be less profligate with the
238         register allocation.
239         
240         * VM/CodeGenerator.cpp:
241         (KJS::CodeGenerator::highestUsedRegister):
242         * VM/CodeGenerator.h:
243         * kjs/nodes.cpp:
244         (KJS::TryNode::emitCode):
245
246 2008-05-29  Steve Falkenburg  <sfalken@apple.com>
247
248         Build fix.
249
250         * kjs/array_instance.cpp:
251
252 2008-05-29  Alexey Proskuryakov  <ap@webkit.org>
253
254         Reviewed by Darin.
255
256         https://bugs.webkit.org/show_bug.cgi?id=19294
257         <rdar://problem/5969062> A crash when iterating over a sparse array backwards.
258
259         * kjs/array_instance.cpp: Turned sparseArrayCutoff into a macro, so that using max() on it
260         doesn't cause a PIC branch.
261         (KJS::ArrayInstance::increaseVectorLength): Added a comment about this function not
262         preserving class invariants.
263         (KJS::ArrayInstance::put): Update m_storage after reallocation. Move values that fit to
264         the vector from the map in all code paths.
265
266 2008-05-29  Thiago Macieira  <tjmaciei@trolltech.com>
267
268         Reviewed by Simon.
269
270         Fix compilation in Solaris with Sun CC
271
272         Lots of WebKit code uses C99 functions that, strict as it
273         is, the Solaris system doesn't provide in C++. So we must define them
274         for both GCC and the Sun CC.
275
276         * wtf/MathExtras.h:
277
278 2008-05-28  Oliver Hunt  <oliver@apple.com>
279
280         Reviewed by Anders.
281
282         Fix codegen for assignment being used as a function.
283
284         FunctionCallValueNode::emitCode failed to account for the
285         potential of the function expression to allocate arbitrary
286         registers.
287
288         * kjs/nodes.cpp:
289         (KJS::FunctionCallValueNode::emitCode):
290
291 2008-05-27  Geoffrey Garen  <ggaren@apple.com>
292
293         Reviewed by Tim Hatcher.
294
295         Fixed https://bugs.webkit.org/show_bug.cgi?id=19183
296         REGRESSION (r33979): Crash in DebuggerCallFrame::functionName when
297         clicking button in returnEvent-crash.html
298
299         Added two new debugger hooks, willExecuteProgram and didExecuteProgram,
300         along with code to generate them, code to invoke them when unwinding
301         due to an exception, and code to dump them.
302         
303         SunSpider reports no change.
304
305         * VM/CodeBlock.cpp:
306         (KJS::debugHookName): I had to mark this function NEVER_INLINE to avoid
307         a .4% performance regression. The mind boggles.
308
309 2008-05-28  Adam Roben  <aroben@apple.com>
310
311         Fix JavaScriptCore tests on OS X
312
313         We were quoting the path to testkjs too late, after it had already
314         been combined with spaces and other options.
315
316         * tests/mozilla/jsDriver.pl:
317         (top level): Move path quoting from here...
318         (sub get_kjs_engine_command): ...to here.
319
320 2008-05-28  Anders Carlsson  <andersca@apple.com>
321
322         Reviewed by Oliver.
323
324         <rdar://problem/5968071> "const f" crashes in JavaScriptCore
325         
326         Make sure to null check the initializer.
327         
328         * kjs/nodes.cpp:
329         (KJS::ConstDeclNode::emitCodeSingle):
330
331 2008-05-28  Adam Roben  <aroben@apple.com>
332
333         Make run-javascriptcore-tests work with a space in the path to testkjs
334
335         Reviewed by Alexey Proskuryakov.
336
337         * tests/mozilla/jsDriver.pl: Quote the path to the engine so that
338         spaces will be interpreted correctly.
339
340 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
341
342         Fixed a misguiding comment - my measurement for negative numbers only included cases
343         where both operands were negative, which is not very interesting.
344
345         * VM/Machine.cpp:
346
347 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
348
349         Reviewed by Maciej.
350
351         Based on a patch by Oliver Hunt.
352
353         https://bugs.webkit.org/show_bug.cgi?id=19180
354         speed up SunSpider by optimizing immediate number cases
355
356         1.4% speedup on SunSpider.
357
358         * VM/Machine.cpp:
359         (KJS::Machine::privateExecute):
360         * kjs/JSImmediate.h:
361         (KJS::JSImmediate::incImmediateNumber):
362         (KJS::JSImmediate::decImmediateNumber):
363         Added fast paths for ++ and --.
364
365         (KJS::JSImmediate::canDoFastAdditiveOperations): Corrected a comment.
366
367 2008-05-28  Alexey Proskuryakov  <ap@webkit.org>
368
369         Reviewed by Darin.
370
371         https://bugs.webkit.org/show_bug.cgi?id=19180
372         speed up SunSpider by optimizing immediate number cases
373
374         2% speedup overall, maximum 10% on controlflow-recursive and bitops-3bit-bits-in-byte,
375         but a 4% regression on bitops-bits-in-byte and bitops-bitwise-and.
376
377         * kjs/JSImmediate.h:
378         (KJS::JSImmediate::canDoFastAdditiveOperations):
379         (KJS::JSImmediate::addImmediateNumbers):
380         (KJS::JSImmediate::subImmediateNumbers):
381         Added fast cases that work with positive values less than 2^30.
382
383         * VM/Machine.cpp:
384         (KJS::Machine::privateExecute): Use the above operations. Also updated SunSpider frequencies
385         with my results (looks like tag values have changed, not sure what caused the minor variation
386         in actual frequencies).
387
388 2008-05-27  Adam Roben  <aroben@apple.com>
389
390         Windows build fix
391
392         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make:
393         Remove code that appended Cygwin's /bin directory to PATH.
394         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj:
395         Prepend Cygwin's /bin directory to PATH. We prepend instead of append
396         so that Cygwin's utilities will win out over Win32 versions of the
397         same utilities (particularly perl). We do the prepend here instead of
398         in the Makefile because nmake doesn't seem to like prepending to PATH
399         inside the Makefile. This also matches the way WebCoreGenerated works.
400
401 2008-05-27  Adam Roben  <aroben@apple.com>
402
403         Roll out r34163
404
405         A better fix is on the way.
406
407         * DerivedSources.make:
408         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
409
410 2008-05-27  Adam Roben  <aroben@apple.com>
411
412         Windows build fix
413
414         * DerivedSources.make: Don't generate the bytecode docs if
415         OMIT_BYTECODE_DOCS is set to 1.
416         * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Set
417         OMIT_BYTECODE_DOCS for production builds.
418
419 2008-05-27  Anders Carlsson  <andersca@apple.com>
420
421         Reviewed by Geoff and Maciej.
422
423         <rdar://problem/5806428> 
424         https://bugs.webkit.org/show_bug.cgi?id=17925
425         Crash in KJS::JSObject::put after setting this.__proto__
426
427         Set slotIsWriteable to false for __proto__, we want setting __proto__ to go through JSObject::put instead.
428         
429         * kjs/object.h:
430         (KJS::JSObject::getOwnPropertySlotForWrite):
431
432 2008-05-27  Kevin Ollivier  <kevino@theolliviers.com>
433
434         wx build fixes to catch up with SquirrelFish, etc.
435
436         * JavaScriptCoreSources.bkl:
437         * jscore.bkl:
438         * wtf/Platform.h:
439
440 2008-05-27  Darin Adler  <darin@apple.com>
441
442         Reviewed by Tim Hatcher.
443
444         - https://bugs.webkit.org/show_bug.cgi?id=19180
445           speed up SunSpider by optimizing immediate number cases
446
447         Add immediate number cases for the &, |, and ^ operators.
448         Makes standalone SunSpider 1.010x faster.
449
450         * VM/Machine.cpp:
451         (KJS::Machine::privateExecute): Add areBothImmediateNumbers special cases
452         for the &, |, and ^ operators.
453
454         * kjs/JSImmediate.h:
455         (KJS::JSImmediate::xorImmediateNumbers): Added.
456         (KJS::JSImmediate::orImmediateNumbers): Added.
457
458 2008-05-26  Stephanie Lewis  <slewis@apple.com>
459
460         Windows build fix. 
461
462         * kjs/testkjs.cpp:
463
464 2008-05-26  Maciej Stachowiak  <mjs@apple.com>
465
466         Reviewed by Anders.
467         
468         - make addStaticGlobals protected instead of private so subclasses can use it
469
470         * JavaScriptCore.exp:
471         * kjs/JSGlobalObject.h:
472
473 2008-05-26  Geoffrey Garen  <ggaren@apple.com>
474
475         Reviewed by Darin Adler.
476         
477         Fixed <rdar://problem/5960859> After an eval of a non-string or a syntax
478         error, all profile stack frames are incorrect
479         
480         SunSpider reports a .3% speedup, possibly because eval of a string is a
481         little more efficient now.
482
483         * VM/Machine.cpp:
484         (KJS::callEval): Make sure to call didExecute when returning early. I
485         simplified this function to remove one early return, making the job
486         of adding special code to early returns easier.
487
488         (KJS::Machine::execute): Use the new function ExecState when notifying
489         the profiler. (This doesn't change behavior now, but it might prevent
490         subtle errors in the future.)
491
492 2008-05-23  Tor Arne Vestbø  <tavestbo@trolltech.com>
493
494         Reviewed by Simon.
495
496         Fixed toLower and toUpper implementations to allow being called
497         with a null result pointer and resultLength, to determine the
498         number of characters needed for the case conversion.
499
500         * wtf/unicode/qt4/UnicodeQt4.h:
501         (WTF::Unicode::toLower):
502         (WTF::Unicode::toUpper):
503
504 2008-05-25  Alexey Proskuryakov  <ap@webkit.org>
505
506         Fixing a typo in the previous commit made as a last minute change.
507
508         * kjs/regexp_object.cpp:
509
510 2008-05-24  Alexey Proskuryakov  <ap@webkit.org>
511
512         Reviewed by Darin.
513
514         Changed regular expression matching result array to be lazily filled, because many callers
515         only care about it being non-null.
516
517         2% improvement on Acid3 test 26.
518
519         * kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses
520         to use.
521         * kjs/array_instance.h:
522         (KJS::ArrayInstance::lazyCreationData):
523         (KJS::ArrayInstance::setLazyCreationData):
524         Added methods to access it from subclasses.
525
526         * kjs/regexp_object.cpp:
527         (KJS::RegExpMatchesArray::RegExpMatchesArray):
528         (KJS::RegExpMatchesArray::getOwnPropertySlot):
529         (KJS::RegExpMatchesArray::put):
530         (KJS::RegExpMatchesArray::deleteProperty):
531         (KJS::RegExpMatchesArray::getPropertyNames):
532         (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded):
533         (KJS::RegExpMatchesArray::~RegExpMatchesArray):
534         (KJS::RegExpObjectImp::arrayOfMatches):
535         RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until
536         accessed for the first time.
537
538 2008-05-24  Alp Toker  <alp@nuanti.com>
539
540         Win32/gcc build fix. Remove MSVC assumption.
541
542         * wtf/TCSpinLock.h:
543         (TCMalloc_SlowLock):
544
545 2008-05-24  Oleg Finkelshteyn <olegfink@gmail.com>
546
547         Rubber-stamped, tweaked and landed by Alexey.
548
549         Build fix for gcc 4.3.
550
551         * JavaScriptCore/kjs/testkjs.cpp:
552         * JavaScriptCore/VM/CodeBlock.cpp:
553         Add missing standard includes.
554
555 2008-05-23  Anders Carlsson  <andersca@apple.com>
556
557         Reviewed by Geoff.
558
559         <rdar://problem/5959886> REGRESSION: Assertion failure in JSImmediate::toString when loading GMail (19217)
560         
561         Change List to store a JSValue*** pointer + an offset instead of a JSValue** pointer to protect against the case where 
562         a register file changes while a list object points to its buffer.
563         
564         * VM/Machine.cpp:
565         (KJS::Machine::privateExecute):
566         * kjs/JSActivation.cpp:
567         (KJS::JSActivation::createArgumentsObject):
568         * kjs/list.cpp:
569         (KJS::List::getSlice):
570         * kjs/list.h:
571         (KJS::List::List):
572         (KJS::List::at):
573         (KJS::List::append):
574         (KJS::List::begin):
575         (KJS::List::end):
576         (KJS::List::buffer):
577
578 2008-05-23  Kevin McCullough  <kmccullough@apple.com>
579
580         Reviewed by Sam.
581
582         <rdar://problem/5960012> JSProfiler: Stack overflow if recursion is
583         too deep.
584         -Use a simple depth limit to restrict too deep of recursion.
585
586         * profiler/Profile.cpp:
587         (KJS::Profile::willExecute):
588         (KJS::Profile::didExecute):
589         * profiler/Profile.h:
590
591 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
592
593         Rolling back in r34085, with performance resolved.
594         
595         Apparently, passing the eval function to callEval gave GCC a hernia.
596
597         Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.
598         
599         Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
600         JavaScript profiler
601
602         * VM/Machine.cpp:
603         (KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
604         when unwinding from inside eval and/or program code: detect the
605         difference, and do the right thing. Also, be sure to notify the profiler
606         *before* deref'ing the scope chain, since the profiler uses the scope chain.
607
608         (KJS::Machine::execute): Fixed incorrect reporting / crash when calling
609         a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
610         should not invoke the didExecute hook, because op_ret already does that.
611         Also, use the new function's ExecState when calling out to the profiler.
612         (Not important now, but could have become a subtle bug later.)
613
614         (KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
615         profiling JS functions: notify the profiler *before* deref'ing the scope
616         chain, since the profiler uses the scope chain.
617
618         * kjs/object.cpp:
619         (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
620
621         * profiler/Profile.cpp: Added a comment to explain a subtlety that only
622         Kevin and I understood previously. (Now, the whole world can understand!)
623
624         * profiler/Profiler.cpp:
625         (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was
626         a hack to fix bugs that no longer exist.
627
628         Finally, sped things up a little bit by changing the "Is the profiler
629         running?" check into an ASSERT, since we only call into the profiler
630         when it's running:
631
632         (KJS::Profiler::willExecute):
633         (KJS::Profiler::didExecute):
634
635 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
636
637         Reviewed by Oliver Hunt.
638
639         - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
640         
641         SunSpider reports no change.
642         
643         This is a reworking of r34073, which I rolled out because it caused
644         lots of crashes.
645
646         * VM/CodeGenerator.cpp:
647         (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
648         properties whose names collide with new functions. (Don't use putWithAttributes
649         because that tries to write to the register file, which hasn't grown to
650         fit this program yet.)
651
652 2008-05-23  Darin Adler  <darin@apple.com>
653
654         Reviewed by Mark Rowe.
655
656         As allocateNumber is used via jsNumberCell outside of JavaScriptCore,
657         we need to provide a non-inlined version of it to avoid creating a
658         weak external symbol.
659
660         * JavaScriptCore.exp:
661         * kjs/AllInOneFile.cpp:
662         * kjs/collector.cpp:
663         (KJS::Collector::allocate):
664         (KJS::Collector::allocateNumber):
665         * kjs/collector.h:
666         (KJS::Collector::allocate):
667         (KJS::Collector::inlineAllocateNumber):
668         * kjs/value.h:
669         (KJS::NumberImp::operator new):
670
671 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
672
673         Rolled out r34073 because it caused lots of layout test crashes.
674
675 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
676
677         Rolled out r34085 because it measured as a 7.6% performance regression.
678
679 2008-05-23  Adam Roben  <aroben@apple.com>
680
681         Windows build fix
682
683         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add the
684         profiler directory to the include path.
685
686 2008-05-23  Oliver Hunt  <oliver@apple.com>
687
688         Reviewed by Anders.
689
690         SQUIRRELFISH: JavaScript error messages are missing informative text
691
692         Partial fix.
693         Tidy up error messages, makes a couple of them provide slightly more info.
694         Inexplicably leads to a 1% SunSpider Progression.
695
696         * VM/ExceptionHelpers.cpp:
697         (KJS::createError):
698         (KJS::createInvalidParamError):
699         (KJS::createNotAConstructorError):
700         (KJS::createNotAFunctionError):
701         * VM/ExceptionHelpers.h:
702         * VM/Machine.cpp:
703         (KJS::isNotObject):
704
705 2008-05-23  Oliver Hunt  <oliver@apple.com>
706
707         Reviewed by Tim H.
708
709         Fix call stack reported by profiler when entering event handlers.
710
711         JSObject::call was arbitrarily notifying the profiler when it was
712         called, even if it was JS code, which notifies the profile on entry
713         in any case.
714
715         * kjs/object.cpp:
716         (KJS::JSObject::call):
717
718 2008-05-16  Alp Toker  <alp@nuanti.com>
719
720         Build fix for gcc 3. Default constructor required in ExecState,
721         used by OldInterpreterExecState.
722
723         * kjs/ExecState.h:
724         (KJS::ExecState::ExecState):
725
726 2008-05-23  Mark Rowe  <mrowe@apple.com>
727
728         Reviewed by Oliver Hunt.
729
730         Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.
731
732         Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
733         register file may be too close to its maximum size to grow successfully.  By using grow,
734         checking the result and throwing a stack overflow error we can avoid crashing.
735
736         * VM/Machine.cpp:
737         (KJS::Machine::execute):
738         * VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
739
740 2008-05-23  Oliver Hunt  <oliver@apple.com>
741
742         RS=Kevin McCullough
743
744         Remove JAVASCRIPT_PROFILER define
745
746         * VM/Machine.cpp:
747         (KJS::callEval):
748         (KJS::Machine::unwindCallFrame):
749         (KJS::Machine::execute):
750         (KJS::Machine::privateExecute):
751         * kjs/config.h:
752         * kjs/object.cpp:
753         (KJS::JSObject::call):
754
755 2008-05-23  Oliver Hunt  <oliver@apple.com>
756
757        <rdar://problem/5951561> Turn on JavaScript Profiler
758
759         Reviewed by Kevin McCullough.
760
761         Flipped the switch on the profiler, rearranged how we
762         signal the the profiler is active so that calls aren't
763         needed in the general case.
764         
765         Also fixed the entry point for Machine::execute(FunctionBodyNode..)
766         to correctly indicate function exit.
767
768         Results in a 0.7-1.0% regression in SunSpider :-(
769
770         * VM/Machine.cpp:
771         (KJS::callEval):
772         (KJS::Machine::unwindCallFrame):
773         (KJS::Machine::execute):
774         (KJS::Machine::privateExecute):
775         * kjs/config.h:
776         * profiler/Profiler.cpp:
777         (KJS::Profiler::profiler):
778         (KJS::Profiler::startProfiling):
779         (KJS::Profiler::stopProfiling):
780         * profiler/Profiler.h:
781         (KJS::Profiler::enabledProfilerReference):
782
783 2008-05-23  Simon Hausmann  <hausmann@webkit.org>
784
785         Fix the Qt build by adding profiler/ to the include search path.
786
787         * JavaScriptCore.pri:
788
789 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
790
791         Reviewed by Adam.
792
793         Fix a bug in the profiler where time in the current function is given to
794         (idle).
795
796         * profiler/Profile.cpp:
797         (KJS::Profile::didExecute): Set the start time and then call didExecute
798         to calculate the time spent in this function.
799         * profiler/ProfileNode.cpp: Remove confusing calculations that are no
800         longer necessary.
801         (KJS::ProfileNode::insertNode):
802         * profiler/ProfileNode.h: Expose access to the start time to allow the
803         simpler time calculations above.
804         (KJS::ProfileNode::startTime):
805         (KJS::ProfileNode::setStartTime):
806
807 2008-05-22  Adam Roben  <aroben@apple.com>
808
809         Show "(Function object)" instead of "(JSInpectorCallbackWrapper
810         object)" in profiles
811
812         Reviewed by Kevin McCullough.
813
814         * profiler/Profiler.cpp:
815         (KJS::createCallIdentifier): Use JSObject::className instead of
816         getting the class name from the ClassInfo directly. JSObject
817         subclasses can override className to provide a custom class name, and
818         it seems like we should honor that.
819
820 2008-05-22  Timothy Hatcher  <timothy@apple.com>
821
822         Added Profile::restoreAll and added ProfileNode::restoreAll
823         to the export file.
824
825         Reviewed by Adam Roben.
826
827         * JavaScriptCore.exp:
828         * profiler/Profile.h:
829
830 2008-05-22  Alp Toker  <alp@nuanti.com>
831
832         GTK+ build fix. Add JavaScriptCore/profiler to include path.
833
834         * GNUmakefile.am:
835
836 2008-05-22  Adam Roben  <aroben@apple.com>
837
838         Implement sub-millisecond profiling on Windows
839
840         Reviewed by Kevin McCullough.
841
842         * profiler/ProfileNode.cpp:
843         (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
844         other platforms, we use getCurrentUTCTimeWithMicroseconds.
845         (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
846         getCurrentUTCTimeWithMicroseconds.
847         (KJS::ProfileNode::startTimer): Ditto.
848
849 2008-05-22  Adam Roben  <aroben@apple.com>
850
851         Fix a profiler assertion when calling a NodeList as a function
852
853         Reviewed by Kevin McCullough.
854
855         * profiler/Profiler.cpp:
856         (KJS::createCallIdentifier): Don't assert when a non-function object
857         is called as a function. Instead, build up a CallIdentifier using the
858         object's class name.
859
860 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
861
862         Reviewed by Darin.
863
864         <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
865         profile node.
866         -Implement 'exclude'; where the excluded node attributes its time to its
867         parent's self time.
868
869         * JavaScriptCore.exp: Export the exclude function.
870         * profiler/Profile.h: 
871         (KJS::Profile::exclude):
872         * profiler/ProfileNode.cpp: 
873         (KJS::ProfileNode::setTreeVisible): New function that allows a change in
874         visiblitiy to be propogated to all the children of a node.
875         (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
876         set the visiblity of this node and all of its children to false and
877         attribute it's total time to it's caller's self time.
878         * profiler/ProfileNode.h:
879
880 2008-05-22  Mark Rowe  <mrowe@apple.com>
881
882         Reviewed by Oliver Hunt.
883
884         Fix access to static global variables in Windows release builds.
885
886         * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
887         in GlobalPropertyInfo as the Identifier is likely to be a temporary
888         and therefore may be destroyed before the GlobalPropertyInfo.
889
890 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
891
892         Build fix.
893
894         * VM/Machine.cpp:
895         (KJS::callEval):
896
897 2008-05-22  Kevin McCullough  <kmccullough@apple.com>
898
899         Reviewed by Sam.
900
901         <rdar://problem/5951561> Turn on JavaScript Profiler
902         Get basic JS profiling working.
903         Even with this patch the profiler will not be compiled in because we do
904         not know the extend, if any, of the performance regression it would cause
905         when it is not in use. However with these changes, if the profiler were
906         on, it would not crash and show good profiling data.
907
908         * VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
909         (KJS::callEval):
910         (KJS::Machine::unwindCallFrame):
911         (KJS::Machine::execute):
912         (KJS::Machine::privateExecute):
913         * kjs/function.cpp: Ditto.
914         (KJS::globalFuncEval):
915         * kjs/interpreter.cpp: Ditto.
916         (KJS::Interpreter::evaluate):
917         * profiler/Profile.cpp: 
918         (KJS::Profile::willExecute):
919         (KJS::Profile::didExecute): Because we do not get a good context when
920         startProfiling is called it is possible that m_currentNode will be at the
921         top of the known stack when a didExecute() is called.  What we then do is
922         create a new node that represents the function being exited and insert
923         it between the head and the currently known children, since they should
924         be children of this new node.
925         * profiler/ProfileNode.cpp:
926         (KJS::ProfileNode::ProfileNode):
927         (KJS::ProfileNode::willExecute): Rename the add function for consistency.
928         (KJS::ProfileNode::addChild): Appends the child to this node but also
929         sets the parent pointer of the children to this node.
930         (KJS::ProfileNode::insertNode): Insert a node between this node and its
931         children.  Also set the time for the new node since it is now exiting
932         and we don't really know when it started.
933         (KJS::ProfileNode::stopProfiling):
934         (KJS::ProfileNode::startTimer):
935         * profiler/ProfileNode.h:
936         (KJS::CallIdentifier::toString): Added for debugging.
937         (KJS::ProfileNode::setParent):
938         (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
939         visibleTotalTime not the visibleSelfTime.
940         (KJS::ProfileNode::children):
941         (KJS::ProfileNode::toString): Added for debugging.
942         * profiler/Profiler.cpp: remove unecessary calls.
943         (KJS::Profiler::startProfiling):
944
945 2008-05-22  Sam Weinig  <sam@webkit.org>
946
947         Reviewed by Oliver Hunt.
948
949         Rename register arguments for op_call, op_call_eval, op_end, and op_construct 
950         to document what they are for.
951
952         * VM/CodeGenerator.cpp:
953         (KJS::CodeGenerator::emitCall):
954         (KJS::CodeGenerator::emitCallEval):
955         (KJS::CodeGenerator::emitEnd):
956         (KJS::CodeGenerator::emitConstruct):
957         * VM/CodeGenerator.h:
958         * VM/Machine.cpp:
959         (KJS::Machine::privateExecute):
960
961 2008-05-22  Oliver Hunt  <oliver@apple.com>
962
963         Reviewed by Darin.
964
965         Bug 19116: SquirrelFish shouldn't regress on variable lookups
966         <https://bugs.webkit.org/show_bug.cgi?id=19116>
967
968         Last of the multiscope look up optimisations.  This is a wash overall on SunSpider
969         but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
970         ... applied to any non-local var).
971
972         * kjs/nodes.cpp:
973         (KJS::PostIncResolveNode::emitCode):
974         (KJS::PostDecResolveNode::emitCode):
975         (KJS::PreIncResolveNode::emitCode):
976         (KJS::PreDecResolveNode::emitCode):
977         (KJS::ReadModifyResolveNode::emitCode):
978
979 2008-05-22  David Kilzer  <ddkilzer@apple.com>
980
981         <rdar://problem/5954233> Add method to release free memory from FastMalloc
982
983         Patch suggested by Mark Rowe.  Rubber-stamped by Maciej.
984
985         * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
986         * wtf/FastMalloc.cpp:
987         (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
988         system malloc and FastMalloc code paths.
989         * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
990
991 2008-05-22  Oliver Hunt  <oliver@apple.com>
992
993         RS=Maciej.
994
995         Roll out r34020 as it causes recursion tests to fail.
996
997         * kjs/object.cpp:
998         (KJS::JSObject::call):
999
1000 2008-05-22  Oliver Hunt  <oliver@apple.com>
1001
1002         Reviewed by Mark.
1003
1004         Don't leak the SymbolTable when compiling eval code.
1005
1006         * kjs/nodes.cpp:
1007         (KJS::EvalNode::generateCode):
1008
1009 2008-05-22  Simon Hausmann  <hausmann@webkit.org>
1010
1011         Reviewed by Oliver.
1012
1013         Qt build fix.
1014
1015         * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
1016         * VM/LabelID.h: Include limits.h for UINT_MAX.
1017         * wtf/VectorTraits.h: Include memory for std::auto_ptr.
1018
1019 2008-05-22  Geoffrey Garen  <ggaren@apple.com>
1020
1021         Reviewed by Adam Roben.
1022         
1023         Removed the old recursion guard mechanism, since squirrelfish has its
1024         own mechanism. Also removed some old JS call tracing code, since we
1025         have other ways to do that, too.
1026         
1027         SunSpider reports no change.
1028
1029         * kjs/object.cpp:
1030         (KJS::JSObject::call):
1031
1032 2008-05-22  Maciej Stachowiak  <mjs@apple.com>
1033
1034         Reviewed by Oliver.
1035         
1036         - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
1037
1038         * kjs/nodes.cpp:
1039         (KJS::WithNode::emitCode):
1040         (KJS::TryNode::emitCode):
1041
1042 2008-05-21  Kevin McCullough  <kmccullough@apple.com>
1043
1044         Reviewed by Maciej and Geoff.
1045
1046         <rdar://problem/5951561> Turn on JavaScript Profiler
1047         -As part of the effort to turn on the profiler it would be helpful if it
1048         did not need ExecStates to represent the stack location of the currently
1049         executing statement.
1050         -We now create each node as necessary with a reference to the current
1051         node and each node knows its parent so that the tree can be made without
1052         the entire stack.
1053
1054         * profiler/Profile.cpp:
1055         (KJS::Profile::Profile): The current node starts at the head.
1056         (KJS::Profile::stopProfiling): The current node is cleared when profiling
1057         stops.
1058         (KJS::Profile::willExecute): The current node either adds a new child or
1059         starts and returns a reference to an already existing child if the call
1060         ID that is requested already exists.
1061         (KJS::Profile::didExecute): The current node finishes and returns its
1062         parent.
1063         * profiler/Profile.h: Use a single callIdentifier instead of a vector
1064         since we no longer use the whole stack.
1065         * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
1066         parent.
1067         (KJS::ProfileNode::ProfileNode): Initialize the parent.
1068         (KJS::ProfileNode::didExecute): Record the time and return the parent.
1069         (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
1070         already a child, start it and return it, otherwise create a new one and
1071         return that.
1072         (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
1073         * profiler/ProfileNode.h: Utilize the parent.
1074         (KJS::ProfileNode::create):
1075         (KJS::ProfileNode::parent):
1076         * profiler/Profiler.cpp: 
1077         (KJS::Profiler::startProfiling): Here is the only place where the
1078         ExecState is used to figure out where in the stack the profiler is
1079         currently profiling.
1080         (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
1081         of a vector of them.
1082         (KJS::Profiler::willExecute): Ditto.
1083         (KJS::Profiler::didExecute): Ditto.
1084         (KJS::createCallIdentifier): Create only one CallIdentifier.
1085         (KJS::createCallIdentifierFromFunctionImp): Ditto.
1086         * profiler/Profiler.h:
1087
1088 2008-05-21  Darin Adler  <darin@apple.com>
1089
1090         Reviewed by Maciej.
1091
1092         - https://bugs.webkit.org/show_bug.cgi?id=19180
1093           speed up the < operator for the case when both values are integers
1094
1095         Makes standalone SunSpider 1.022x faster.
1096
1097         * VM/Machine.cpp:
1098         (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
1099
1100 2008-05-21  Maciej Stachowiak  <mjs@apple.com>
1101
1102         Reviewed by Oliver and Sam.
1103         
1104         - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
1105         
1106         Track global this value in the scope chain so we can retrieve it
1107         efficiently but it follows lexical scope properly.
1108
1109         * kjs/ExecState.h:
1110         (KJS::ExecState::globalThisValue):
1111         * kjs/JSGlobalObject.h:
1112         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
1113         * kjs/function_object.cpp:
1114         (KJS::FunctionObjectImp::construct):
1115         * kjs/scope_chain.h:
1116         (KJS::ScopeChainNode::ScopeChainNode):
1117         (KJS::ScopeChainNode::globalThisObject):
1118         (KJS::ScopeChainNode::push):
1119         (KJS::ScopeChain::ScopeChain):
1120
1121 2008-05-21  Kevin McCullough  <kmccullough@apple.com>
1122
1123         Sadness :(
1124
1125         * kjs/config.h:
1126
1127 2008-05-21  Kevin McCullough  <kmccullough@apple.com>
1128
1129         Reviewed by Maciej.
1130
1131         <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
1132         profile node.
1133         - This patch updatest the times of the visible nodes correctly, but to do
1134         so, some of the design of the ProfileNode changed.
1135
1136         * JavaScriptCore.exp: export focus' symbol.
1137         * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
1138         the profile tree to get up-to-date accurate total profile time.
1139         (KJS::Profile::Profile): Pass 0 for the head node.
1140         (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
1141         passed into it, since it can get it from the head and it does not need to
1142         be told it is the head because it can figure it out on it's own.
1143         (KJS::Profile::willExecute): Set the head node for each created node.
1144         * profiler/Profile.h:
1145         (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
1146         would have to create, now focus() takes a ProfileNode that they should
1147         already have a reference to and focus() can extract the CallIdentifier
1148         from it.
1149         * profiler/ProfileNode.cpp: Create actual and visible versions fo the
1150         total and self times for focus and exclude.  Also add a head node
1151         reference so that nodes can get information from their head.
1152         (KJS::ProfileNode::ProfileNode):
1153         (KJS::ProfileNode::stopProfiling): Rename the total and self time
1154         variables and set the visual ones to the actual ones, so that without any
1155         changes to the visual versions of these variables, their times will match
1156         the actual times.
1157         (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
1158         to be visible if this node is visible.  If this node does not match the
1159         CallIdentifier being focused then the visibleTotalTime is only updated if
1160         one or more of it's children is the CallIdentifier being focused. 
1161         (KJS::ProfileNode::restoreAll): Restores all variables with respect to
1162         the visible data in the ProfileNode.
1163         (KJS::ProfileNode::endAndRecordCall): Name change.
1164         (KJS::ProfileNode::debugPrintData): Dump the new variables.
1165         (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
1166         * profiler/ProfileNode.h: Use the new variables and reference to the head
1167         node.
1168         (KJS::ProfileNode::create):
1169         (KJS::ProfileNode::totalTime):
1170         (KJS::ProfileNode::setTotalTime):
1171         (KJS::ProfileNode::selfTime):
1172         (KJS::ProfileNode::setSelfTime):
1173         (KJS::ProfileNode::totalPercent):
1174         (KJS::ProfileNode::selfPercent):
1175         (KJS::ProfileNode::setVisible):
1176
1177 2008-05-21  Alp Toker  <alp@nuanti.com>
1178
1179         GTK+/UNIX testkjs build fix. Include signal.h.
1180
1181         * kjs/testkjs.cpp:
1182
1183 2008-05-21  Oliver Hunt  <oliver@apple.com>
1184
1185         Reviewed by NOBODY (Build fix).
1186
1187         Yet more windows build fixes
1188
1189         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1190
1191 2008-05-21  Oliver Hunt  <oliver@apple.com>
1192
1193         Reviewed by NOBODY (Build fix).
1194
1195         Yet more windows build fixes
1196
1197         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1198
1199 2008-05-21  Alp Toker  <alp@nuanti.com>
1200
1201         GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
1202         changes into account.
1203
1204         * GNUmakefile.am:
1205
1206 2008-05-21  Oliver Hunt  <oliver@apple.com>
1207
1208         Reviewed by NOBODY (Build fix).
1209
1210         Add DebuggerCallFrame.{h,cpp} to the project file
1211
1212         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1213
1214 2008-05-21  Alp Toker  <alp@nuanti.com>
1215
1216         GTK+ port build fixes following squirrelfish merge r33979.
1217
1218         * GNUmakefile.am:
1219
1220 2008-05-21  Maciej Stachowiak  <mjs@apple.com>
1221
1222         Reviewed by Darin.
1223         
1224         - save a hash lookup wne writing to global properties
1225         0.3% speedup on SunSpider, 7% on bitops-bitwise-and
1226
1227         * VM/Machine.cpp:
1228         (KJS::resolveBase): Check for being a the end of the scope chain
1229         before hash lookup.
1230
1231 2008-05-21  Alp Toker  <alp@nuanti.com>
1232
1233         Rubber-stamped by Maciej.
1234
1235         Replace non-standard #pragma marks with comments to avoid compiler
1236         warnings.
1237
1238         * profiler/ProfileNode.cpp:
1239
1240 2008-05-21  Geoffrey Garen  <ggaren@apple.com>
1241
1242         Reviewed by Mark Rowe.
1243
1244         Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
1245
1246         * JavaScriptCore.exp:
1247         * kjs/JSGlobalObject.cpp:
1248         (KJS::JSGlobalObject::defineGetter):
1249         (KJS::JSGlobalObject::defineSetter):
1250         * kjs/JSGlobalObject.h:
1251
1252 === End merge of squirrelfish ===
1253
1254 2008-05-21  Geoffrey Garen  <ggaren@apple.com>
1255
1256         Reviewed by Tim Hatcher.
1257         
1258         Merged with trunk WebCore's new debugger.
1259
1260         * kjs/DebuggerCallFrame.cpp:
1261         (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
1262         the exception value from the return value. The WebKit debugger treats
1263         them as one, but the WebCore debugger doesn't.
1264
1265         * kjs/DebuggerCallFrame.h:
1266         (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
1267         the dynamic global object, since the debugger doesn't want the lexical
1268         global object.
1269
1270 2008-05-21  Oliver Hunt  <oliver@apple.com>
1271
1272         Reviewed by Maciej.
1273
1274         Bug 19116: SquirrelFish shouldn't regress on variable lookups
1275         <https://bugs.webkit.org/show_bug.cgi?id=19116>
1276
1277         Optimise cross scope assignment, 0.4% progression in sunspider.
1278
1279         * VM/CodeBlock.cpp:
1280         (KJS::CodeBlock::dump):
1281         * VM/CodeGenerator.cpp:
1282         (KJS::CodeGenerator::emitPutScopedVar):
1283         * VM/CodeGenerator.h:
1284         * VM/Machine.cpp:
1285         (KJS::Machine::privateExecute):
1286         * VM/Opcode.h:
1287         * kjs/nodes.cpp:
1288         (KJS::AssignResolveNode::emitCode):
1289
1290 2008-05-21  Maciej Stachowiak  <mjs@apple.com>
1291
1292         Reviewed by Oliver.
1293         
1294         - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
1295         0.5% speedup on SunSpider
1296
1297         * kjs/JSGlobalObject.h:
1298         (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
1299         because symbol table access is likely to have been optimized.
1300
1301 2008-05-21  Oliver Hunt  <oliver@apple.com>
1302
1303         Reviewed by Maciej.
1304
1305         Bug 19116: SquirrelFish shouldn't regress on variable lookups
1306         <https://bugs.webkit.org/show_bug.cgi?id=19116>
1307
1308         Optimise multiscope lookup of statically resolvable function calls.
1309         SunSpider reports a 1.5% improvement, including 37% on 
1310         controlflow-recursive for some reason :D
1311
1312         * VM/CodeBlock.cpp:
1313         (KJS::CodeBlock::dump):
1314         * VM/CodeGenerator.cpp:
1315         (KJS::CodeGenerator::emitResolve):
1316         * VM/CodeGenerator.h:
1317         * kjs/nodes.cpp:
1318         (KJS::FunctionCallResolveNode::emitCode):
1319
1320 2008-05-21  Maciej Stachowiak  <mjs@apple.com>
1321
1322         Reviewed by Oliver.
1323         
1324         - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
1325         (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
1326
1327         * JavaScriptCore.exp:
1328         * kjs/JSGlobalObject.h:
1329         (KJS::JSGlobalObject::getOwnPropertySlot):
1330         * kjs/JSVariableObject.h:
1331         (KJS::JSVariableObject::symbolTableGet):
1332         * kjs/object.h:
1333         (KJS::JSObject::getDirectLocation):
1334         (KJS::JSObject::getOwnPropertySlotForWrite):
1335         * kjs/property_map.cpp:
1336         (KJS::PropertyMap::getLocation):
1337         * kjs/property_map.h:
1338         * kjs/property_slot.h:
1339         (KJS::PropertySlot::putValue):
1340
1341 2008-05-20  Oliver Hunt  <oliver@apple.com>
1342
1343         Reviewed by Maciej.
1344
1345         Bug 19116: SquirrelFish shouldn't regress on variable lookups
1346         <https://bugs.webkit.org/show_bug.cgi?id=19116>
1347
1348         This restores multiscope optimisation to simple resolve, producing
1349         a 2.6% progression in SunSpider.  Have verified that none of the
1350         sites broken by the multiscope optimisation in trunk were effected
1351         by this change.
1352
1353         * VM/CodeBlock.cpp:
1354         (KJS::CodeBlock::dump):
1355         * VM/CodeBlock.h:
1356         (KJS::CodeBlock::CodeBlock):
1357         * VM/CodeGenerator.cpp:
1358         (KJS::CodeGenerator::findScopedProperty):
1359         (KJS::CodeGenerator::emitResolve):
1360         * VM/CodeGenerator.h:
1361         * VM/Machine.cpp:
1362         (KJS::resolve_n):
1363         (KJS::Machine::privateExecute):
1364         * VM/Opcode.h:
1365         * kjs/JSVariableObject.h:
1366
1367 2008-05-20  Oliver Hunt  <oliver@apple.com>
1368
1369         Reviewed by NOBODY (Build fix).
1370
1371         Fixerate the windows build.
1372
1373         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1374         * VM/CodeGenerator.cpp:
1375         * VM/RegisterFile.h:
1376         * kjs/JSGlobalObject.h:
1377         * kjs/Parser.cpp:
1378         * kjs/interpreter.h:
1379
1380 2008-05-20  Oliver Hunt  <oliver@apple.com>
1381
1382         Reviewed by Geoff.
1383
1384         Bug 19110: SquirrelFish: Google Maps - no maps
1385         <https://bugs.webkit.org/show_bug.cgi?id=19110>
1386
1387         Correct a comedy of errors present in my original patch to "fix"
1388         exceptions occurring midway through pre and post increment. This
1389         solution is cleaner than the original, doesn't need the additional
1390         opcodes, and as an added benefit does not break Google Maps.
1391
1392         Sunspider reports a 0.4% progression.
1393
1394         * VM/CodeBlock.cpp:
1395         (KJS::CodeBlock::dump):
1396         * VM/CodeGenerator.cpp:
1397         * VM/CodeGenerator.h:
1398         * VM/Machine.cpp:
1399         (KJS::Machine::privateExecute):
1400         * VM/Opcode.h:
1401         * kjs/nodes.cpp:
1402         (KJS::PreIncResolveNode::emitCode):
1403         (KJS::PreDecResolveNode::emitCode):
1404         (KJS::PreIncBracketNode::emitCode):
1405         (KJS::PreDecBracketNode::emitCode):
1406         (KJS::PreIncDotNode::emitCode):
1407         (KJS::PreDecDotNode::emitCode):
1408
1409 2008-05-20  Maciej Stachowiak  <mjs@apple.com>
1410
1411         Reviewed by Oliver.
1412         
1413         - inline JSGlobalObject::getOwnPropertySlot
1414         1% improvement on in-browser SunSpider (a wash command-line)
1415
1416         * kjs/JSGlobalObject.cpp:
1417         * kjs/JSGlobalObject.h:
1418         (KJS::JSGlobalObject::getOwnPropertySlot):
1419
1420 2008-05-18  Oliver Hunt  <oliver@apple.com>
1421
1422         Reviewed by Maciej.
1423
1424         Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
1425         <https://bugs.webkit.org/show_bug.cgi?id=18752>
1426
1427         Handle exceptions thrown by toString conversion in subscript operators,
1428         this should basically complete exception handling in SquirrelFish.
1429
1430         Sunspider reports no regression.
1431
1432         * VM/Machine.cpp:
1433         (KJS::Machine::privateExecute):
1434
1435 2008-05-17  Geoffrey Garen  <ggaren@apple.com>
1436
1437         Reviewed by Oliver Hunt.
1438
1439         [Reapplying patch with previously missing files from r33553 -- Oliver]
1440
1441         Behold: debugging.
1442         
1443         SunSpider reports no change.
1444
1445         * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
1446         and created a debugger folder.
1447
1448         * VM/CodeGenerator.cpp:
1449         (KJS::CodeGenerator::generate): If the debugger is attached, always
1450         generate full scope chains for its sake.
1451
1452         * VM/Machine.cpp:
1453         (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
1454         due to an exception, so it doesn't keep stale call frames around.
1455
1456         (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
1457         debugger can distinguish them from function call frames.
1458
1459         (KJS::Machine::debug): Simplified this function, since the debugger
1460         doesn't actually need all the information we used to provide.
1461
1462         (KJS::Machine::privateExecute): Treat debugging hooks like other function
1463         calls, so the code we hook into (the debugger UI) can be optimized.
1464
1465         * kjs/debugger.cpp: Nixed these default callback implementations and
1466         made the callbacks pure virtual instead, so the compiler could tell me
1467         if I made a mistake in one of the subclasses.
1468
1469         * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
1470         callbacks. Changed from passing an ExecState* to passing a
1471         DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
1472         information anymore.
1473
1474         * kjs/function.cpp:
1475         (KJS::globalFuncEval): Easiest bug fix evar!
1476
1477         [Previously missing files from r33553]
1478         * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
1479         (KJS::DebuggerCallFrame::functionName):
1480         (KJS::DebuggerCallFrame::thisObject):
1481         (KJS::DebuggerCallFrame::evaluateScript):
1482         * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
1483         (KJS::DebuggerCallFrame::DebuggerCallFrame):
1484         (KJS::DebuggerCallFrame::scopeChain):
1485         (KJS::DebuggerCallFrame::exception):
1486
1487 2008-05-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1488
1489         Reviewed by Oliver.
1490
1491         Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
1492         <https://bugs.webkit.org/show_bug.cgi?id=18991>
1493
1494         Fix the last remaining blocking cases of this bug.
1495
1496         * kjs/grammar.y:
1497         * kjs/nodes.cpp:
1498         (KJS::ReadModifyResolveNode::emitCode):
1499
1500 2008-05-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1501
1502         Reviewed by Oliver.
1503
1504         Partial fix for:
1505
1506         Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
1507         <https://bugs.webkit.org/show_bug.cgi?id=18991>
1508
1509         Ensure that the code generated for assignments uses temporaries whenever
1510         necessary. This patch covers the vast majority of situations, but there
1511         are still a few left.
1512
1513         This patch also adds some missing cases to CodeBlock::dump().
1514
1515         * VM/CodeBlock.cpp:
1516         (KJS::CodeBlock::dump):
1517         * VM/CodeGenerator.h:
1518         (KJS::CodeGenerator::destinationForAssignResult):
1519         (KJS::CodeGenerator::leftHandSideNeedsCopy):
1520         (KJS::CodeGenerator::emitNodeForLeftHandSide):
1521         * kjs/NodeInfo.h:
1522         * kjs/grammar.y:
1523         * kjs/nodes.cpp:
1524         (KJS::AssignDotNode::emitCode):
1525         (KJS::ReadModifyDotNode::emitCode):
1526         (KJS::AssignBracketNode::emitCode):
1527         (KJS::ReadModifyBracketNode::emitCode):
1528         (KJS::ForInNode::ForInNode):
1529         * kjs/nodes.h:
1530         (KJS::ReadModifyResolveNode::):
1531         (KJS::AssignResolveNode::):
1532         (KJS::ReadModifyBracketNode::):
1533         (KJS::AssignBracketNode::):
1534         (KJS::AssignDotNode::):
1535         (KJS::ReadModifyDotNode::):
1536
1537 2008-05-17  Oliver Hunt  <oliver@apple.com>
1538
1539         Reviewed by Maciej.
1540
1541         Bug 19106: SquirrelFish: Activation is not marked correctly
1542         <https://bugs.webkit.org/show_bug.cgi?id=19106>
1543
1544         We can't rely on the symbol table for a count of the number of globals
1545         we need to mark as that misses duplicate parameters and 'this'.  Now we
1546         use the actual local register count from the codeBlock.
1547
1548         * kjs/JSActivation.cpp:
1549         (KJS::JSActivation::mark):
1550
1551 2008-05-16  Oliver Hunt  <oliver@apple.com>
1552
1553         Reviewed by Geoff.
1554
1555         Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
1556         <https://bugs.webkit.org/show_bug.cgi?id=19076>
1557
1558         Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
1559         to allocate the global 'this' register safely at any point after initialisation of the Global
1560         Object.
1561
1562         Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
1563         support for the static slot optimisation for the global Math object which brings it to a 0.3%
1564         progression.
1565
1566         * VM/CodeGenerator.cpp:
1567         (KJS::CodeGenerator::programCodeThis):
1568         (KJS::CodeGenerator::CodeGenerator):
1569         (KJS::CodeGenerator::addParameter):
1570         * VM/CodeGenerator.h:
1571         * VM/Machine.cpp:
1572         (KJS::Machine::execute):
1573         * kjs/ExecState.h:
1574         * kjs/JSGlobalObject.cpp:
1575         (KJS::JSGlobalObject::reset):
1576         * kjs/JSGlobalObject.h:
1577         (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
1578         (KJS::JSGlobalObject::addStaticGlobals):
1579         * kjs/nodes.cpp:
1580
1581 2008-05-16  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1582
1583         Reviewed by Oliver Hunt.
1584
1585         Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
1586         <https://bugs.webkit.org/show_bug.cgi?id=19098>
1587
1588         When doing code generation for a statement list, increase the reference
1589         count on a register that might eventually be returned, so that it doesn't
1590         get clobbered by a request for a new temporary.
1591
1592         * kjs/nodes.cpp:
1593         (KJS::statementListEmitCode):
1594
1595 2008-05-16  Maciej Stachowiak  <mjs@apple.com>
1596
1597         Reviewed by Oliver.
1598         
1599         - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
1600         https://bugs.webkit.org/show_bug.cgi?id=19044
1601
1602         * kjs/JSActivation.cpp:
1603         (KJS::JSActivation::copyRegisters): Use numLocals from the code
1604         block rather than the size of the symbol table for the number of
1605         registers to copy, to account for duplicate parameters and vars
1606         with the same name as parameters (we still have potentially
1607         suboptimal codegen in that we allocate a local register for the
1608         var in the latter case but it is never used).
1609         
1610 2008-05-15  Geoffrey Garen  <ggaren@apple.com>
1611
1612         Not reviewed.
1613         
1614         We regret to inform you that your program is crashing because you were
1615         stupid.
1616
1617         * VM/Machine.cpp:
1618         (KJS::Machine::privateExecute): Math is hard.
1619
1620 2008-05-14  Geoffrey Garen  <ggaren@apple.com>
1621
1622         Reviewed by Oliver Hunt.
1623
1624         A little more debugger action: filled in op_debug. All debugger control
1625         flow works now, but variable inspection and backtraces still don't.
1626         
1627         SunSpider reports no change.
1628
1629         * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
1630
1631         * VM/Machine.cpp:
1632         (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
1633         NEVER_INLINE function to avoid a stunning 10% performance regression.
1634         Also factored out a common function for retrieving the function and 
1635         arguments from a  call frame. 
1636
1637         * kjs/JSActivation.cpp:
1638         (KJS::JSActivation::createArgumentsObject): Use the new factored out
1639         function mentioned above.
1640
1641         * kjs/Parser.cpp:
1642         (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
1643         sourceId we send to the debugger matches the sourceId recorded in the
1644         node.
1645
1646         * kjs/nodes.cpp: Emit debugging hooks.
1647
1648 2008-05-14  Oliver Hunt  <oliver@apple.com>
1649
1650         Reviewed by Maciej.
1651
1652         Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
1653         <https://bugs.webkit.org/show_bug.cgi?id=19024>
1654
1655         This fixes a number of issues.  The most important is that we now check every register
1656         file for tainting rather than just looking for function register files as that was
1657         insufficient. Additionally guarded against implicit re-entry into Eval code.
1658
1659         Also added a few additional assertions to reduce the amout of time between something
1660         going wrong and us seeing the error.
1661
1662         * VM/Machine.cpp:
1663         (KJS::Machine::execute):
1664         (KJS::Machine::privateExecute):
1665         * VM/RegisterFile.cpp:
1666         (KJS::RegisterFile::growBuffer):
1667         (KJS::RegisterFile::addGlobalSlots):
1668         * VM/RegisterFileStack.cpp:
1669         (KJS::RegisterFileStack::pushGlobalRegisterFile):
1670         (KJS::RegisterFileStack::pushFunctionRegisterFile):
1671         * VM/RegisterFileStack.h:
1672         (KJS::RegisterFileStack::inImplicitCall):
1673
1674 2008-05-14  Geoffrey Garen  <ggaren@apple.com>
1675
1676         Reviewed by Oliver Hunt.
1677         
1678         A little more debugger action: emit opcodes for debugger hooks. Right
1679         now, the opcode implementation is just a stub.
1680         
1681         SunSpider reports no change.
1682         
1683         Some example codegen for "function f() { 1; }":
1684
1685             [   0] dbg         DidEnterCallFrame
1686             [   2] dbg         WillExecuteStatement
1687             [   4] load        tr0, 1(@k0)
1688             [   7] load        tr0, undefined(@k1)
1689             [  10] dbg         WillLeaveCallFrame
1690             [  12] ret         tr0
1691
1692 2008-05-14  Oliver Hunt  <oliver@apple.com>
1693
1694         Reviewed by Geoff.
1695
1696         Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
1697         <https://bugs.webkit.org/show_bug.cgi?id=19025>
1698
1699         Simple fix -- move the use of functionBodyNode to after the null check.
1700
1701         * kjs/function_object.cpp:
1702         (KJS::FunctionObjectImp::construct):
1703
1704 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1705
1706         Reviewed by Oliver Hunt.
1707         
1708         Fixed a codegen crash with run-time parse errors.
1709         
1710         SunSpider reports no change.
1711         
1712         emitThrowError needs to return the temporary holding the error, not dst,
1713         since dst may be NULL. In fact, emitThrowError shouldn't take a dst
1714         parameter at all, since exceptions should not modify the destination
1715         register.
1716
1717 2008-05-13  Oliver Hunt  <oliver@apple.com>
1718
1719         Reviewed by Geoff.
1720
1721         Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
1722         <https://bugs.webkit.org/show_bug.cgi?id=19027>
1723
1724         This fixes the codegen issues for the pre-inc/decrement operators
1725         to prevent incorrectly clobbering the destination in the event of
1726         an exception.
1727
1728         * VM/CodeBlock.cpp:
1729         (KJS::CodeBlock::dump):
1730         * VM/CodeGenerator.cpp:
1731         (KJS::CodeGenerator::emitPreInc):
1732         (KJS::CodeGenerator::emitPreDec):
1733         * VM/CodeGenerator.h:
1734         * VM/Machine.cpp:
1735         (KJS::Machine::privateExecute):
1736         * VM/Opcode.h:
1737         * kjs/nodes.cpp:
1738         (KJS::PreIncResolveNode::emitCode):
1739         (KJS::PreDecResolveNode::emitCode):
1740         (KJS::PreIncBracketNode::emitCode):
1741         (KJS::PreDecBracketNode::emitCode):
1742         (KJS::PreIncDotNode::emitCode):
1743         (KJS::PreDecDotNode::emitCode):
1744
1745 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1746
1747         Reviewed by Oliver Hunt.
1748         
1749         A little more debugger action: supply a real line number, sourceId,
1750         and sourceURL in op_new_error.
1751         
1752         SunSpider reports a .2% speedup. Not sure what that's about.
1753
1754         * VM/Machine.cpp:
1755         (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
1756
1757         * kjs/nodes.cpp:
1758         (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
1759         rolling our own.
1760
1761 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1762
1763         Reviewed by Oliver Hunt.
1764         
1765         A little more debugger action: implemented the exception callback.
1766         
1767         SunSpider reports a .2% speedup. Not sure what that's about.
1768
1769         * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
1770         owner ScopeNode so we can retrieve data from it. This allows us to
1771         stop storing copies of the data ourselves. Also, store a "this" register
1772         instead of a code type, since we were only using the code type to
1773         calculate the "this" register.
1774
1775         * VM/CodeGenerator.cpp:
1776         (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
1777         above. Also, take care of removing "this" from the symbol table after
1778         codegen is done, since relying on the timing of a destructor for correct
1779         behavior is not so good.
1780
1781         * VM/Machine.cpp:
1782         (KJS::Machine::throwException): Invoke the debugger's exception callback.
1783         (KJS::Machine::privateExecute): Use the "this" register mentioned above.
1784
1785 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1786
1787         Reviewed by Oliver Hunt.
1788         
1789         Removed some unused exception machinery.
1790         
1791         SunSpider reports a .3% speedup.
1792
1793         * API/JSCallbackObject.h:
1794         * API/JSCallbackObjectFunctions.h:
1795         * JavaScriptCore.exp:
1796         * VM/Machine.cpp:
1797         (KJS::Machine::privateExecute):
1798         * kjs/internal.cpp:
1799         * kjs/object.cpp:
1800         * kjs/object.h:
1801         * kjs/value.h:
1802
1803 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1804
1805         Reviewed by Oliver Hunt.
1806         
1807         A little more debugger action.
1808
1809         * kjs/debugger.cpp:
1810         * kjs/debugger.h: Removed debuggersPresent because it was unused.
1811         Replaced AttachedGlobalObject linked list with a HashSet because HashSet
1812         is faster and simpler. Changed all functions to return void instead of
1813         bool, because no clients ever return false, and we don't want to support
1814         it.
1815
1816         * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
1817         (KJS::Node::handleException):
1818         (KJS::BreakpointCheckStatement::execute):
1819         (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
1820
1821 2008-05-13  Oliver Hunt  <oliver@apple.com>
1822
1823         Reviewed by Darin.
1824
1825         Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
1826         <https://bugs.webkit.org/show_bug.cgi?id=18752>
1827
1828         Replace old attempt at "branchless" exceptions as the extra information
1829         being passed made gcc an unhappy compiler, replacing these custom toNumber
1830         calls with ordinary toNumber logic (by relying on toNumber now preventing
1831         side effects after an exception has been thrown) provided sufficient leeway
1832         to add the additional checks for the remaining unchecked cases.
1833
1834         This leaves only toString conversions in certain contexts as possibly
1835         misbehaving.
1836
1837         * VM/Machine.cpp:
1838         (KJS::jsAdd):
1839         (KJS::resolve):
1840         (KJS::resolveBaseAndProperty):
1841         (KJS::resolveBaseAndFunc):
1842         (KJS::Machine::privateExecute):
1843         * VM/Opcode.h:
1844         * kjs/value.h:
1845         (KJS::JSValue::safeGetNumber):
1846
1847 2008-05-13  Geoffrey Garen  <ggaren@apple.com>
1848
1849         Reviewed by Oliver Hunt.
1850         
1851         First steps toward supporting the debugger API: support the sourceParsed
1852         callback; plus some minor fixups.
1853
1854         SunSpider reports no regression.
1855
1856         * VM/CodeGenerator.h: Removed a misleading comment.
1857
1858         * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
1859         implement the sourceParsed callback -- that way, we only have to
1860         implement the callback in one place.
1861
1862         * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
1863         was to demonstrate the misapplication of design patterns.
1864
1865         * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
1866         reduce copying, and not to return a value, because pausing execution
1867         after parsing is complicated, and no clients needed that ability, anyway.
1868
1869         * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
1870         didFinishParsing -- that simplifies some code down the road.
1871         
1872         * kjs/nodes.cpp: Don't generate special AST nodes just because the
1873         debugger is attached -- that's a relic of the old AST execution model,
1874         and those nodes haven't been maintained.
1875
1876 2008-05-13  Oliver Hunt  <oliver@apple.com>
1877
1878         Reviewed by Geoff.
1879
1880         Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
1881         <https://bugs.webkit.org/show_bug.cgi?id=18752>
1882
1883         First step: prevent incorrect evaluation of valueOf/toString conversion
1884         in right hand side of expression after earlier conversion throws.
1885
1886         * API/JSCallbackObjectFunctions.h:
1887         (KJS::::toNumber):
1888         * kjs/object.cpp:
1889         (KJS::JSObject::defaultValue):
1890
1891 2008-05-12  Oliver Hunt  <oliver@apple.com>
1892
1893         Reviewed by Geoff.
1894
1895         Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
1896         <https://bugs.webkit.org/show_bug.cgi?id=18934>
1897
1898         Unfortunately we cannot create new statically optimised globals if there are any
1899         tainted RegisterFiles on the RegisterFileStack.  To handle this we re-introduce
1900         (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
1901
1902         * VM/Machine.cpp:
1903         (KJS::Machine::execute):
1904         * VM/RegisterFileStack.cpp:
1905         (KJS::RegisterFileStack::pushFunctionRegisterFile):
1906         * VM/RegisterFileStack.h:
1907
1908 2008-05-12  Geoffrey Garen  <ggaren@apple.com>
1909
1910         Reviewed by Maciej Stachowiak.
1911         
1912         Introduced support for function.caller.
1913         
1914         Improved support for walking interesting scopes for function introspection.
1915         
1916         This fixes all remaining layout tests not blocked by rebasing to trunk.
1917         
1918         SunSpider reports no change.
1919
1920         * VM/Machine.cpp:
1921         (KJS::Machine::dumpRegisters): Fixed a spacing issue.
1922
1923 2008-05-11  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
1924
1925         Reviewed by Oliver.
1926
1927         Bug 18961: SQUIRRELFISH: Gmail doesn't load
1928         <https://bugs.webkit.org/show_bug.cgi?id=18961>
1929
1930         Fix codegen for logical nodes so that they don't use their destination
1931         as a temporary.
1932
1933         * kjs/nodes.cpp:
1934         (KJS::LogicalAndNode::emitCode):
1935         (KJS::LogicalOrNode::emitCode):
1936
1937 2008-05-10  Maciej Stachowiak  <mjs@apple.com>
1938
1939         Reviewed by Oliver.
1940
1941         - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
1942         https://bugs.webkit.org/show_bug.cgi?id=18869
1943        
1944         Three layout tests are fixed:
1945           fast/js/toString-elision-trailing-comma.html
1946           fast/js/toString-prefix-postfix-preserve-parens.html
1947           fast/js/kde/lval-exceptions.html
1948         
1949         Functions now save a shared subrange of the original source used
1950         to make them (so in the common case this adds no storage above the
1951         memory cache).
1952         
1953         * kjs/SourceProvider.h: Added.
1954         (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
1955         to the source for a JavaScript program. This allows function objects to have access to their
1956         original source without copying.
1957         (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
1958         (KJS::UStringSourceProvider::create):
1959         (KJS::UStringSourceProvider::getRange):
1960         (KJS::UStringSourceProvider::data):
1961         (KJS::UStringSourceProvider::length):
1962         (KJS::UStringSourceProvider::UStringSourceProvider):
1963         * kjs/SourceRange.h: Added.
1964         (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
1965         the source, to encapsulate on-demand access to the source of a function.
1966         (KJS::SourceRange::toString):
1967         * VM/Machine.cpp:
1968         (KJS::eval): Pass a UStringSourceProvider to the parser.
1969         * kjs/Parser.cpp:
1970         (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
1971         * kjs/Parser.h:
1972         (KJS::Parser::parse): Take a SourceProvider.
1973         * kjs/lexer.cpp:
1974         (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
1975         use it to get the raw buffer and length.
1976         * kjs/lexer.h:
1977         (KJS::Lexer::sourceRange): Convenience function to get a source
1978         range based on the lexer's source provieder, and char offsets
1979         right before and after the desired range.
1980         * kjs/function.cpp:
1981         (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
1982         * kjs/function_object.cpp:
1983         (KJS::functionProtoFuncToString): Use toSourceString to get the source.
1984         (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
1985         * kjs/grammar.y: When parsing a function declaration, function
1986         expression, or getter or setter, tell the function body about its
1987         SourceRange.
1988         * kjs/interpreter.cpp:
1989         (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
1990         (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
1991         * kjs/interpreter.h:
1992         * kjs/nodes.h:
1993         (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
1994         (KJS::FunctionBodyNode::toSourceString): Get the source string out
1995         of the SourceRange.
1996         (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
1997         (KJS::FuncDeclNode::): ditto
1998         * kjs/testkjs.cpp:
1999         (prettyPrintScript): Use a SourceProvider appropriately.
2000         * JavaScriptCore.exp: Export new symbols.
2001         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
2002         * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
2003
2004 2008-05-09  Oliver Hunt  <oliver@apple.com>
2005
2006         Reviewed by Maciej.
2007
2008         Bring back RegisterFile tainting in order to correctly handle
2009         natively implemented getters and setters that re-enter JavaScript
2010
2011         * VM/Machine.cpp:
2012         (KJS::Machine::privateExecute):
2013         * VM/RegisterFile.h:
2014         * kjs/function.cpp:
2015         (KJS::FunctionImp::callAsFunction):
2016         * kjs/object.cpp:
2017         (KJS::JSObject::put):
2018         (KJS::tryGetAndCallProperty):
2019         * kjs/property_slot.cpp:
2020         (KJS::PropertySlot::functionGetter):
2021
2022 2008-05-09  Maciej Stachowiak  <mjs@apple.com>
2023
2024         Reviewed by Oliver.
2025         
2026         - track character offsets of open and close braces, in preparation for saving function source
2027         
2028         I verified that there is no performance regression from this change.
2029
2030         * kjs/grammar.y:
2031         * kjs/lexer.cpp:
2032         (KJS::Lexer::lex):
2033         (KJS::Lexer::matchPunctuator):
2034         * kjs/lexer.h:
2035
2036 2008-05-09  Oliver Hunt  <oliver@apple.com>
2037
2038         Reviewed by Nobody (build fix).
2039
2040         Debug build fix
2041
2042         * kjs/JSGlobalObject.cpp:
2043         (KJS::JSGlobalObject::restoreLocalStorage):
2044
2045 2008-05-09  Oliver Hunt  <oliver@apple.com>
2046
2047         Reviewed by Geoff.
2048
2049         Build fixes for SquirrelFish on windows.
2050
2051         * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2052         * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
2053         * VM/Register.h:
2054         * kjs/JSGlobalObject.cpp:
2055         (KJS::JSGlobalObject::restoreLocalStorage):
2056         * kjs/collector.cpp:
2057         (KJS::Collector::allocate):
2058         (KJS::Collector::allocateNumber):
2059         * kjs/collector.h:
2060         (KJS::Collector::allocate):
2061         (KJS::Collector::allocateNumber):
2062         * kjs/property_slot.cpp:
2063
2064 2008-05-08  Maciej Stachowiak  <mjs@apple.com>
2065
2066         Reviewed by Geoff.
2067         
2068         - fix activation tearoff in the case where functions are called with too many arguments
2069         
2070         Fixes:
2071         fast/canvas/patternfill-repeat.html
2072         fast/dom/SelectorAPI/bug-17313.html
2073
2074         * VM/Machine.cpp:
2075         (KJS::slideRegisterWindowForCall):
2076         (KJS::scopeChainForCall):
2077         (KJS::Machine::execute):
2078         (KJS::Machine::privateExecute):
2079
2080 2008-05-08  Geoffrey Garen  <ggaren@apple.com>
2081
2082         Reviewed by Oliver Hunt.
2083         
2084         Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
2085         
2086         SunSpider reports a small speedup. Not sure what that's about.
2087
2088         * VM/CodeBlock.cpp:
2089         (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
2090         This helped me while debugging.
2091
2092         * VM/Machine.cpp:
2093         (KJS::Machine::unwindCallFrame): When looking for an activation to tear
2094         off, don't use the scope chain. Inside eval, the scope chain doesn't
2095         belong to us; it belongs to our calling function.
2096         
2097         Also, don't use the needsFullScopeChain flag to decide whether to tear
2098         off the activation. "function.arguments" can create an activation
2099         for a function whose needsFullScopeChain flag is set to false.
2100
2101 2008-05-08  Maciej Stachowiak  <mjs@apple.com>
2102
2103         Reviewed by Oliver.
2104         
2105         - fix function.call for calls of more than 8 arguments
2106         
2107         Fixes svg/carto.net/button.svg
2108
2109         * kjs/list.cpp:
2110         (KJS::List::getSlice): properly set up the m_buffer of the target list.
2111
2112 2008-05-08  Maciej Stachowiak  <mjs@apple.com>
2113
2114         Reviewed by Oliver.
2115         
2116         - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
2117
2118         Fixes:
2119         - fast/regex/early-acid3-86.html
2120         - http/tests/misc/acid3.html
2121         
2122         * kjs/nodes.cpp:
2123         (KJS::RegExpNode::emitCode):
2124
2125 2008-05-07  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2126
2127         Reviewed by Oliver.
2128
2129         Fix a performance regression caused by the introduction of property
2130         attributes to SymbolTable in r32859 by encoding the attributes and the
2131         register index into a single field of SymbolTableEntry.
2132
2133         This leaves Node::optimizeVariableAccess() definitely broken, although
2134         it was probably not entirely correct in SquirrelFish before this change.
2135
2136         * VM/CodeBlock.h:
2137         (KJS::missingThisObjectMarker):
2138         * VM/CodeGenerator.cpp:
2139         (KJS::CodeGenerator::addVar):
2140         (KJS::CodeGenerator::CodeGenerator):
2141         (KJS::CodeGenerator::registerForLocal):
2142         (KJS::CodeGenerator::registerForLocalConstInit):
2143         (KJS::CodeGenerator::isLocalConstant):
2144         (KJS::CodeGenerator::addConstant):
2145         (KJS::CodeGenerator::emitCall):
2146         * VM/CodeGenerator.h:
2147         (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
2148         * VM/Machine.cpp:
2149         (KJS::Machine::privateExecute):
2150         * kjs/JSGlobalObject.cpp:
2151         (KJS::JSGlobalObject::saveLocalStorage):
2152         * kjs/JSVariableObject.cpp:
2153         (KJS::JSVariableObject::getPropertyNames):
2154         (KJS::JSVariableObject::getPropertyAttributes):
2155         * kjs/JSVariableObject.h:
2156         (KJS::JSVariableObject::symbolTableGet):
2157         (KJS::JSVariableObject::symbolTablePut):
2158         (KJS::JSVariableObject::symbolTablePutWithAttributes):
2159         * kjs/SymbolTable.h:
2160         (KJS::SymbolTableEntry::SymbolTableEntry):
2161         (KJS::SymbolTableEntry::isEmpty):
2162         (KJS::SymbolTableEntry::getIndex):
2163         (KJS::SymbolTableEntry::getAttributes):
2164         (KJS::SymbolTableEntry::setAttributes):
2165         (KJS::SymbolTableEntry::isReadOnly):
2166         * kjs/nodes.cpp:
2167         (KJS::getSymbolTableEntry):
2168         (KJS::PostIncResolveNode::optimizeVariableAccess):
2169         (KJS::PostDecResolveNode::optimizeVariableAccess):
2170         (KJS::DeleteResolveNode::optimizeVariableAccess):
2171         (KJS::TypeOfResolveNode::optimizeVariableAccess):
2172         (KJS::PreIncResolveNode::optimizeVariableAccess):
2173         (KJS::PreDecResolveNode::optimizeVariableAccess):
2174         (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2175         (KJS::AssignResolveNode::optimizeVariableAccess):
2176         (KJS::ProgramNode::initializeSymbolTable):
2177
2178 2008-05-06  Maciej Stachowiak  <mjs@apple.com>
2179
2180         Rubber stamped by Oliver.
2181         
2182         - add missing ! in an assert that I failed to reverse
2183
2184         * VM/CodeGenerator.cpp:
2185         (KJS::CodeGenerator::CodeGenerator):
2186
2187 2008-05-06  Maciej Stachowiak  <mjs@apple.com>
2188
2189         Reviewed by Oliver.
2190         
2191         - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
2192         https://bugs.webkit.org/show_bug.cgi?id=18868
2193         
2194         The basic approach is to have "this" only be present in the symbol
2195         table at compile time, not runtime.
2196
2197         * VM/CodeGenerator.cpp:
2198         (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
2199         (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
2200         a symbol table.
2201         * VM/CodeGenerator.h:
2202         * VM/Machine.cpp:
2203         (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
2204
2205 2008-05-06  Geoffrey Garen  <ggaren@apple.com>
2206
2207         Reviewed by Oliver Hunt.
2208         
2209         Trivial support for function.arguments: Currently, we only support
2210         function.arguments from within the scope of function.
2211         
2212         This fixes the remaining Mozilla JS test failures.
2213         
2214         SunSpider reports no change.
2215
2216         * JavaScriptCore.exp:
2217
2218         * VM/Machine.cpp:
2219         (KJS::Machine::privateExecute): Separated scope chain deref from
2220         activation register copying: since it is now possible for client code
2221         to create an activation on behalf of a function that otherwise wouldn't
2222         need one, having an activation no longer necessarily means that you need
2223         to deref the scope chain.
2224         
2225         (KJS::Machine::getCallFrame): For now, this function only examines the
2226         current scope. Walking parent scopes requires some refactoring in the
2227         way we track execution stacks.
2228
2229         * kjs/ExecState.cpp:
2230         (KJS::ExecState::ExecState): We use a negative call frame offset to
2231         indicate that a given scope is not a function call scope.
2232         
2233 2008-05-05  Oliver Hunt  <oliver@apple.com>
2234
2235         Reviewed by Geoff.
2236
2237         Fix call frame set up for native -> JS function calls.
2238
2239         * VM/Machine.cpp:
2240         (KJS::Machine::execute):
2241
2242 2008-05-05  Geoffrey Garen  <ggaren@apple.com>
2243
2244         Reviewed by Maciej Stachowiak.
2245         
2246         Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
2247         
2248         SunSpider reports a .4% speedup. Not sure what that's about.
2249
2250         * VM/Machine.cpp:
2251         (KJS::Machine::privateExecute): Check for exception return from equal,
2252         since toPrimitive can throw.
2253
2254         * kjs/operations.cpp:
2255         (KJS::strictEqual): In response to an error I made in an earlier version
2256         of this patch, I changed strictEqual to make clear the fact that it
2257         performs no conversions and can't throw, making it slightly more efficient
2258         in the process.
2259
2260 2008-05-05  Maciej Stachowiak  <mjs@apple.com>
2261
2262         Reviewed by Oliver.
2263         
2264         - fix some dumb mistakes in my last patch
2265
2266         * VM/CodeGenerator.cpp:
2267         (KJS::CodeGenerator::emitPushScope):
2268         (KJS::CodeGenerator::emitGetPropertyNames):
2269         * VM/Machine.cpp:
2270         (KJS::Machine::privateExecute):
2271
2272 2008-05-05  Maciej Stachowiak  <mjs@apple.com>
2273
2274         Reviewed by Oliver.
2275         
2276         - document opcodes relating to jumps, scopes, and property name iteration
2277         
2278         Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
2279         next_pname and jmp_scopes.
2280
2281         * VM/CodeGenerator.cpp:
2282         (KJS::CodeGenerator::emitJump):
2283         (KJS::CodeGenerator::emitJumpIfTrue):
2284         (KJS::CodeGenerator::emitJumpIfFalse):
2285         (KJS::CodeGenerator::emitPushScope):
2286         (KJS::CodeGenerator::emitNextPropertyName):
2287         (KJS::CodeGenerator::emitGetPropertyNames):
2288         * VM/CodeGenerator.h:
2289         * VM/Machine.cpp:
2290         (KJS::Machine::privateExecute):
2291         * kjs/nodes.cpp:
2292         (KJS::LogicalAndNode::emitCode):
2293         (KJS::LogicalOrNode::emitCode):
2294         (KJS::ConditionalNode::emitCode):
2295         (KJS::IfNode::emitCode):
2296         (KJS::IfElseNode::emitCode):
2297         (KJS::DoWhileNode::emitCode):
2298         (KJS::WhileNode::emitCode):
2299         (KJS::ForNode::emitCode):
2300         (KJS::ForInNode::emitCode):
2301         (KJS::WithNode::emitCode):
2302
2303 2008-05-05  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
2304
2305         Reviewed by Oliver.
2306
2307         Bug 18749: SQUIRRELFISH: const support is broken
2308         <https://bugs.webkit.org/show_bug.cgi?id=18749>
2309
2310         Adds support for const during code generation.
2311
2312         Fixes 2 layout tests.
2313
2314         * ChangeLog:
2315         * VM/CodeGenerator.cpp:
2316         (KJS::CodeGenerator::addVar):
2317         (KJS::CodeGenerator::CodeGenerator):
2318         (KJS::CodeGenerator::isLocalConstant):
2319         * VM/CodeGenerator.h:
2320         (KJS::CodeGenerator::addVar):
2321         * kjs/nodes.cpp:
2322         (KJS::PostIncResolveNode::emitCode):
2323         (KJS::PostDecResolveNode::emitCode):
2324         (KJS::PreIncResolveNode::emitCode):
2325         (KJS::PreDecResolveNode::emitCode):
2326         (KJS::ReadModifyResolveNode::emitCode):
2327         (KJS::AssignResolveNode::emitCode):
2328
2329 2008-05-04  Maciej Stachowiak  <mjs@apple.com>
2330
2331         Reviewed by Geoff.
2332         
2333         - document some more opcodes (and fix argument names)
2334         
2335         Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
2336
2337         * VM/CodeGenerator.cpp:
2338         (KJS::CodeGenerator::emitEqual):
2339         (KJS::CodeGenerator::emitNotEqual):
2340         (KJS::CodeGenerator::emitStrictEqual):
2341         (KJS::CodeGenerator::emitNotStrictEqual):
2342         (KJS::CodeGenerator::emitLess):
2343         (KJS::CodeGenerator::emitLessEq):
2344         * VM/CodeGenerator.h:
2345         * VM/Machine.cpp:
2346         (KJS::Machine::privateExecute):
2347         * kjs/nodes.cpp:
2348         (KJS::LessNode::emitCode):
2349         (KJS::GreaterNode::emitCode):
2350         (KJS::LessEqNode::emitCode):
2351         (KJS::GreaterEqNode::emitCode):
2352         (KJS::EqualNode::emitCode):
2353         (KJS::NotEqualNode::emitCode):
2354         (KJS::StrictEqualNode::emitCode):
2355         (KJS::NotStrictEqualNode::emitCode):
2356         (KJS::CaseBlockNode::emitCodeForBlock):
2357
2358 2008-05-04  Geoffrey Garen  <ggaren@apple.com>
2359
2360         Reviewed by Maciej Stachowiak.
2361
2362         More scaffolding for f.arguments.
2363         
2364         Track the offset of the last call frame in the ExecState, so we can
2365         produce a backtrace at any time.
2366         
2367         Also, record numLocals, the sum of numVars + numParameters, in each code
2368         block, to make updates to the ExecState a little cheaper than they
2369         would be otherwise.
2370         
2371         We now use numLocals in a bunch of places where we used to calculate
2372         numVars + numParameters or -numVars - numParameters.
2373         
2374         Reports are mixed, but all in all, this seems to be a wash on SunSpider.
2375
2376 2008-05-04  Oliver Hunt  <oliver@apple.com>
2377
2378         Reviewed by Geoff.
2379
2380         Whoops, correctly handle properties that don't exist in the 
2381         symbol table.
2382
2383         * kjs/JSVariableObject.h:
2384         (KJS::JSVariableObject::symbolTablePutWithAttributes):
2385
2386 2008-05-04  Oliver Hunt  <oliver@apple.com>
2387
2388         Reviewed by Geoff.
2389
2390         Add attribute information to SymbolTable as ground work for
2391         various DontEnum and ReadOnly issues.
2392
2393         * VM/CodeGenerator.cpp:
2394         (KJS::CodeGenerator::addVar):
2395         (KJS::CodeGenerator::CodeGenerator):
2396         (KJS::CodeGenerator::registerForLocal):
2397         (KJS::CodeGenerator::registerForLocalConstInit):
2398         (KJS::CodeGenerator::addConstant):
2399         * VM/Machine.cpp:
2400         (KJS::Machine::execute):
2401         * kjs/JSGlobalObject.cpp:
2402         (KJS::JSGlobalObject::saveLocalStorage):
2403         * kjs/JSVariableObject.cpp:
2404         (KJS::JSVariableObject::getPropertyNames):
2405         (KJS::JSVariableObject::getPropertyAttributes):
2406         * kjs/JSVariableObject.h:
2407         (KJS::JSVariableObject::symbolTablePut):
2408         (KJS::JSVariableObject::symbolTablePutWithAttributes):
2409         * kjs/SymbolTable.h:
2410         (KJS::SymbolTableEntry::SymbolTableEntry):
2411         (KJS::SymbolTableIndexHashTraits::emptyValue):
2412         * kjs/nodes.cpp:
2413         (KJS::getSymbolTableEntry):
2414         (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2415         (KJS::AssignResolveNode::optimizeVariableAccess):
2416         (KJS::ProgramNode::initializeSymbolTable):
2417
2418 2008-05-04  Geoffrey Garen  <ggaren@apple.com>
2419
2420         Reviewed by Oliver Hunt.
2421         
2422         More scaffolding for f.arguments.
2423         
2424         Store the register file associated with an ExecState in the ExecState.
2425         
2426         SunSpider reports no change.
2427
2428         * kjs/JSGlobalObject.h:
2429         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
2430         registerFileStack above globalExec, so it gets initialized first.
2431         Removed remnants of old activation scheme.
2432
2433 2008-05-04  Maciej Stachowiak  <mjs@apple.com>
2434
2435         Rubber stamped by Oliver.
2436         
2437         - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
2438         
2439         equal --> eq
2440         nequal --> neq
2441         resolve_base_and_property --> resolve_with_base
2442         resolve_base_and_func --> resolve_func
2443         get_prop_id --> get_by_id
2444         put_prop_id --> put_by_id
2445         delete_prop_id --> del_by_id
2446         get_prop_val --> get_by_val
2447         put_prop_val --> put_by_val
2448         delete_prop_val --> del_by_val
2449         put_prop_index --> put_by_index
2450         
2451         * VM/CodeBlock.cpp:
2452         (KJS::printUnaryOp):
2453         (KJS::printBinaryOp):
2454         (KJS::printConditionalJump):
2455         (KJS::CodeBlock::dump):
2456         * VM/CodeGenerator.cpp:
2457         (KJS::CodeGenerator::emitEqual):
2458         (KJS::CodeGenerator::emitNotEqual):
2459         (KJS::CodeGenerator::emitResolveWithBase):
2460         (KJS::CodeGenerator::emitResolveFunction):
2461         (KJS::CodeGenerator::emitGetById):
2462         (KJS::CodeGenerator::emitPutById):
2463         (KJS::CodeGenerator::emitDeleteById):
2464         (KJS::CodeGenerator::emitGetByVal):
2465         (KJS::CodeGenerator::emitPutByVal):
2466         (KJS::CodeGenerator::emitDeleteByVal):
2467         (KJS::CodeGenerator::emitPutByIndex):
2468         * VM/CodeGenerator.h:
2469         * VM/Machine.cpp:
2470         (KJS::Machine::privateExecute):
2471         * VM/Opcode.h:
2472         * kjs/nodes.cpp:
2473         (KJS::ArrayNode::emitCode):
2474         (KJS::PropertyListNode::emitCode):
2475         (KJS::BracketAccessorNode::emitCode):
2476         (KJS::DotAccessorNode::emitCode):
2477         (KJS::EvalFunctionCallNode::emitCode):
2478         (KJS::FunctionCallResolveNode::emitCode):
2479         (KJS::FunctionCallBracketNode::emitCode):
2480         (KJS::FunctionCallDotNode::emitCode):
2481         (KJS::PostIncResolveNode::emitCode):
2482         (KJS::PostDecResolveNode::emitCode):
2483         (KJS::PostIncBracketNode::emitCode):
2484         (KJS::PostDecBracketNode::emitCode):
2485         (KJS::PostIncDotNode::emitCode):
2486         (KJS::PostDecDotNode::emitCode):
2487         (KJS::DeleteResolveNode::emitCode):
2488         (KJS::DeleteBracketNode::emitCode):
2489         (KJS::DeleteDotNode::emitCode):
2490         (KJS::TypeOfResolveNode::emitCode):
2491         (KJS::PreIncResolveNode::emitCode):
2492         (KJS::PreDecResolveNode::emitCode):
2493         (KJS::PreIncBracketNode::emitCode):
2494         (KJS::PreDecBracketNode::emitCode):
2495         (KJS::PreIncDotNode::emitCode):
2496         (KJS::PreDecDotNode::emitCode):
2497         (KJS::ReadModifyResolveNode::emitCode):
2498         (KJS::AssignResolveNode::emitCode):
2499         (KJS::AssignDotNode::emitCode):
2500         (KJS::ReadModifyDotNode::emitCode):
2501         (KJS::AssignBracketNode::emitCode):
2502         (KJS::ReadModifyBracketNode::emitCode):
2503         (KJS::ConstDeclNode::emitCodeSingle):
2504         (KJS::ForInNode::emitCode):
2505         (KJS::TryNode::emitCode):
2506
2507 2008-05-04  Oliver Hunt  <oliver@apple.com>
2508
2509         Reviewed by Maciej.
2510
2511         Fix assertion when accessing arguments object with too many arguments provided
2512
2513         The arguments constructor was assuming that the register offset given for argv
2514         was an absolute offset into the registerfile, rather than the offset from the
2515         frame.  This patches corrects that issue.
2516
2517         * kjs/JSActivation.cpp:
2518         (KJS::JSActivation::createArgumentsObject):
2519
2520 2008-05-04  Geoffrey Garen  <ggaren@apple.com>
2521
2522         Rubber stamped by Sam Weinig.
2523         
2524         Cleaned up Machine.cpp according to our style guidelines: moved static
2525         data to the top of the file; moved stand-alone functions below that;
2526         moved the Machine constructor above other Machine member functions.
2527
2528 2008-05-03  Maciej Stachowiak  <mjs@apple.com>
2529
2530         Reviewed by Sam.
2531         
2532         - fix accidental breakage from last patch
2533
2534         * VM/Machine.cpp:
2535         (KJS::Machine::privateExecute):
2536
2537 2008-05-03  Maciej Stachowiak  <mjs@apple.com>
2538
2539         Reviewed by Geoff.
2540         
2541         - a bunch more opcode documentation and corresponding parameter name fixes
2542
2543         I renamed a few opcodes:
2544         
2545         type_of --> typeof (that's what the JS operator is named)
2546         instance_of --> instanceof (ditto)
2547         create_error --> new_error (for consistency with other new_* opcodes)
2548         
2549         I documented the following opcodes:
2550         
2551         - load
2552         - new_object
2553         - new_array
2554         - new_regexp
2555         - mov
2556         - pre_inc
2557         - pre_dec
2558         - post_inc
2559         - post_dec
2560         - to_jsnumber
2561         - negate
2562         - bitnot
2563         - not
2564         - instanceof
2565         - typeof
2566         - in
2567         - new_func
2568         - new_funcexp
2569         - new_error
2570
2571         I also fixed formatting on some existing opcode docs.
2572         
2573         * VM/CodeBlock.cpp:
2574         (KJS::CodeBlock::dump):
2575         * VM/CodeGenerator.cpp:
2576         (KJS::CodeGenerator::emitMove):
2577         (KJS::CodeGenerator::emitNot):
2578         (KJS::CodeGenerator::emitPreInc):
2579         (KJS::CodeGenerator::emitPreDec):
2580         (KJS::CodeGenerator::emitPostInc):
2581         (KJS::CodeGenerator::emitPostDec):
2582         (KJS::CodeGenerator::emitToJSNumber):
2583         (KJS::CodeGenerator::emitNegate):
2584         (KJS::CodeGenerator::emitBitNot):
2585         (KJS::CodeGenerator::emitInstanceOf):
2586         (KJS::CodeGenerator::emitTypeOf):
2587         (KJS::CodeGenerator::emitIn):
2588         (KJS::CodeGenerator::emitLoad):
2589         (KJS::CodeGenerator::emitNewObject):
2590         (KJS::CodeGenerator::emitNewArray):
2591         (KJS::CodeGenerator::emitNewRegExp):
2592         (KJS::CodeGenerator::emitNewError):
2593         * VM/CodeGenerator.h:
2594         (KJS::CodeGenerator::scopeDepth):
2595         (KJS::CodeGenerator::addVar):
2596         * VM/Machine.cpp:
2597         (KJS::Machine::privateExecute):
2598         * VM/Opcode.h:
2599         * kjs/nodes.cpp:
2600         (KJS::Node::emitThrowError):
2601         (KJS::RegExpNode::emitCode):
2602         (KJS::TypeOfValueNode::emitCode):
2603         (KJS::UnaryPlusNode::emitCode):
2604         (KJS::NegateNode::emitCode):
2605         (KJS::BitwiseNotNode::emitCode):
2606         (KJS::LogicalNotNode::emitCode):
2607         (KJS::InstanceOfNode::emitCode):
2608         (KJS::InNode::emitCode):
2609
2610 2008-05-03  Maciej Stachowiak  <mjs@apple.com>
2611
2612         Reviewed by Geoff and Sam.
2613         
2614         - generate HTML bytecode docs at build time
2615
2616         * DerivedSources.make:
2617         * docs: Added.
2618         * docs/make-bytecode-docs.pl: Added.
2619
2620 2008-05-03  Geoffrey Garen  <ggaren@apple.com>
2621
2622         Reviewed by Sam Weinig.
2623         
2624         Update ExecState::m_scopeChain when switching scope chains inside the
2625         machine.
2626         
2627         This fixes uses of lexicalGlobalObject, such as, in a subframe
2628
2629             alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
2630         
2631         and a bunch of the security failures listed in
2632         https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
2633         seemingly because of regressions in exception messages).
2634         
2635         SunSpider reports no change.
2636
2637         * VM/Machine.cpp: Factored out scope chain updating into a common
2638         function that takes care to update ExecState::m_scopeChain, too.
2639
2640         * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
2641         could update ExecState::m_scopeChain, even though that value is
2642         read-only for everyone else.
2643
2644         * kjs/JSGlobalObject.h:
2645         (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
2646         this client to be a little friendlier to ExecState's internal
2647         storage type for scope chain data.
2648
2649 2008-05-03  Geoffrey Garen  <ggaren@apple.com>
2650
2651         Reviewed by Sam Weinig.
2652         
2653         Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
2654         Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
2655         
2656         SunSpider reports no change.
2657
2658         * VM/Machine.cpp:
2659         (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
2660         since the direct threaded interpreter will goto across its destructor.
2661
2662 2008-05-03  Geoffrey Garen  <ggaren@apple.com>
2663
2664         Reviewed by Oliver Hunt.
2665         
2666         A bit more efficient fix than r32832: Don't copy globals into function
2667         register files; instead, have the RegisterFileStack track only the base
2668         of the last *global* register file, so the global object's register
2669         references stay good.
2670         
2671         SunSpider reports a .3% speedup. Not sure what that's about.
2672
2673 2008-05-03  Oliver Hunt  <oliver@apple.com>
2674
2675         Reviewed by Maciej.
2676
2677         Bug 18864: SquirrelFish: Support getter and setter definition in object literals
2678         <https://bugs.webkit.org/show_bug.cgi?id=18864>
2679
2680         Add new opcodes to allow us to add getters and setters to an object.  These are
2681         only used by the codegen for object literals.
2682
2683         * VM/CodeGenerator.cpp:
2684         (KJS::CodeGenerator::emitPutGetter):
2685         (KJS::CodeGenerator::emitPutSetter):
2686         * VM/CodeGenerator.h:
2687         * VM/Machine.cpp:
2688         (KJS::Machine::privateExecute):
2689         * VM/Opcode.h:
2690         * kjs/nodes.cpp:
2691         (KJS::PropertyListNode::emitCode):
2692
2693 2008-05-02  Maciej Stachowiak  <mjs@apple.com>
2694
2695         Reviewed by Oliver.
2696         
2697         - properly copy globals into and out of implicit call register
2698         files, otherwise they will fail at global lookup
2699
2700         Fixes fast/js/array-tostring-and-join.html layout test.
2701         
2702         * VM/RegisterFileStack.cpp:
2703         (KJS::RegisterFileStack::pushGlobalRegisterFile):
2704         (KJS::RegisterFileStack::popGlobalRegisterFile):
2705         (KJS::RegisterFileStack::pushFunctionRegisterFile):
2706         (KJS::RegisterFileStack::popFunctionRegisterFile):
2707
2708 2008-05-02  Geoffrey Garen  <ggaren@apple.com>
2709
2710         Reviewed by Oliver Hunt.
2711         
2712         Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
2713         SQUIRRELFISH: incorrect eval used in some cases
2714         
2715         Changed all code inside the machine to fetch the lexical global object
2716         directly from the scope chain, instead of from the ExecState.
2717         
2718         Clients who fetch the lexical global object through the ExecState
2719         still don't work.
2720         
2721         SunSpider reports no change.
2722
2723         * VM/Machine.cpp:
2724         (KJS::Machine::privateExecute): Fetch the lexical global object from
2725         the scope chain.
2726         
2727         * kjs/ExecState.h:
2728         (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
2729         this function into ScopeChainNode, but kept this function around to
2730         support existing clients.
2731
2732 2008-05-02  Geoffrey Garen  <ggaren@apple.com>
2733
2734         Rubber stamped by Oliver Hunt.
2735         
2736         Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
2737
2738         * JavaScriptCore.xcodeproj/project.pbxproj:
2739         * kjs/AllInOneFile.cpp:
2740
2741 2008-05-01  Oliver Hunt  <oliver@apple.com>
2742
2743         Reviewed by Geoff and Maciej.
2744
2745         Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
2746         <https://bugs.webkit.org/show_bug.cgi?id=18827>
2747
2748         Remove safe/unsafe RegisterFile concept, and instead just add additional
2749         logic to ensure we always push/pop RegisterFiles when executing getters
2750         and setters, similar to the logic for valueOf and toString.
2751
2752         * VM/Machine.cpp:
2753         (KJS::Machine::privateExecute):
2754         * VM/RegisterFile.h:
2755         * kjs/function.cpp:
2756         (KJS::FunctionImp::callAsFunction):
2757         * kjs/object.cpp:
2758         (KJS::JSObject::put):
2759         * kjs/property_slot.cpp:
2760         (KJS::PropertySlot::functionGetter):
2761
2762 2008-05-01  Oliver Hunt  <oliver@apple.com>
2763
2764         RS=Geoff
2765
2766         Rename unsafeForReentry to safeForReentry to avoid double negatives.
2767
2768         * VM/Machine.cpp:
2769         (KJS::Machine::privateExecute):
2770         * VM/RegisterFile.h:
2771         * kjs/function.cpp:
2772         (KJS::FunctionImp::callAsFunction):
2773
2774 2008-05-01  Oliver Hunt  <oliver@apple.com>
2775
2776         Reviewed by Maciej.
2777
2778         Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
2779         <https://bugs.webkit.org/show_bug.cgi?id=18827>
2780         
2781         This patch makes getters and setters work.  It does this by
2782         tracking whether the RegisterFile is "safe", that is whether
2783         the interpreter is in a state that in which it can handle
2784         the RegisterFile being reallocated.
2785
2786         * VM/Machine.cpp:
2787         (KJS::resolve):
2788         (KJS::Machine::privateExecute):
2789         * VM/RegisterFile.h:
2790         * kjs/function.cpp:
2791         (KJS::FunctionImp::callAsFunction):
2792
2793 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2794
2795         Release build fix: Always compile in "isGlobalObject", since it's
2796         listed in our .exp file.
2797
2798         * kjs/ExecState.cpp:
2799         (KJS::ExecState::isGlobalObject):
2800         * kjs/ExecState.h:
2801
2802 2008-04-30  Oliver Hunt  <oliver@apple.com>
2803
2804         Reviewed by Maciej.
2805
2806         Minor code restructuring to prepare for getters and setters, 
2807         also helps exception semantics a bit.
2808
2809         * VM/Machine.cpp:
2810         (KJS::Machine::privateExecute):
2811
2812 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2813
2814         Fixed tyop.
2815
2816         * kjs/ExecState.h:
2817
2818 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2819
2820         Debug build fix: export a missing symbol.
2821
2822         * JavaScriptCore.exp:
2823
2824 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2825
2826         Reviewed by Oliver Hunt.
2827         
2828         A little more ExecState refactoring: Now, only the global object creates
2829         an ExecState.
2830         
2831         Also inlined ExecState::lexicalGlobalObject().
2832         
2833         SunSpider reports no change.
2834
2835 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2836
2837         WebCore build fix: forward-declare ScopeChain.
2838
2839         * kjs/interpreter.h:
2840
2841 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2842
2843         Build fix for JavaScriptGlue: export a missing symbol.
2844
2845         * JavaScriptCore.exp:
2846
2847 2008-04-30  Geoffrey Garen  <ggaren@apple.com>
2848
2849         Reviewed by Oliver Hunt.
2850         
2851         Removed a lot of unused bits from ExecState, moving them into
2852         OldInterpreterExecState, the fake scaffolding class.
2853         
2854         The clutter was making it hard to see the forest from the trees.
2855         
2856         .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
2857         is faster now.
2858
2859 2008-04-29  Oliver Hunt  <oliver@apple.com>
2860
2861         Reviewed by Maciej.
2862
2863         Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
2864         <https://bugs.webkit.org/show_bug.cgi?id=18643>
2865
2866         Prevent static slot optimisation for new variables and functions in
2867         globally re-entrant code called from an an implicit function call.
2868
2869         This is necessary to prevent us from needing to resize the global
2870         slot portion of the root RegisterFile during an implicit (and hence
2871         unguarded) function call.
2872
2873         * VM/CodeGenerator.cpp:
2874         (KJS::CodeGenerator::CodeGenerator):
2875         * VM/CodeGenerator.h:
2876         * VM/Machine.cpp:
2877         (KJS::Machine::execute):
2878         * VM/RegisterFile.h:
2879         * VM/RegisterFileStack.cpp:
2880         (KJS::RegisterFileStack::pushGlobalRegisterFile):
2881         (KJS::RegisterFileStack::popGlobalRegisterFile):
2882         (KJS::RegisterFileStack::pushFunctionRegisterFile):
2883         (KJS::RegisterFileStack::popFunctionRegisterFile):
2884         * VM/RegisterFileStack.h:
2885         (KJS::RegisterFileStack::inImplicitFunctionCall):
2886         (KJS::RegisterFileStack::lastGlobal):
2887         * kjs/nodes.cpp:
2888         (KJS::ProgramNode::generateCode):
2889         * kjs/nodes.h:
2890         (KJS::ProgramNode::):
2891
2892 2008-04-29  Geoffrey Garen  <ggaren@apple.com>
2893
2894         Reviewed by Oliver Hunt.
2895         
2896         In nested program code, don't propogate "this" back to the parent
2897         register file. ("this" should remain constant in the parent register
2898         file, regardless of the scripts it invokes.)
2899
2900         * VM/RegisterFile.cpp:
2901         (KJS::RegisterFile::copyGlobals):
2902
2903 2008-04-28  Oliver Hunt  <oliver@apple.com>
2904
2905         Reviewed by Geoff.
2906
2907         Restore base pointer when popping a global RegisterFile
2908
2909         * VM/RegisterFileStack.cpp:
2910         (KJS::RegisterFileStack::popGlobalRegisterFile):
2911
2912 2008-04-28  Oliver Hunt  <oliver@apple.com>
2913
2914         Reviewed by Geoff.
2915
2916         Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
2917         <https://bugs.webkit.org/show_bug.cgi?id=18643>
2918
2919         Partial fix.  This results in all implicit calls to toString or valueOf
2920         executing in a separate RegisterFile, so ensuring that the the pointers
2921         in the triggering interpreter don't get trashed.  This still leaves the
2922         task of preventing new global re-entry from toString and valueOf from
2923         clobbering the RegisterFile.
2924
2925         * VM/Machine.cpp:
2926         (KJS::Machine::execute):
2927         * VM/RegisterFileStack.cpp:
2928         (KJS::RegisterFileStack::pushFunctionRegisterFile):
2929         (KJS::RegisterFileStack::popFunctionRegisterFile):
2930         * VM/RegisterFileStack.h:
2931         * kjs/object.cpp:
2932         (KJS::tryGetAndCallProperty):
2933
2934 2008-04-28  Geoffrey Garen  <ggaren@apple.com>
2935
2936         Reviewed by Maciej Stachowiak.
2937         
2938         Simplified activation object a bit: No need to store the callee
2939         in the activation object -- we can pull it out of the call frame
2940         when needed, instead.
2941         
2942         SunSpider reports no change.
2943
2944 2008-04-28  Geoffrey Garen  <ggaren@apple.com>
2945
2946         Reviewed by Maciej Stachowiak.
2947         
2948         RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
2949
2950         Substantially more handling of "arguments": "arguments" works fully
2951         now, but "f.arguments" still doesn't work.
2952
2953         Fixes 10 regression tests.
2954         
2955         SunSpider reports no regression.
2956
2957         * kjs/JSActivation.cpp:
2958         (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
2959         List to pass to the arguments object constructor.
2960
2961         * JavaScriptCore.xcodeproj/project.pbxproj:
2962         * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
2963         because that seems to make GCC happy. (Previously, I had added
2964         JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
2965         happy. So it goes.)
2966
2967 2008-04-28  Geoffrey Garen  <ggaren@apple.com>
2968
2969         Reviewed by Maciej Stachowiak.
2970         
2971         Groundwork for more handling of "arguments". I'm not checking in the
2972         actual handling of "arguments" yet, because it still needs a little
2973         fiddling to avoid a performance regression.
2974         
2975         SunSpider reports no change.
2976
2977         * VM/Machine.cpp:
2978         (KJS::initializeCallFrame): Put argc in the register file, so the
2979         arguments object can find it later, to determine arguments.length.
2980
2981         * kjs/nodes.h:
2982         (KJS::FunctionBodyNode::): Added a special code accessor for when you
2983         know the code has already been generated, and you don't have a scopeChain
2984         to supply for potential code generation. (This is the case when the
2985         activation object creates the arguments object.)
2986
2987 2008-04-28  Oliver Hunt  <oliver@apple.com>
2988
2989         Reviewed by Geoff.
2990
2991         Replace unsafe use of auto_ptr in Vector with manual memory
2992         management.
2993
2994         * VM/RegisterFileStack.cpp:
2995         (KJS::RegisterFileStack::~RegisterFileStack):
2996         (KJS::RegisterFileStack::popRegisterFile):
2997         * VM/RegisterFileStack.h:
2998
2999 2008-04-27  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3000
3001         Reviewed by Maciej.
3002
3003         Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
3004         <https://bugs.webkit.org/show_bug.cgi?id=18746>
3005
3006         Change the base to the correct value of the 'this' object after the direct
3007         eval test instead of before.
3008
3009         Fixes 5 layout tests.
3010
3011         * VM/Machine.cpp:
3012         (KJS::Machine::privateExecute):
3013         * kjs/nodes.cpp:
3014         (KJS::EvalFunctionCallNode::emitCode):
3015
3016 2008-04-26  Maciej Stachowiak  <mjs@apple.com>
3017
3018         Reviewed by Oliver.
3019         
3020         - document all property getting, setting and deleting opcodes
3021         
3022         (And fix function parameter names to match corresponding opcode parameter names.)
3023
3024         * VM/CodeGenerator.cpp:
3025         (KJS::CodeGenerator::emitResolve):
3026         (KJS::CodeGenerator::emitResolveBase):
3027         (KJS::CodeGenerator::emitResolveBaseAndProperty):
3028         (KJS::CodeGenerator::emitResolveBaseAndFunc):
3029         (KJS::CodeGenerator::emitGetPropId):
3030         (KJS::CodeGenerator::emitPutPropId):
3031         (KJS::CodeGenerator::emitDeletePropId):
3032         (KJS::CodeGenerator::emitPutPropVal):
3033         * VM/CodeGenerator.h:
3034         * VM/Machine.cpp:
3035         (KJS::resolve):
3036         (KJS::resolveBase):
3037         (KJS::resolveBaseAndProperty):
3038         (KJS::resolveBaseAndFunc):
3039         (KJS::Machine::privateExecute):
3040         * kjs/nodes.cpp:
3041         (KJS::ResolveNode::emitCode):
3042         (KJS::ArrayNode::emitCode):
3043         (KJS::PropertyListNode::emitCode):
3044         (KJS::BracketAccessorNode::emitCode):
3045         (KJS::EvalFunctionCallNode::emitCode):
3046         (KJS::FunctionCallResolveNode::emitCode):
3047         (KJS::FunctionCallBracketNode::emitCode):
3048         (KJS::PostIncResolveNode::emitCode):
3049         (KJS::PostDecResolveNode::emitCode):
3050         (KJS::PostIncBracketNode::emitCode):
3051         (KJS::PostDecBracketNode::emitCode):
3052         (KJS::PostIncDotNode::emitCode):
3053         (KJS::PostDecDotNode::emitCode):
3054         (KJS::DeleteResolveNode::emitCode):
3055         (KJS::TypeOfResolveNode::emitCode):
3056         (KJS::PreIncResolveNode::emitCode):
3057         (KJS::PreDecResolveNode::emitCode):
3058         (KJS::PreIncBracketNode::emitCode):
3059         (KJS::PreDecBracketNode::emitCode):
3060         (KJS::AssignResolveNode::emitCode):
3061         (KJS::AssignDotNode::emitCode):
3062         (KJS::ReadModifyDotNode::emitCode):
3063         (KJS::AssignBracketNode::emitCode):
3064         (KJS::ReadModifyBracketNode::emitCode):
3065         (KJS::ConstDeclNode::emitCodeSingle):
3066
3067 2008-04-26  Oliver Hunt  <oliver@apple.com>
3068
3069         Reviewed by Maciej.
3070
3071         Bug 18628: SQUIRRELFISH: need to support recursion limit
3072         <https://bugs.webkit.org/show_bug.cgi?id=18628>
3073
3074         Basically completes recursion limiting.  There is still some
3075         tuning we may want to do to make things better in the face of
3076         very bad code, but certainly nothing worse than anything already
3077         possible in trunk.
3078
3079         Also fixes a WebKit test by fixing the exception text :D
3080
3081         * JavaScriptCore.exp:
3082         * VM/ExceptionHelpers.cpp:
3083         * VM/Machine.cpp:
3084         (KJS::Machine::execute):
3085         * VM/RegisterFile.cpp:
3086         (KJS::RegisterFile::growBuffer):
3087         (KJS::RegisterFile::addGlobalSlots):
3088         * VM/RegisterFile.h:
3089         (KJS::RegisterFile::grow):
3090         (KJS::RegisterFile::uncheckedGrow):
3091         * VM/RegisterFileStack.cpp:
3092         (KJS::RegisterFileStack::pushRegisterFile):
3093         * VM/RegisterFileStack.h:
3094
3095 2008-04-25  Oliver Hunt  <oliver@apple.com>
3096
3097         Reviewed by Geoff.
3098
3099         Bug 18628: SQUIRRELFISH: need to support recursion limit
3100         <https://bugs.webkit.org/show_bug.cgi?id=18628>
3101
3102         Put a limit on the level of reentry recursion.  128 levels of re-entrant recursion
3103         seems reasonable as it is greater than the old eval limit, and a long way short of
3104         the reentry depth needed to overflow the stack.
3105
3106         * VM/Machine.cpp:
3107         (KJS::Machine::execute):
3108         * VM/Machine.h:
3109
3110 2008-04-25  Geoffrey Garen  <ggaren@apple.com>
3111
3112         Reviewed by Sam Weinig.
3113         
3114         A tiny bit of cleanup to the regexp code.
3115         
3116         Removed some static_cast.
3117         
3118         Removed createRegExpImp because it's no longer used.
3119
3120 2008-04-25  Oliver Hunt  <oliver@apple.com>
3121
3122         Reviewed by Maciej.
3123
3124         Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
3125         <https://bugs.webkit.org/show_bug.cgi?id=18736>
3126
3127         Ensure the "default" target is correct in the absence of an explicit default handler.
3128
3129         * kjs/nodes.cpp:
3130         (KJS::CaseBlockNode::emitCodeForBlock):
3131
3132 2008-04-25  Oliver Hunt  <oliver@apple.com>
3133
3134         Reviewed by Maciej.
3135
3136         Bug 18628: SQUIRRELFISH: need to support recursion limit
3137         <https://bugs.webkit.org/show_bug.cgi?id=18628>
3138
3139         More bounds checking.
3140
3141         * VM/Machine.cpp:
3142         (KJS::Machine::execute):
3143         * VM/RegisterFile.cpp:
3144         (KJS::RegisterFile::growBuffer):
3145         * VM/RegisterFile.h:
3146
3147 2008-04-25  Maciej Stachowiak  <mjs@apple.com>
3148
3149         Reviewed by Oliver.
3150         
3151         - fix signal catching magic
3152         
3153         The signal handlers are restored to _exit but are only set when
3154         running under run-javascriptcore-tests. fprintf from a signal
3155         handler is not safe.
3156
3157         * kjs/testkjs.cpp:
3158         (main):
3159         (parseArguments):
3160         * tests/mozilla/jsDriver.pl:
3161
3162 2008-04-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3163
3164         Reviewed by Maciej.
3165
3166         Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
3167         <https://bugs.webkit.org/show_bug.cgi?id=18732>
3168
3169         Fixes another regression test.
3170
3171         * VM/Machine.cpp:
3172         (KJS::Machine::privateExecute):
3173
3174 2008-04-25  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3175
3176         Reviewed by Maciej.
3177
3178         Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
3179         <https://bugs.webkit.org/show_bug.cgi?id=18728>
3180
3181         Fixes another regression test.
3182
3183         * kjs/nodes.cpp:
3184         (KJS::RegExpNode::emitCode):
3185
3186 2008-04-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3187
3188         Reviewed by Geoffrey Garen.
3189
3190         Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
3191         <https://bugs.webkit.org/show_bug.cgi?id=18735>
3192
3193         The overloaded toThisObject method was not copied over to JSActivation.
3194
3195         Fixes two regression tests.
3196
3197         * kjs/JSActivation.cpp:
3198         (KJS::JSActivation::toThisObject):
3199         * kjs/JSActivation.h:
3200
3201 2008-04-24  Geoffrey Garen  <ggaren@apple.com>
3202
3203         Reviewed by Oliver Hunt.
3204         
3205         Added support for arguments.callee.
3206
3207 2008-04-24  Oliver Hunt  <oliver@apple.com>
3208
3209         Reviewed by Maciej.
3210
3211         Bug 18628: SQUIRRELFISH: need to support recursion limit
3212         <https://bugs.webkit.org/show_bug.cgi?id=18628>
3213
3214         Partial fix -- this gets us some of the required bounds checking, but not
3215         complete coverage.  But it does manage to do them without regressing :D
3216
3217         * VM/ExceptionHelpers.cpp:
3218         (KJS::createError):
3219         (KJS::createStackOverflowError):
3220         * VM/ExceptionHelpers.h:
3221         * VM/Machine.cpp:
3222         (KJS::slideRegisterWindowForCall):
3223         (KJS::Machine::execute):
3224         (KJS::Machine::privateExecute):
3225         * VM/RegisterFile.cpp:
3226         * VM/RegisterFile.h:
3227         (KJS::RegisterFile::):
3228         (KJS::RegisterFile::RegisterFile):
3229         (KJS::RegisterFile::grow):
3230
3231 2008-04-24  Geoffrey Garen  <ggaren@apple.com>
3232
3233         Reviewed by Oliver Hunt.
3234         
3235         A tiny bit more handling of "arguments": create a real, but mostly
3236         hollow, arguments object.
3237         
3238         Fixes 2 regression tests.
3239
3240 2008-04-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3241
3242         Reviewed by Oliver.
3243
3244         Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
3245         <https://bugs.webkit.org/show_bug.cgi?id=18717>
3246
3247         Fixes a regression test, but exposes the failure of another due to the
3248         lack of getters and setters.
3249
3250         * kjs/nodes.cpp:
3251         (KJS::ConstDeclNode::emitCodeSingle):
3252         (KJS::ConstDeclNode::emitCode):
3253         (KJS::ConstStatementNode::emitCode):
3254         (KJS::VarStatementNode::emitCode):
3255         * kjs/nodes.h:
3256
3257 2008-04-24  Geoffrey Garen  <ggaren@apple.com>
3258
3259         Reviewed by Sam Weinig.
3260         
3261         Print a CRASH statement when crashing, so test failures are not a
3262         mystery.
3263
3264         * kjs/testkjs.cpp:
3265         (handleCrash):
3266         (main):
3267
3268 2008-04-24  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3269
3270         Reviewed by Geoffrey Garen.
3271
3272         Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
3273         <https://bugs.webkit.org/show_bug.cgi?id=18716>
3274
3275         This fixes 2 more regression tests.
3276
3277         * kjs/nodes.cpp:
3278         (KJS::TypeOfResolveNode::emitCode):
3279
3280 2008-04-24  Geoffrey Garen  <ggaren@apple.com>
3281
3282         Reviewed by Sam Weinig.
3283         
3284         Put the callee in the call frame.
3285         
3286         Necessary in order to support "arguments" and "arguments.callee".
3287
3288         Also fixes a latent GC bug, where an executing function could be
3289         subject to GC if the register holding it were overwritten. Here's
3290         an example that would have caused problems:
3291         
3292         function f()
3293         {
3294             // Flood the machine stack to eliminate any old pointers to f.
3295             g.call({});
3296             
3297             // Overwrite f in the register file.
3298             f = 1;
3299
3300             // Force a GC.
3301             for (var i = 0; i < 5000; ++i) {
3302                 ({});
3303             }
3304             
3305             // Welcome to crash-ville.
3306         }
3307
3308         function g()
3309         {
3310         }
3311
3312         f();
3313
3314         * VM/Machine.h: Changed the order of arguments to
3315         execute(FunctionBodyNode*...) to match the other execute functions.
3316         * kjs/function.cpp: Updated to match new argument requirements from
3317         execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
3318         rest of JavaScriptCore.
3319
3320         SunSpider reports no change.
3321
3322 2008-04-23  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
3323
3324         Reviewed by Maciej.
3325
3326         Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
3327         <https://bugs.webkit.org/show_bug.cgi?id=18707>
3328
3329         This fixes 4 more regression tests.
3330
3331         * VM/Machine.cpp:
3332         (KJS::eval):
3333
3334 2008-04-23  Maciej Stachowiak  <mjs@apple.com>
3335
3336         Reviewed by Oliver.
3337         
3338         - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
3339         
3340         Fixes 3 JSC tests.
3341
3342         * VM/SegmentedVector.h:
3343         (KJS::SegmentedVector::grow):
3344
3345 2008-04-23  Geoffrey Garen  <ggaren@apple.com>
3346
3347         Reviewed by Maciej Stachowiak.
3348         
3349         Degenerate handling of "arguments" as a property of the activation
3350         object. Currently, we just return a vanilla object.
3351         
3352         SunSpider reports no change.
3353
3354         Fixes:
3355
3356         ecma_3/Function/regress-94506.js.
3357         
3358         Reveals to have been secretly broken:
3359
3360         ecma_3/Function/15.3.4.3-1.js
3361         ecma_3/Function/15.3.4.4-1.js
3362         
3363         These tests were passing incorrectly. testkjs creates a global array
3364         named "arguments" to hold command-line arguments. That array was
3365         tricking these tests into thinking that an arguments object with length
3366         0 had been created. Since our new vanilla object shadows the global
3367         property named arguments, that object no longer fools these tests into
3368         passing.
3369         
3370         Net change: +1 failing test.
3371
3372         * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
3373         to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
3374
3375 2008-04-23  Maciej Stachowiak  <mjs@apple.com>
3376
3377         Reviewed by Oliver.
3378         
3379         - save and restore callFrame
3380
3381         * VM/Machine.cpp:
3382         (KJS::slideRegisterWindowForCall):
3383         (KJS::Machine::execute):
3384         (KJS::Machine::privateExecute):
3385         * kjs/testkjs.cpp:
3386         (main):
3387
3388 2008-04-23  Geoffrey Garen  <ggaren@apple.com>
3389
3390         Reviewed by Maciej Stachowiak.
3391         
3392         Fixed scopes for named function expressions.
3393         
3394         Fixes one regression test.
3395         
3396         Two changes here:
3397         
3398         (1) The function's name is supposed to have attributes DontDelete,
3399         ReadOnly, regardless of the type of code executing.
3400         
3401         (2) Push the name object on the function's scope chain, rather than
3402         the ExecState's scope chain because, well, that's where it belongs.
3403
3404 2008-04-23  Geoffrey Garen  <ggaren@apple.com>
3405
3406         Reviewed by Oliver Hunt.
3407         
3408         Inlined JSObject::putDirect, for a .4% SunSpider speedup.
3409         
3410         I did this as a first step toward removing nodes.cpp from
3411         AllInOneFile.cpp, but I'm putting that larger project aside for now.
3412
3413 2008-04-23  Maciej Stachowiak  <mjs@apple.com>
3414
3415         Rubber stamped by Geoff.
3416         
3417         - add OldInterpreterExecState class and use it in dead code
3418         
3419         This will allow removing things from the real ExecState class
3420         without having to figure out how to remove all this code without
3421         getting a perf regression.
3422
3423         * kjs/nodes.cpp:
3424         (KJS::ExpressionNode::evaluateToNumber):
3425         (KJS::ExpressionNode::evaluateToBoolean):
3426         (KJS::ExpressionNode::evaluateToInt32):
3427         (KJS::ExpressionNode::evaluateToUInt32):
3428         (KJS::Node::setErrorCompletion):
3429         (KJS::Node::throwError):
3430         (KJS::Node::throwUndefinedVariableError):
3431         (KJS::Node::handleException):
3432         (KJS::Node::rethrowException):
3433         (KJS::BreakpointCheckStatement::execute):
3434         (KJS::BreakpointCheckStatement::optimizeVariableAccess):
3435         (KJS::NullNode::evaluate):
3436         (KJS::FalseNode::evaluate):
3437         (KJS::TrueNode::evaluate):
3438         (KJS::NumberNode::evaluate):
3439         (KJS::NumberNode::evaluateToNumber):
3440         (KJS::NumberNode::evaluateToBoolean):
3441         (KJS::NumberNode::evaluateToInt32):
3442         (KJS::NumberNode::evaluateToUInt32):
3443         (KJS::ImmediateNumberNode::evaluate):
3444         (KJS::ImmediateNumberNode::evaluateToInt32):
3445         (KJS::ImmediateNumberNode::evaluateToUInt32):
3446         (KJS::StringNode::evaluate):
3447         (KJS::StringNode::evaluateToNumber):
3448         (KJS::StringNode::evaluateToBoolean):
3449         (KJS::RegExpNode::evaluate):
3450         (KJS::ThisNode::evaluate):
3451         (KJS::ResolveNode::inlineEvaluate):
3452         (KJS::ResolveNode::evaluate):
3453         (KJS::ResolveNode::evaluateToNumber):
3454         (KJS::ResolveNode::evaluateToBoolean):
3455         (KJS::ResolveNode::evaluateToInt32):
3456         (KJS::ResolveNode::evaluateToUInt32):
3457         (KJS::getSymbolTableEntry):
3458         (KJS::ResolveNode::optimizeVariableAccess):
3459         (KJS::LocalVarAccessNode::inlineEvaluate):
3460         (KJS::LocalVarAccessNode::evaluate):
3461         (KJS::LocalVarAccessNode::evaluateToNumber):
3462         (KJS::LocalVarAccessNode::evaluateToBoolean):
3463         (KJS::LocalVarAccessNode::evaluateToInt32):
3464         (KJS::LocalVarAccessNode::evaluateToUInt32):
3465         (KJS::getNonLocalSymbol):
3466         (KJS::ScopedVarAccessNode::inlineEvaluate):
3467         (KJS::ScopedVarAccessNode::evaluate):
3468         (KJS::ScopedVarAccessNode::evaluateToNumber):
3469         (KJS::ScopedVarAccessNode::evaluateToBoolean):
3470         (KJS::ScopedVarAccessNode::evaluateToInt32):
3471         (KJS::ScopedVarAccessNode::evaluateToUInt32):
3472         (KJS::NonLocalVarAccessNode::inlineEvaluate):
3473         (KJS::NonLocalVarAccessNode::evaluate):
3474         (KJS::NonLocalVarAccessNode::evaluateToNumber):
3475         (KJS::NonLocalVarAccessNode::evaluateToBoolean):
3476         (KJS::NonLocalVarAccessNode::evaluateToInt32):
3477         (KJS::NonLocalVarAccessNode::evaluateToUInt32):
3478         (KJS::ElementNode::optimizeVariableAccess):
3479         (KJS::ElementNode::evaluate):
3480         (KJS::ArrayNode::optimizeVariableAccess):
3481         (KJS::ArrayNode::evaluate):
3482         (KJS::ObjectLiteralNode::optimizeVariableAccess):
3483         (KJS::ObjectLiteralNode::evaluate):
3484         (KJS::PropertyListNode::optimizeVariableAccess):
3485         (KJS::PropertyListNode::evaluate):
3486         (KJS::PropertyNode::optimizeVariableAccess):
3487         (KJS::PropertyNode::evaluate):
3488         (KJS::BracketAccessorNode::optimizeVariableAccess):
3489         (KJS::BracketAccessorNode::inlineEvaluate):
3490         (KJS::BracketAccessorNode::evaluate):
3491         (KJS::BracketAccessorNode::evaluateToNumber):
3492         (KJS::BracketAccessorNode::evaluateToBoolean):
3493         (KJS::BracketAccessorNode::evaluateToInt32):
3494         (KJS::BracketAccessorNode::evaluateToUInt32):
3495         (KJS::DotAccessorNode::optimizeVariableAccess):
3496         (KJS::DotAccessorNode::inlineEvaluate):
3497         (KJS::DotAccessorNode::evaluate):
3498         (KJS::DotAccessorNode::evaluateToNumber):
3499         (KJS::DotAccessorNode::evaluateToBoolean):
3500         (KJS::DotAccessorNode::evaluateToInt32):
3501         (KJS::DotAccessorNode::evaluateToUInt32):
3502         (KJS::ArgumentListNode::optimizeVariableAccess):
3503         (KJS::ArgumentListNode::evaluateList):
3504         (KJS::ArgumentsNode::optimizeVariableAccess):
3505         (KJS::NewExprNode::optimizeVariableAccess):
3506         (KJS::NewExprNode::inlineEvaluate):
3507         (KJS::NewExprNode::evaluate):
3508         (KJS::NewExprNode::evaluateToNumber):
3509         (KJS::NewExprNode::evaluateToBoolean):
3510         (KJS::NewExprNode::evaluateToInt32):
3511         (KJS::NewExprNode::evaluateToUInt32):
3512         (KJS::ExpressionNode::resolveAndCall):
3513         (KJS::EvalFunctionCallNode::optimizeVariableAccess):
3514         (KJS::EvalFunctionCallNode::evaluate):
3515         (KJS::FunctionCallValueNode::optimizeVariableAccess):
3516         (KJS::FunctionCallValueNode::evaluate):
3517         (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3518         (KJS::FunctionCallResolveNode::inlineEvaluate):
3519         (KJS::FunctionCallResolveNode::evaluate):
3520         (KJS::FunctionCallResolveNode::evaluateToNumber):
3521         (KJS::FunctionCallResolveNode::evaluateToBoolean):
3522         (KJS::FunctionCallResolveNode::evaluateToInt32):
3523         (KJS::FunctionCallResolveNode::evaluateToUInt32):
3524         (KJS::LocalVarFunctionCallNode::inlineEvaluate):
3525         (KJS::LocalVarFunctionCallNode::evaluate):
3526         (KJS::LocalVarFunctionCallNode::evaluateToNumber):
3527         (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
3528         (KJS::LocalVarFunctionCallNode::evaluateToInt32):
3529         (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
3530         (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
3531         (KJS::ScopedVarFunctionCallNode::evaluate):
3532         (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
3533         (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
3534         (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
3535         (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
3536         (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
3537         (KJS::NonLocalVarFunctionCallNode::evaluate):
3538         (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
3539         (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
3540         (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
3541         (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
3542         (KJS::FunctionCallBracketNode::optimizeVariableAccess):
3543         (KJS::FunctionCallBracketNode::evaluate):
3544         (KJS::FunctionCallDotNode::optimizeVariableAccess):
3545         (KJS::FunctionCallDotNode::inlineEvaluate):
3546         (KJS::FunctionCallDotNode::evaluate):
3547         (KJS::FunctionCallDotNode::evaluateToNumber):
3548         (KJS::FunctionCallDotNode::evaluateToBoolean):
3549         (KJS::FunctionCallDotNode::evaluateToInt32):
3550         (KJS::FunctionCallDotNode::evaluateToUInt32):
3551         (KJS::PostIncResolveNode::optimizeVariableAccess):
3552         (KJS::PostIncResolveNode::evaluate):
3553         (KJS::PostIncLocalVarNode::evaluate):
3554         (KJS::PostDecResolveNode::optimizeVariableAccess):
3555         (KJS::PostDecResolveNode::evaluate):
3556         (KJS::PostDecLocalVarNode::evaluate):
3557         (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
3558         (KJS::PostDecLocalVarNode::evaluateToNumber):
3559         (KJS::PostDecLocalVarNode::evaluateToBoolean):
3560         (KJS::PostDecLocalVarNode::evaluateToInt32):
3561         (KJS::PostDecLocalVarNode::evaluateToUInt32):
3562         (KJS::PostfixBracketNode::optimizeVariableAccess):
3563         (KJS::PostIncBracketNode::evaluate):
3564         (KJS::PostDecBracketNode::evaluate):
3565         (KJS::PostfixDotNode::optimizeVariableAccess):
3566         (KJS::PostIncDotNode::evaluate):
3567         (KJS::PostDecDotNode::evaluate):
3568         (KJS::PostfixErrorNode::evaluate):
3569         (KJS::DeleteResolveNode::optimizeVariableAccess):
3570         (KJS::DeleteResolveNode::evaluate):
3571         (KJS::LocalVarDeleteNode::evaluate):
3572         (KJS::DeleteBracketNode::optimizeVariableAccess):
3573         (KJS::DeleteBracketNode::evaluate):
3574         (KJS::DeleteDotNode::optimizeVariableAccess):
3575         (KJS::DeleteDotNode::evaluate):
3576         (KJS::DeleteValueNode::optimizeVariableAccess):
3577         (KJS::DeleteValueNode::evaluate):
3578         (KJS::VoidNode::optimizeVariableAccess):
3579         (KJS::VoidNode::evaluate):
3580         (KJS::TypeOfValueNode::optimizeVariableAccess):
3581         (KJS::TypeOfResolveNode::optimizeVariableAccess):
3582         (KJS::LocalVarTypeOfNode::evaluate):
3583         (KJS::TypeOfResolveNode::evaluate):
3584         (KJS::TypeOfValueNode::evaluate):
3585         (KJS::PreIncResolveNode::optimizeVariableAccess):
3586         (KJS::PreIncLocalVarNode::evaluate):
3587         (KJS::PreIncResolveNode::evaluate):
3588         (KJS::PreDecResolveNode::optimizeVariableAccess):
3589         (KJS::PreDecLocalVarNode::evaluate):
3590         (KJS::PreDecResolveNode::evaluate):
3591         (KJS::PreIncConstNode::evaluate):
3592         (KJS::PreDecConstNode::evaluate):
3593         (KJS::PostIncConstNode::evaluate):
3594         (KJS::PostDecConstNode::evaluate):
3595         (KJS::PrefixBracketNode::optimizeVariableAccess):
3596         (KJS::PreIncBracketNode::evaluate):
3597         (KJS::PreDecBracketNode::evaluate):
3598         (KJS::PrefixDotNode::optimizeVariableAccess):
3599         (KJS::PreIncDotNode::evaluate):
3600         (KJS::PreDecDotNode::evaluate):
3601         (KJS::PrefixErrorNode::evaluate):
3602         (KJS::UnaryPlusNode::optimizeVariableAccess):
3603         (KJS::UnaryPlusNode::evaluate):
3604         (KJS::UnaryPlusNode::evaluateToBoolean):
3605         (KJS::UnaryPlusNode::evaluateToNumber):
3606         (KJS::UnaryPlusNode::evaluateToInt32):
3607         (KJS::UnaryPlusNode::evaluateToUInt32):
3608         (KJS::NegateNode::optimizeVariableAccess):
3609         (KJS::NegateNode::evaluate):
3610         (KJS::NegateNode::evaluateToNumber):
3611         (KJS::BitwiseNotNode::optimizeVariableAccess):
3612         (KJS::BitwiseNotNode::inlineEvaluateToInt32):
3613         (KJS::BitwiseNotNode::evaluate):
3614         (KJS::BitwiseNotNode::evaluateToNumber):
3615         (KJS::BitwiseNotNode::evaluateToBoolean):
3616         (KJS::BitwiseNotNode::evaluateToInt32):
3617         (KJS::BitwiseNotNode::evaluateToUInt32):
3618         (KJS::LogicalNotNode::optimizeVariableAccess):
3619         (KJS::LogicalNotNode::evaluate):
3620         (KJS::LogicalNotNode::evaluateToBoolean):
3621         (KJS::MultNode::optimizeVariableAccess):
3622         (KJS::MultNode::inlineEvaluateToNumber):
3623         (KJS::MultNode::evaluate):
3624         (KJS::MultNode::evaluateToNumber):
3625         (KJS::MultNode::evaluateToBoolean):
3626         (KJS::MultNode::evaluateToInt32):
3627         (KJS::MultNode::evaluateToUInt32):
3628         (KJS::DivNode::optimizeVariableAccess):