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