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