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