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