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