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