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