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