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