1 2008-05-23 Oliver Hunt <oliver@apple.com>
3 <rdar://problem/5951561> Turn on JavaScript Profiler
5 Reviewed by Kevin McCullough.
7 Flipped the switch on the profiler, rearranged how we
8 signal the the profiler is active so that calls aren't
9 needed in the general case.
11 Also fixed the entry point for Machine::execute(FunctionBodyNode..)
12 to correctly indicate function exit.
14 Results in a 0.7-1.0% regression in SunSpider :-(
18 (KJS::Machine::unwindCallFrame):
19 (KJS::Machine::execute):
20 (KJS::Machine::privateExecute):
22 * profiler/Profiler.cpp:
23 (KJS::Profiler::profiler):
24 (KJS::Profiler::startProfiling):
25 (KJS::Profiler::stopProfiling):
26 * profiler/Profiler.h:
27 (KJS::Profiler::enabledProfilerReference):
29 2008-05-23 Simon Hausmann <hausmann@webkit.org>
31 Fix the Qt build by adding profiler/ to the include search path.
35 2008-05-22 Kevin McCullough <kmccullough@apple.com>
39 Fix a bug in the profiler where time in the current function is given to
42 * profiler/Profile.cpp:
43 (KJS::Profile::didExecute): Set the start time and then call didExecute
44 to calculate the time spent in this function.
45 * profiler/ProfileNode.cpp: Remove confusing calculations that are no
47 (KJS::ProfileNode::insertNode):
48 * profiler/ProfileNode.h: Expose access to the start time to allow the
49 simpler time calculations above.
50 (KJS::ProfileNode::startTime):
51 (KJS::ProfileNode::setStartTime):
53 2008-05-22 Adam Roben <aroben@apple.com>
55 Show "(Function object)" instead of "(JSInpectorCallbackWrapper
58 Reviewed by Kevin McCullough.
60 * profiler/Profiler.cpp:
61 (KJS::createCallIdentifier): Use JSObject::className instead of
62 getting the class name from the ClassInfo directly. JSObject
63 subclasses can override className to provide a custom class name, and
64 it seems like we should honor that.
66 2008-05-22 Timothy Hatcher <timothy@apple.com>
68 Added Profile::restoreAll and added ProfileNode::restoreAll
71 Reviewed by Adam Roben.
76 2008-05-22 Alp Toker <alp@nuanti.com>
78 GTK+ build fix. Add JavaScriptCore/profiler to include path.
82 2008-05-22 Adam Roben <aroben@apple.com>
84 Implement sub-millisecond profiling on Windows
86 Reviewed by Kevin McCullough.
88 * profiler/ProfileNode.cpp:
89 (KJS::getCount): Added. On Windows, we use QueryPerformanceCounter. On
90 other platforms, we use getCurrentUTCTimeWithMicroseconds.
91 (KJS::ProfileNode::endAndRecordCall): Use getCount instead of
92 getCurrentUTCTimeWithMicroseconds.
93 (KJS::ProfileNode::startTimer): Ditto.
95 2008-05-22 Adam Roben <aroben@apple.com>
97 Fix a profiler assertion when calling a NodeList as a function
99 Reviewed by Kevin McCullough.
101 * profiler/Profiler.cpp:
102 (KJS::createCallIdentifier): Don't assert when a non-function object
103 is called as a function. Instead, build up a CallIdentifier using the
106 2008-05-22 Kevin McCullough <kmccullough@apple.com>
110 <rdar://problem/5951529> JSProfiler: Allow the profiler to "Exclude" a
112 -Implement 'exclude'; where the excluded node attributes its time to its
115 * JavaScriptCore.exp: Export the exclude function.
116 * profiler/Profile.h:
117 (KJS::Profile::exclude):
118 * profiler/ProfileNode.cpp:
119 (KJS::ProfileNode::setTreeVisible): New function that allows a change in
120 visiblitiy to be propogated to all the children of a node.
121 (KJS::ProfileNode::exclude): If the node matches the callIdentifier then
122 set the visiblity of this node and all of its children to false and
123 attribute it's total time to it's caller's self time.
124 * profiler/ProfileNode.h:
126 2008-05-22 Mark Rowe <mrowe@apple.com>
128 Reviewed by Oliver Hunt.
130 Fix access to static global variables in Windows release builds.
132 * kjs/JSGlobalObject.h: Don't store a reference to an Identifier
133 in GlobalPropertyInfo as the Identifier is likely to be a temporary
134 and therefore may be destroyed before the GlobalPropertyInfo.
136 2008-05-22 Kevin McCullough <kmccullough@apple.com>
143 2008-05-22 Kevin McCullough <kmccullough@apple.com>
147 <rdar://problem/5951561> Turn on JavaScript Profiler
148 Get basic JS profiling working.
149 Even with this patch the profiler will not be compiled in because we do
150 not know the extend, if any, of the performance regression it would cause
151 when it is not in use. However with these changes, if the profiler were
152 on, it would not crash and show good profiling data.
154 * VM/Machine.cpp: Instrument the calls sites that are needed for profiling.
156 (KJS::Machine::unwindCallFrame):
157 (KJS::Machine::execute):
158 (KJS::Machine::privateExecute):
159 * kjs/function.cpp: Ditto.
160 (KJS::globalFuncEval):
161 * kjs/interpreter.cpp: Ditto.
162 (KJS::Interpreter::evaluate):
163 * profiler/Profile.cpp:
164 (KJS::Profile::willExecute):
165 (KJS::Profile::didExecute): Because we do not get a good context when
166 startProfiling is called it is possible that m_currentNode will be at the
167 top of the known stack when a didExecute() is called. What we then do is
168 create a new node that represents the function being exited and insert
169 it between the head and the currently known children, since they should
170 be children of this new node.
171 * profiler/ProfileNode.cpp:
172 (KJS::ProfileNode::ProfileNode):
173 (KJS::ProfileNode::willExecute): Rename the add function for consistency.
174 (KJS::ProfileNode::addChild): Appends the child to this node but also
175 sets the parent pointer of the children to this node.
176 (KJS::ProfileNode::insertNode): Insert a node between this node and its
177 children. Also set the time for the new node since it is now exiting
178 and we don't really know when it started.
179 (KJS::ProfileNode::stopProfiling):
180 (KJS::ProfileNode::startTimer):
181 * profiler/ProfileNode.h:
182 (KJS::CallIdentifier::toString): Added for debugging.
183 (KJS::ProfileNode::setParent):
184 (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the
185 visibleTotalTime not the visibleSelfTime.
186 (KJS::ProfileNode::children):
187 (KJS::ProfileNode::toString): Added for debugging.
188 * profiler/Profiler.cpp: remove unecessary calls.
189 (KJS::Profiler::startProfiling):
191 2008-05-22 Sam Weinig <sam@webkit.org>
193 Reviewed by Oliver Hunt.
195 Rename register arguments for op_call, op_call_eval, op_end, and op_construct
196 to document what they are for.
198 * VM/CodeGenerator.cpp:
199 (KJS::CodeGenerator::emitCall):
200 (KJS::CodeGenerator::emitCallEval):
201 (KJS::CodeGenerator::emitEnd):
202 (KJS::CodeGenerator::emitConstruct):
203 * VM/CodeGenerator.h:
205 (KJS::Machine::privateExecute):
207 2008-05-22 Oliver Hunt <oliver@apple.com>
211 Bug 19116: SquirrelFish shouldn't regress on variable lookups
212 <https://bugs.webkit.org/show_bug.cgi?id=19116>
214 Last of the multiscope look up optimisations. This is a wash overall on SunSpider
215 but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
216 ... applied to any non-local var).
219 (KJS::PostIncResolveNode::emitCode):
220 (KJS::PostDecResolveNode::emitCode):
221 (KJS::PreIncResolveNode::emitCode):
222 (KJS::PreDecResolveNode::emitCode):
223 (KJS::ReadModifyResolveNode::emitCode):
225 2008-05-22 David Kilzer <ddkilzer@apple.com>
227 <rdar://problem/5954233> Add method to release free memory from FastMalloc
229 Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
231 * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
232 * wtf/FastMalloc.cpp:
233 (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
234 system malloc and FastMalloc code paths.
235 * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
237 2008-05-22 Oliver Hunt <oliver@apple.com>
241 Roll out r34020 as it causes recursion tests to fail.
244 (KJS::JSObject::call):
246 2008-05-22 Oliver Hunt <oliver@apple.com>
250 Don't leak the SymbolTable when compiling eval code.
253 (KJS::EvalNode::generateCode):
255 2008-05-22 Simon Hausmann <hausmann@webkit.org>
261 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
262 * VM/LabelID.h: Include limits.h for UINT_MAX.
263 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
265 2008-05-22 Geoffrey Garen <ggaren@apple.com>
267 Reviewed by Adam Roben.
269 Removed the old recursion guard mechanism, since squirrelfish has its
270 own mechanism. Also removed some old JS call tracing code, since we
271 have other ways to do that, too.
273 SunSpider reports no change.
276 (KJS::JSObject::call):
278 2008-05-22 Maciej Stachowiak <mjs@apple.com>
282 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
285 (KJS::WithNode::emitCode):
286 (KJS::TryNode::emitCode):
288 2008-05-21 Kevin McCullough <kmccullough@apple.com>
290 Reviewed by Maciej and Geoff.
292 <rdar://problem/5951561> Turn on JavaScript Profiler
293 -As part of the effort to turn on the profiler it would be helpful if it
294 did not need ExecStates to represent the stack location of the currently
296 -We now create each node as necessary with a reference to the current
297 node and each node knows its parent so that the tree can be made without
300 * profiler/Profile.cpp:
301 (KJS::Profile::Profile): The current node starts at the head.
302 (KJS::Profile::stopProfiling): The current node is cleared when profiling
304 (KJS::Profile::willExecute): The current node either adds a new child or
305 starts and returns a reference to an already existing child if the call
306 ID that is requested already exists.
307 (KJS::Profile::didExecute): The current node finishes and returns its
309 * profiler/Profile.h: Use a single callIdentifier instead of a vector
310 since we no longer use the whole stack.
311 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
313 (KJS::ProfileNode::ProfileNode): Initialize the parent.
314 (KJS::ProfileNode::didExecute): Record the time and return the parent.
315 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
316 already a child, start it and return it, otherwise create a new one and
318 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
319 * profiler/ProfileNode.h: Utilize the parent.
320 (KJS::ProfileNode::create):
321 (KJS::ProfileNode::parent):
322 * profiler/Profiler.cpp:
323 (KJS::Profiler::startProfiling): Here is the only place where the
324 ExecState is used to figure out where in the stack the profiler is
326 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
328 (KJS::Profiler::willExecute): Ditto.
329 (KJS::Profiler::didExecute): Ditto.
330 (KJS::createCallIdentifier): Create only one CallIdentifier.
331 (KJS::createCallIdentifierFromFunctionImp): Ditto.
332 * profiler/Profiler.h:
334 2008-05-21 Darin Adler <darin@apple.com>
338 - https://bugs.webkit.org/show_bug.cgi?id=19180
339 speed up the < operator for the case when both values are integers
341 Makes standalone SunSpider 1.022x faster.
344 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
346 2008-05-21 Maciej Stachowiak <mjs@apple.com>
348 Reviewed by Oliver and Sam.
350 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
352 Track global this value in the scope chain so we can retrieve it
353 efficiently but it follows lexical scope properly.
356 (KJS::ExecState::globalThisValue):
357 * kjs/JSGlobalObject.h:
358 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
359 * kjs/function_object.cpp:
360 (KJS::FunctionObjectImp::construct):
362 (KJS::ScopeChainNode::ScopeChainNode):
363 (KJS::ScopeChainNode::globalThisObject):
364 (KJS::ScopeChainNode::push):
365 (KJS::ScopeChain::ScopeChain):
367 2008-05-21 Kevin McCullough <kmccullough@apple.com>
373 2008-05-21 Kevin McCullough <kmccullough@apple.com>
377 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
379 - This patch updatest the times of the visible nodes correctly, but to do
380 so, some of the design of the ProfileNode changed.
382 * JavaScriptCore.exp: export focus' symbol.
383 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
384 the profile tree to get up-to-date accurate total profile time.
385 (KJS::Profile::Profile): Pass 0 for the head node.
386 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
387 passed into it, since it can get it from the head and it does not need to
388 be told it is the head because it can figure it out on it's own.
389 (KJS::Profile::willExecute): Set the head node for each created node.
390 * profiler/Profile.h:
391 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
392 would have to create, now focus() takes a ProfileNode that they should
393 already have a reference to and focus() can extract the CallIdentifier
395 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
396 total and self times for focus and exclude. Also add a head node
397 reference so that nodes can get information from their head.
398 (KJS::ProfileNode::ProfileNode):
399 (KJS::ProfileNode::stopProfiling): Rename the total and self time
400 variables and set the visual ones to the actual ones, so that without any
401 changes to the visual versions of these variables, their times will match
403 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
404 to be visible if this node is visible. If this node does not match the
405 CallIdentifier being focused then the visibleTotalTime is only updated if
406 one or more of it's children is the CallIdentifier being focused.
407 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
408 the visible data in the ProfileNode.
409 (KJS::ProfileNode::endAndRecordCall): Name change.
410 (KJS::ProfileNode::debugPrintData): Dump the new variables.
411 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
412 * profiler/ProfileNode.h: Use the new variables and reference to the head
414 (KJS::ProfileNode::create):
415 (KJS::ProfileNode::totalTime):
416 (KJS::ProfileNode::setTotalTime):
417 (KJS::ProfileNode::selfTime):
418 (KJS::ProfileNode::setSelfTime):
419 (KJS::ProfileNode::totalPercent):
420 (KJS::ProfileNode::selfPercent):
421 (KJS::ProfileNode::setVisible):
423 2008-05-21 Alp Toker <alp@nuanti.com>
425 GTK+/UNIX testkjs build fix. Include signal.h.
429 2008-05-21 Oliver Hunt <oliver@apple.com>
431 Reviewed by NOBODY (Build fix).
433 Yet more windows build fixes
435 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
437 2008-05-21 Oliver Hunt <oliver@apple.com>
439 Reviewed by NOBODY (Build fix).
441 Yet more windows build fixes
443 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
445 2008-05-21 Alp Toker <alp@nuanti.com>
447 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
448 changes into account.
452 2008-05-21 Oliver Hunt <oliver@apple.com>
454 Reviewed by NOBODY (Build fix).
456 Add DebuggerCallFrame.{h,cpp} to the project file
458 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
460 2008-05-21 Alp Toker <alp@nuanti.com>
462 GTK+ port build fixes following squirrelfish merge r33979.
466 2008-05-21 Maciej Stachowiak <mjs@apple.com>
470 - save a hash lookup wne writing to global properties
471 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
474 (KJS::resolveBase): Check for being a the end of the scope chain
477 2008-05-21 Alp Toker <alp@nuanti.com>
479 Rubber-stamped by Maciej.
481 Replace non-standard #pragma marks with comments to avoid compiler
484 * profiler/ProfileNode.cpp:
486 2008-05-21 Geoffrey Garen <ggaren@apple.com>
488 Reviewed by Mark Rowe.
490 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
492 * JavaScriptCore.exp:
493 * kjs/JSGlobalObject.cpp:
494 (KJS::JSGlobalObject::defineGetter):
495 (KJS::JSGlobalObject::defineSetter):
496 * kjs/JSGlobalObject.h:
498 === End merge of squirrelfish ===
500 2008-05-21 Geoffrey Garen <ggaren@apple.com>
502 Reviewed by Tim Hatcher.
504 Merged with trunk WebCore's new debugger.
506 * kjs/DebuggerCallFrame.cpp:
507 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
508 the exception value from the return value. The WebKit debugger treats
509 them as one, but the WebCore debugger doesn't.
511 * kjs/DebuggerCallFrame.h:
512 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
513 the dynamic global object, since the debugger doesn't want the lexical
516 2008-05-21 Oliver Hunt <oliver@apple.com>
520 Bug 19116: SquirrelFish shouldn't regress on variable lookups
521 <https://bugs.webkit.org/show_bug.cgi?id=19116>
523 Optimise cross scope assignment, 0.4% progression in sunspider.
526 (KJS::CodeBlock::dump):
527 * VM/CodeGenerator.cpp:
528 (KJS::CodeGenerator::emitPutScopedVar):
529 * VM/CodeGenerator.h:
531 (KJS::Machine::privateExecute):
534 (KJS::AssignResolveNode::emitCode):
536 2008-05-21 Maciej Stachowiak <mjs@apple.com>
540 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
541 0.5% speedup on SunSpider
543 * kjs/JSGlobalObject.h:
544 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
545 because symbol table access is likely to have been optimized.
547 2008-05-21 Oliver Hunt <oliver@apple.com>
551 Bug 19116: SquirrelFish shouldn't regress on variable lookups
552 <https://bugs.webkit.org/show_bug.cgi?id=19116>
554 Optimise multiscope lookup of statically resolvable function calls.
555 SunSpider reports a 1.5% improvement, including 37% on
556 controlflow-recursive for some reason :D
559 (KJS::CodeBlock::dump):
560 * VM/CodeGenerator.cpp:
561 (KJS::CodeGenerator::emitResolve):
562 * VM/CodeGenerator.h:
564 (KJS::FunctionCallResolveNode::emitCode):
566 2008-05-21 Maciej Stachowiak <mjs@apple.com>
570 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
571 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
573 * JavaScriptCore.exp:
574 * kjs/JSGlobalObject.h:
575 (KJS::JSGlobalObject::getOwnPropertySlot):
576 * kjs/JSVariableObject.h:
577 (KJS::JSVariableObject::symbolTableGet):
579 (KJS::JSObject::getDirectLocation):
580 (KJS::JSObject::getOwnPropertySlotForWrite):
581 * kjs/property_map.cpp:
582 (KJS::PropertyMap::getLocation):
583 * kjs/property_map.h:
584 * kjs/property_slot.h:
585 (KJS::PropertySlot::putValue):
587 2008-05-20 Oliver Hunt <oliver@apple.com>
591 Bug 19116: SquirrelFish shouldn't regress on variable lookups
592 <https://bugs.webkit.org/show_bug.cgi?id=19116>
594 This restores multiscope optimisation to simple resolve, producing
595 a 2.6% progression in SunSpider. Have verified that none of the
596 sites broken by the multiscope optimisation in trunk were effected
600 (KJS::CodeBlock::dump):
602 (KJS::CodeBlock::CodeBlock):
603 * VM/CodeGenerator.cpp:
604 (KJS::CodeGenerator::findScopedProperty):
605 (KJS::CodeGenerator::emitResolve):
606 * VM/CodeGenerator.h:
609 (KJS::Machine::privateExecute):
611 * kjs/JSVariableObject.h:
613 2008-05-20 Oliver Hunt <oliver@apple.com>
615 Reviewed by NOBODY (Build fix).
617 Fixerate the windows build.
619 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
620 * VM/CodeGenerator.cpp:
622 * kjs/JSGlobalObject.h:
626 2008-05-20 Oliver Hunt <oliver@apple.com>
630 Bug 19110: SquirrelFish: Google Maps - no maps
631 <https://bugs.webkit.org/show_bug.cgi?id=19110>
633 Correct a comedy of errors present in my original patch to "fix"
634 exceptions occurring midway through pre and post increment. This
635 solution is cleaner than the original, doesn't need the additional
636 opcodes, and as an added benefit does not break Google Maps.
638 Sunspider reports a 0.4% progression.
641 (KJS::CodeBlock::dump):
642 * VM/CodeGenerator.cpp:
643 * VM/CodeGenerator.h:
645 (KJS::Machine::privateExecute):
648 (KJS::PreIncResolveNode::emitCode):
649 (KJS::PreDecResolveNode::emitCode):
650 (KJS::PreIncBracketNode::emitCode):
651 (KJS::PreDecBracketNode::emitCode):
652 (KJS::PreIncDotNode::emitCode):
653 (KJS::PreDecDotNode::emitCode):
655 2008-05-20 Maciej Stachowiak <mjs@apple.com>
659 - inline JSGlobalObject::getOwnPropertySlot
660 1% improvement on in-browser SunSpider (a wash command-line)
662 * kjs/JSGlobalObject.cpp:
663 * kjs/JSGlobalObject.h:
664 (KJS::JSGlobalObject::getOwnPropertySlot):
666 2008-05-18 Oliver Hunt <oliver@apple.com>
670 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
671 <https://bugs.webkit.org/show_bug.cgi?id=18752>
673 Handle exceptions thrown by toString conversion in subscript operators,
674 this should basically complete exception handling in SquirrelFish.
676 Sunspider reports no regression.
679 (KJS::Machine::privateExecute):
681 2008-05-17 Geoffrey Garen <ggaren@apple.com>
683 Reviewed by Oliver Hunt.
685 [Reapplying patch with previously missing files from r33553 -- Oliver]
689 SunSpider reports no change.
691 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
692 and created a debugger folder.
694 * VM/CodeGenerator.cpp:
695 (KJS::CodeGenerator::generate): If the debugger is attached, always
696 generate full scope chains for its sake.
699 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
700 due to an exception, so it doesn't keep stale call frames around.
702 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
703 debugger can distinguish them from function call frames.
705 (KJS::Machine::debug): Simplified this function, since the debugger
706 doesn't actually need all the information we used to provide.
708 (KJS::Machine::privateExecute): Treat debugging hooks like other function
709 calls, so the code we hook into (the debugger UI) can be optimized.
711 * kjs/debugger.cpp: Nixed these default callback implementations and
712 made the callbacks pure virtual instead, so the compiler could tell me
713 if I made a mistake in one of the subclasses.
715 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
716 callbacks. Changed from passing an ExecState* to passing a
717 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
721 (KJS::globalFuncEval): Easiest bug fix evar!
723 [Previously missing files from r33553]
724 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
725 (KJS::DebuggerCallFrame::functionName):
726 (KJS::DebuggerCallFrame::thisObject):
727 (KJS::DebuggerCallFrame::evaluateScript):
728 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
729 (KJS::DebuggerCallFrame::DebuggerCallFrame):
730 (KJS::DebuggerCallFrame::scopeChain):
731 (KJS::DebuggerCallFrame::exception):
733 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
737 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
738 <https://bugs.webkit.org/show_bug.cgi?id=18991>
740 Fix the last remaining blocking cases of this bug.
744 (KJS::ReadModifyResolveNode::emitCode):
746 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
752 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
753 <https://bugs.webkit.org/show_bug.cgi?id=18991>
755 Ensure that the code generated for assignments uses temporaries whenever
756 necessary. This patch covers the vast majority of situations, but there
757 are still a few left.
759 This patch also adds some missing cases to CodeBlock::dump().
762 (KJS::CodeBlock::dump):
763 * VM/CodeGenerator.h:
764 (KJS::CodeGenerator::destinationForAssignResult):
765 (KJS::CodeGenerator::leftHandSideNeedsCopy):
766 (KJS::CodeGenerator::emitNodeForLeftHandSide):
770 (KJS::AssignDotNode::emitCode):
771 (KJS::ReadModifyDotNode::emitCode):
772 (KJS::AssignBracketNode::emitCode):
773 (KJS::ReadModifyBracketNode::emitCode):
774 (KJS::ForInNode::ForInNode):
776 (KJS::ReadModifyResolveNode::):
777 (KJS::AssignResolveNode::):
778 (KJS::ReadModifyBracketNode::):
779 (KJS::AssignBracketNode::):
780 (KJS::AssignDotNode::):
781 (KJS::ReadModifyDotNode::):
783 2008-05-17 Oliver Hunt <oliver@apple.com>
787 Bug 19106: SquirrelFish: Activation is not marked correctly
788 <https://bugs.webkit.org/show_bug.cgi?id=19106>
790 We can't rely on the symbol table for a count of the number of globals
791 we need to mark as that misses duplicate parameters and 'this'. Now we
792 use the actual local register count from the codeBlock.
794 * kjs/JSActivation.cpp:
795 (KJS::JSActivation::mark):
797 2008-05-16 Oliver Hunt <oliver@apple.com>
801 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
802 <https://bugs.webkit.org/show_bug.cgi?id=19076>
804 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
805 to allocate the global 'this' register safely at any point after initialisation of the Global
808 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
809 support for the static slot optimisation for the global Math object which brings it to a 0.3%
812 * VM/CodeGenerator.cpp:
813 (KJS::CodeGenerator::programCodeThis):
814 (KJS::CodeGenerator::CodeGenerator):
815 (KJS::CodeGenerator::addParameter):
816 * VM/CodeGenerator.h:
818 (KJS::Machine::execute):
820 * kjs/JSGlobalObject.cpp:
821 (KJS::JSGlobalObject::reset):
822 * kjs/JSGlobalObject.h:
823 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
824 (KJS::JSGlobalObject::addStaticGlobals):
827 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
829 Reviewed by Oliver Hunt.
831 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
832 <https://bugs.webkit.org/show_bug.cgi?id=19098>
834 When doing code generation for a statement list, increase the reference
835 count on a register that might eventually be returned, so that it doesn't
836 get clobbered by a request for a new temporary.
839 (KJS::statementListEmitCode):
841 2008-05-16 Maciej Stachowiak <mjs@apple.com>
845 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
846 https://bugs.webkit.org/show_bug.cgi?id=19044
848 * kjs/JSActivation.cpp:
849 (KJS::JSActivation::copyRegisters): Use numLocals from the code
850 block rather than the size of the symbol table for the number of
851 registers to copy, to account for duplicate parameters and vars
852 with the same name as parameters (we still have potentially
853 suboptimal codegen in that we allocate a local register for the
854 var in the latter case but it is never used).
856 2008-05-15 Geoffrey Garen <ggaren@apple.com>
860 We regret to inform you that your program is crashing because you were
864 (KJS::Machine::privateExecute): Math is hard.
866 2008-05-14 Geoffrey Garen <ggaren@apple.com>
868 Reviewed by Oliver Hunt.
870 A little more debugger action: filled in op_debug. All debugger control
871 flow works now, but variable inspection and backtraces still don't.
873 SunSpider reports no change.
875 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
878 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
879 NEVER_INLINE function to avoid a stunning 10% performance regression.
880 Also factored out a common function for retrieving the function and
881 arguments from a call frame.
883 * kjs/JSActivation.cpp:
884 (KJS::JSActivation::createArgumentsObject): Use the new factored out
885 function mentioned above.
888 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
889 sourceId we send to the debugger matches the sourceId recorded in the
892 * kjs/nodes.cpp: Emit debugging hooks.
894 2008-05-14 Oliver Hunt <oliver@apple.com>
898 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
899 <https://bugs.webkit.org/show_bug.cgi?id=19024>
901 This fixes a number of issues. The most important is that we now check every register
902 file for tainting rather than just looking for function register files as that was
903 insufficient. Additionally guarded against implicit re-entry into Eval code.
905 Also added a few additional assertions to reduce the amout of time between something
906 going wrong and us seeing the error.
909 (KJS::Machine::execute):
910 (KJS::Machine::privateExecute):
911 * VM/RegisterFile.cpp:
912 (KJS::RegisterFile::growBuffer):
913 (KJS::RegisterFile::addGlobalSlots):
914 * VM/RegisterFileStack.cpp:
915 (KJS::RegisterFileStack::pushGlobalRegisterFile):
916 (KJS::RegisterFileStack::pushFunctionRegisterFile):
917 * VM/RegisterFileStack.h:
918 (KJS::RegisterFileStack::inImplicitCall):
920 2008-05-14 Geoffrey Garen <ggaren@apple.com>
922 Reviewed by Oliver Hunt.
924 A little more debugger action: emit opcodes for debugger hooks. Right
925 now, the opcode implementation is just a stub.
927 SunSpider reports no change.
929 Some example codegen for "function f() { 1; }":
931 [ 0] dbg DidEnterCallFrame
932 [ 2] dbg WillExecuteStatement
933 [ 4] load tr0, 1(@k0)
934 [ 7] load tr0, undefined(@k1)
935 [ 10] dbg WillLeaveCallFrame
938 2008-05-14 Oliver Hunt <oliver@apple.com>
942 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
943 <https://bugs.webkit.org/show_bug.cgi?id=19025>
945 Simple fix -- move the use of functionBodyNode to after the null check.
947 * kjs/function_object.cpp:
948 (KJS::FunctionObjectImp::construct):
950 2008-05-13 Geoffrey Garen <ggaren@apple.com>
952 Reviewed by Oliver Hunt.
954 Fixed a codegen crash with run-time parse errors.
956 SunSpider reports no change.
958 emitThrowError needs to return the temporary holding the error, not dst,
959 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
960 parameter at all, since exceptions should not modify the destination
963 2008-05-13 Oliver Hunt <oliver@apple.com>
967 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
968 <https://bugs.webkit.org/show_bug.cgi?id=19027>
970 This fixes the codegen issues for the pre-inc/decrement operators
971 to prevent incorrectly clobbering the destination in the event of
975 (KJS::CodeBlock::dump):
976 * VM/CodeGenerator.cpp:
977 (KJS::CodeGenerator::emitPreInc):
978 (KJS::CodeGenerator::emitPreDec):
979 * VM/CodeGenerator.h:
981 (KJS::Machine::privateExecute):
984 (KJS::PreIncResolveNode::emitCode):
985 (KJS::PreDecResolveNode::emitCode):
986 (KJS::PreIncBracketNode::emitCode):
987 (KJS::PreDecBracketNode::emitCode):
988 (KJS::PreIncDotNode::emitCode):
989 (KJS::PreDecDotNode::emitCode):
991 2008-05-13 Geoffrey Garen <ggaren@apple.com>
993 Reviewed by Oliver Hunt.
995 A little more debugger action: supply a real line number, sourceId,
996 and sourceURL in op_new_error.
998 SunSpider reports a .2% speedup. Not sure what that's about.
1001 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
1004 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
1007 2008-05-13 Geoffrey Garen <ggaren@apple.com>
1009 Reviewed by Oliver Hunt.
1011 A little more debugger action: implemented the exception callback.
1013 SunSpider reports a .2% speedup. Not sure what that's about.
1015 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
1016 owner ScopeNode so we can retrieve data from it. This allows us to
1017 stop storing copies of the data ourselves. Also, store a "this" register
1018 instead of a code type, since we were only using the code type to
1019 calculate the "this" register.
1021 * VM/CodeGenerator.cpp:
1022 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
1023 above. Also, take care of removing "this" from the symbol table after
1024 codegen is done, since relying on the timing of a destructor for correct
1025 behavior is not so good.
1028 (KJS::Machine::throwException): Invoke the debugger's exception callback.
1029 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
1031 2008-05-13 Geoffrey Garen <ggaren@apple.com>
1033 Reviewed by Oliver Hunt.
1035 Removed some unused exception machinery.
1037 SunSpider reports a .3% speedup.
1039 * API/JSCallbackObject.h:
1040 * API/JSCallbackObjectFunctions.h:
1041 * JavaScriptCore.exp:
1043 (KJS::Machine::privateExecute):
1049 2008-05-13 Geoffrey Garen <ggaren@apple.com>
1051 Reviewed by Oliver Hunt.
1053 A little more debugger action.
1056 * kjs/debugger.h: Removed debuggersPresent because it was unused.
1057 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
1058 is faster and simpler. Changed all functions to return void instead of
1059 bool, because no clients ever return false, and we don't want to support
1062 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
1063 (KJS::Node::handleException):
1064 (KJS::BreakpointCheckStatement::execute):
1065 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
1067 2008-05-13 Oliver Hunt <oliver@apple.com>
1071 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
1072 <https://bugs.webkit.org/show_bug.cgi?id=18752>
1074 Replace old attempt at "branchless" exceptions as the extra information
1075 being passed made gcc an unhappy compiler, replacing these custom toNumber
1076 calls with ordinary toNumber logic (by relying on toNumber now preventing
1077 side effects after an exception has been thrown) provided sufficient leeway
1078 to add the additional checks for the remaining unchecked cases.
1080 This leaves only toString conversions in certain contexts as possibly
1086 (KJS::resolveBaseAndProperty):
1087 (KJS::resolveBaseAndFunc):
1088 (KJS::Machine::privateExecute):
1091 (KJS::JSValue::safeGetNumber):
1093 2008-05-13 Geoffrey Garen <ggaren@apple.com>
1095 Reviewed by Oliver Hunt.
1097 First steps toward supporting the debugger API: support the sourceParsed
1098 callback; plus some minor fixups.
1100 SunSpider reports no regression.
1102 * VM/CodeGenerator.h: Removed a misleading comment.
1104 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
1105 implement the sourceParsed callback -- that way, we only have to
1106 implement the callback in one place.
1108 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
1109 was to demonstrate the misapplication of design patterns.
1111 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
1112 reduce copying, and not to return a value, because pausing execution
1113 after parsing is complicated, and no clients needed that ability, anyway.
1115 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
1116 didFinishParsing -- that simplifies some code down the road.
1118 * kjs/nodes.cpp: Don't generate special AST nodes just because the
1119 debugger is attached -- that's a relic of the old AST execution model,
1120 and those nodes haven't been maintained.
1122 2008-05-13 Oliver Hunt <oliver@apple.com>
1126 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
1127 <https://bugs.webkit.org/show_bug.cgi?id=18752>
1129 First step: prevent incorrect evaluation of valueOf/toString conversion
1130 in right hand side of expression after earlier conversion throws.
1132 * API/JSCallbackObjectFunctions.h:
1135 (KJS::JSObject::defaultValue):
1137 2008-05-12 Oliver Hunt <oliver@apple.com>
1141 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
1142 <https://bugs.webkit.org/show_bug.cgi?id=18934>
1144 Unfortunately we cannot create new statically optimised globals if there are any
1145 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
1146 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
1149 (KJS::Machine::execute):
1150 * VM/RegisterFileStack.cpp:
1151 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1152 * VM/RegisterFileStack.h:
1154 2008-05-12 Geoffrey Garen <ggaren@apple.com>
1156 Reviewed by Maciej Stachowiak.
1158 Introduced support for function.caller.
1160 Improved support for walking interesting scopes for function introspection.
1162 This fixes all remaining layout tests not blocked by rebasing to trunk.
1164 SunSpider reports no change.
1167 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
1169 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1173 Bug 18961: SQUIRRELFISH: Gmail doesn't load
1174 <https://bugs.webkit.org/show_bug.cgi?id=18961>
1176 Fix codegen for logical nodes so that they don't use their destination
1180 (KJS::LogicalAndNode::emitCode):
1181 (KJS::LogicalOrNode::emitCode):
1183 2008-05-10 Maciej Stachowiak <mjs@apple.com>
1187 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
1188 https://bugs.webkit.org/show_bug.cgi?id=18869
1190 Three layout tests are fixed:
1191 fast/js/toString-elision-trailing-comma.html
1192 fast/js/toString-prefix-postfix-preserve-parens.html
1193 fast/js/kde/lval-exceptions.html
1195 Functions now save a shared subrange of the original source used
1196 to make them (so in the common case this adds no storage above the
1199 * kjs/SourceProvider.h: Added.
1200 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
1201 to the source for a JavaScript program. This allows function objects to have access to their
1202 original source without copying.
1203 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
1204 (KJS::UStringSourceProvider::create):
1205 (KJS::UStringSourceProvider::getRange):
1206 (KJS::UStringSourceProvider::data):
1207 (KJS::UStringSourceProvider::length):
1208 (KJS::UStringSourceProvider::UStringSourceProvider):
1209 * kjs/SourceRange.h: Added.
1210 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
1211 the source, to encapsulate on-demand access to the source of a function.
1212 (KJS::SourceRange::toString):
1214 (KJS::eval): Pass a UStringSourceProvider to the parser.
1216 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
1218 (KJS::Parser::parse): Take a SourceProvider.
1220 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
1221 use it to get the raw buffer and length.
1223 (KJS::Lexer::sourceRange): Convenience function to get a source
1224 range based on the lexer's source provieder, and char offsets
1225 right before and after the desired range.
1227 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
1228 * kjs/function_object.cpp:
1229 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
1230 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
1231 * kjs/grammar.y: When parsing a function declaration, function
1232 expression, or getter or setter, tell the function body about its
1234 * kjs/interpreter.cpp:
1235 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
1236 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
1237 * kjs/interpreter.h:
1239 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
1240 (KJS::FunctionBodyNode::toSourceString): Get the source string out
1242 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
1243 (KJS::FuncDeclNode::): ditto
1245 (prettyPrintScript): Use a SourceProvider appropriately.
1246 * JavaScriptCore.exp: Export new symbols.
1247 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
1248 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
1250 2008-05-09 Oliver Hunt <oliver@apple.com>
1254 Bring back RegisterFile tainting in order to correctly handle
1255 natively implemented getters and setters that re-enter JavaScript
1258 (KJS::Machine::privateExecute):
1259 * VM/RegisterFile.h:
1261 (KJS::FunctionImp::callAsFunction):
1263 (KJS::JSObject::put):
1264 (KJS::tryGetAndCallProperty):
1265 * kjs/property_slot.cpp:
1266 (KJS::PropertySlot::functionGetter):
1268 2008-05-09 Maciej Stachowiak <mjs@apple.com>
1272 - track character offsets of open and close braces, in preparation for saving function source
1274 I verified that there is no performance regression from this change.
1279 (KJS::Lexer::matchPunctuator):
1282 2008-05-09 Oliver Hunt <oliver@apple.com>
1284 Reviewed by Nobody (build fix).
1288 * kjs/JSGlobalObject.cpp:
1289 (KJS::JSGlobalObject::restoreLocalStorage):
1291 2008-05-09 Oliver Hunt <oliver@apple.com>
1295 Build fixes for SquirrelFish on windows.
1297 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1298 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1300 * kjs/JSGlobalObject.cpp:
1301 (KJS::JSGlobalObject::restoreLocalStorage):
1302 * kjs/collector.cpp:
1303 (KJS::Collector::allocate):
1304 (KJS::Collector::allocateNumber):
1306 (KJS::Collector::allocate):
1307 (KJS::Collector::allocateNumber):
1308 * kjs/property_slot.cpp:
1310 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1314 - fix activation tearoff in the case where functions are called with too many arguments
1317 fast/canvas/patternfill-repeat.html
1318 fast/dom/SelectorAPI/bug-17313.html
1321 (KJS::slideRegisterWindowForCall):
1322 (KJS::scopeChainForCall):
1323 (KJS::Machine::execute):
1324 (KJS::Machine::privateExecute):
1326 2008-05-08 Geoffrey Garen <ggaren@apple.com>
1328 Reviewed by Oliver Hunt.
1330 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
1332 SunSpider reports a small speedup. Not sure what that's about.
1335 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
1336 This helped me while debugging.
1339 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
1340 off, don't use the scope chain. Inside eval, the scope chain doesn't
1341 belong to us; it belongs to our calling function.
1343 Also, don't use the needsFullScopeChain flag to decide whether to tear
1344 off the activation. "function.arguments" can create an activation
1345 for a function whose needsFullScopeChain flag is set to false.
1347 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1351 - fix function.call for calls of more than 8 arguments
1353 Fixes svg/carto.net/button.svg
1356 (KJS::List::getSlice): properly set up the m_buffer of the target list.
1358 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1362 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
1365 - fast/regex/early-acid3-86.html
1366 - http/tests/misc/acid3.html
1369 (KJS::RegExpNode::emitCode):
1371 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1375 Fix a performance regression caused by the introduction of property
1376 attributes to SymbolTable in r32859 by encoding the attributes and the
1377 register index into a single field of SymbolTableEntry.
1379 This leaves Node::optimizeVariableAccess() definitely broken, although
1380 it was probably not entirely correct in SquirrelFish before this change.
1383 (KJS::missingThisObjectMarker):
1384 * VM/CodeGenerator.cpp:
1385 (KJS::CodeGenerator::addVar):
1386 (KJS::CodeGenerator::CodeGenerator):
1387 (KJS::CodeGenerator::registerForLocal):
1388 (KJS::CodeGenerator::registerForLocalConstInit):
1389 (KJS::CodeGenerator::isLocalConstant):
1390 (KJS::CodeGenerator::addConstant):
1391 (KJS::CodeGenerator::emitCall):
1392 * VM/CodeGenerator.h:
1393 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
1395 (KJS::Machine::privateExecute):
1396 * kjs/JSGlobalObject.cpp:
1397 (KJS::JSGlobalObject::saveLocalStorage):
1398 * kjs/JSVariableObject.cpp:
1399 (KJS::JSVariableObject::getPropertyNames):
1400 (KJS::JSVariableObject::getPropertyAttributes):
1401 * kjs/JSVariableObject.h:
1402 (KJS::JSVariableObject::symbolTableGet):
1403 (KJS::JSVariableObject::symbolTablePut):
1404 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1405 * kjs/SymbolTable.h:
1406 (KJS::SymbolTableEntry::SymbolTableEntry):
1407 (KJS::SymbolTableEntry::isEmpty):
1408 (KJS::SymbolTableEntry::getIndex):
1409 (KJS::SymbolTableEntry::getAttributes):
1410 (KJS::SymbolTableEntry::setAttributes):
1411 (KJS::SymbolTableEntry::isReadOnly):
1413 (KJS::getSymbolTableEntry):
1414 (KJS::PostIncResolveNode::optimizeVariableAccess):
1415 (KJS::PostDecResolveNode::optimizeVariableAccess):
1416 (KJS::DeleteResolveNode::optimizeVariableAccess):
1417 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1418 (KJS::PreIncResolveNode::optimizeVariableAccess):
1419 (KJS::PreDecResolveNode::optimizeVariableAccess):
1420 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1421 (KJS::AssignResolveNode::optimizeVariableAccess):
1422 (KJS::ProgramNode::initializeSymbolTable):
1424 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1426 Rubber stamped by Oliver.
1428 - add missing ! in an assert that I failed to reverse
1430 * VM/CodeGenerator.cpp:
1431 (KJS::CodeGenerator::CodeGenerator):
1433 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1437 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
1438 https://bugs.webkit.org/show_bug.cgi?id=18868
1440 The basic approach is to have "this" only be present in the symbol
1441 table at compile time, not runtime.
1443 * VM/CodeGenerator.cpp:
1444 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
1445 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
1447 * VM/CodeGenerator.h:
1449 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
1451 2008-05-06 Geoffrey Garen <ggaren@apple.com>
1453 Reviewed by Oliver Hunt.
1455 Trivial support for function.arguments: Currently, we only support
1456 function.arguments from within the scope of function.
1458 This fixes the remaining Mozilla JS test failures.
1460 SunSpider reports no change.
1462 * JavaScriptCore.exp:
1465 (KJS::Machine::privateExecute): Separated scope chain deref from
1466 activation register copying: since it is now possible for client code
1467 to create an activation on behalf of a function that otherwise wouldn't
1468 need one, having an activation no longer necessarily means that you need
1469 to deref the scope chain.
1471 (KJS::Machine::getCallFrame): For now, this function only examines the
1472 current scope. Walking parent scopes requires some refactoring in the
1473 way we track execution stacks.
1475 * kjs/ExecState.cpp:
1476 (KJS::ExecState::ExecState): We use a negative call frame offset to
1477 indicate that a given scope is not a function call scope.
1479 2008-05-05 Oliver Hunt <oliver@apple.com>
1483 Fix call frame set up for native -> JS function calls.
1486 (KJS::Machine::execute):
1488 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1490 Reviewed by Maciej Stachowiak.
1492 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1494 SunSpider reports a .4% speedup. Not sure what that's about.
1497 (KJS::Machine::privateExecute): Check for exception return from equal,
1498 since toPrimitive can throw.
1500 * kjs/operations.cpp:
1501 (KJS::strictEqual): In response to an error I made in an earlier version
1502 of this patch, I changed strictEqual to make clear the fact that it
1503 performs no conversions and can't throw, making it slightly more efficient
1506 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1510 - fix some dumb mistakes in my last patch
1512 * VM/CodeGenerator.cpp:
1513 (KJS::CodeGenerator::emitPushScope):
1514 (KJS::CodeGenerator::emitGetPropertyNames):
1516 (KJS::Machine::privateExecute):
1518 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1522 - document opcodes relating to jumps, scopes, and property name iteration
1524 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1525 next_pname and jmp_scopes.
1527 * VM/CodeGenerator.cpp:
1528 (KJS::CodeGenerator::emitJump):
1529 (KJS::CodeGenerator::emitJumpIfTrue):
1530 (KJS::CodeGenerator::emitJumpIfFalse):
1531 (KJS::CodeGenerator::emitPushScope):
1532 (KJS::CodeGenerator::emitNextPropertyName):
1533 (KJS::CodeGenerator::emitGetPropertyNames):
1534 * VM/CodeGenerator.h:
1536 (KJS::Machine::privateExecute):
1538 (KJS::LogicalAndNode::emitCode):
1539 (KJS::LogicalOrNode::emitCode):
1540 (KJS::ConditionalNode::emitCode):
1541 (KJS::IfNode::emitCode):
1542 (KJS::IfElseNode::emitCode):
1543 (KJS::DoWhileNode::emitCode):
1544 (KJS::WhileNode::emitCode):
1545 (KJS::ForNode::emitCode):
1546 (KJS::ForInNode::emitCode):
1547 (KJS::WithNode::emitCode):
1549 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1553 Bug 18749: SQUIRRELFISH: const support is broken
1554 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1556 Adds support for const during code generation.
1558 Fixes 2 layout tests.
1561 * VM/CodeGenerator.cpp:
1562 (KJS::CodeGenerator::addVar):
1563 (KJS::CodeGenerator::CodeGenerator):
1564 (KJS::CodeGenerator::isLocalConstant):
1565 * VM/CodeGenerator.h:
1566 (KJS::CodeGenerator::addVar):
1568 (KJS::PostIncResolveNode::emitCode):
1569 (KJS::PostDecResolveNode::emitCode):
1570 (KJS::PreIncResolveNode::emitCode):
1571 (KJS::PreDecResolveNode::emitCode):
1572 (KJS::ReadModifyResolveNode::emitCode):
1573 (KJS::AssignResolveNode::emitCode):
1575 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1579 - document some more opcodes (and fix argument names)
1581 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1583 * VM/CodeGenerator.cpp:
1584 (KJS::CodeGenerator::emitEqual):
1585 (KJS::CodeGenerator::emitNotEqual):
1586 (KJS::CodeGenerator::emitStrictEqual):
1587 (KJS::CodeGenerator::emitNotStrictEqual):
1588 (KJS::CodeGenerator::emitLess):
1589 (KJS::CodeGenerator::emitLessEq):
1590 * VM/CodeGenerator.h:
1592 (KJS::Machine::privateExecute):
1594 (KJS::LessNode::emitCode):
1595 (KJS::GreaterNode::emitCode):
1596 (KJS::LessEqNode::emitCode):
1597 (KJS::GreaterEqNode::emitCode):
1598 (KJS::EqualNode::emitCode):
1599 (KJS::NotEqualNode::emitCode):
1600 (KJS::StrictEqualNode::emitCode):
1601 (KJS::NotStrictEqualNode::emitCode):
1602 (KJS::CaseBlockNode::emitCodeForBlock):
1604 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1606 Reviewed by Maciej Stachowiak.
1608 More scaffolding for f.arguments.
1610 Track the offset of the last call frame in the ExecState, so we can
1611 produce a backtrace at any time.
1613 Also, record numLocals, the sum of numVars + numParameters, in each code
1614 block, to make updates to the ExecState a little cheaper than they
1617 We now use numLocals in a bunch of places where we used to calculate
1618 numVars + numParameters or -numVars - numParameters.
1620 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1622 2008-05-04 Oliver Hunt <oliver@apple.com>
1626 Whoops, correctly handle properties that don't exist in the
1629 * kjs/JSVariableObject.h:
1630 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1632 2008-05-04 Oliver Hunt <oliver@apple.com>
1636 Add attribute information to SymbolTable as ground work for
1637 various DontEnum and ReadOnly issues.
1639 * VM/CodeGenerator.cpp:
1640 (KJS::CodeGenerator::addVar):
1641 (KJS::CodeGenerator::CodeGenerator):
1642 (KJS::CodeGenerator::registerForLocal):
1643 (KJS::CodeGenerator::registerForLocalConstInit):
1644 (KJS::CodeGenerator::addConstant):
1646 (KJS::Machine::execute):
1647 * kjs/JSGlobalObject.cpp:
1648 (KJS::JSGlobalObject::saveLocalStorage):
1649 * kjs/JSVariableObject.cpp:
1650 (KJS::JSVariableObject::getPropertyNames):
1651 (KJS::JSVariableObject::getPropertyAttributes):
1652 * kjs/JSVariableObject.h:
1653 (KJS::JSVariableObject::symbolTablePut):
1654 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1655 * kjs/SymbolTable.h:
1656 (KJS::SymbolTableEntry::SymbolTableEntry):
1657 (KJS::SymbolTableIndexHashTraits::emptyValue):
1659 (KJS::getSymbolTableEntry):
1660 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1661 (KJS::AssignResolveNode::optimizeVariableAccess):
1662 (KJS::ProgramNode::initializeSymbolTable):
1664 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1666 Reviewed by Oliver Hunt.
1668 More scaffolding for f.arguments.
1670 Store the register file associated with an ExecState in the ExecState.
1672 SunSpider reports no change.
1674 * kjs/JSGlobalObject.h:
1675 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1676 registerFileStack above globalExec, so it gets initialized first.
1677 Removed remnants of old activation scheme.
1679 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1681 Rubber stamped by Oliver.
1683 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1687 resolve_base_and_property --> resolve_with_base
1688 resolve_base_and_func --> resolve_func
1689 get_prop_id --> get_by_id
1690 put_prop_id --> put_by_id
1691 delete_prop_id --> del_by_id
1692 get_prop_val --> get_by_val
1693 put_prop_val --> put_by_val
1694 delete_prop_val --> del_by_val
1695 put_prop_index --> put_by_index
1698 (KJS::printUnaryOp):
1699 (KJS::printBinaryOp):
1700 (KJS::printConditionalJump):
1701 (KJS::CodeBlock::dump):
1702 * VM/CodeGenerator.cpp:
1703 (KJS::CodeGenerator::emitEqual):
1704 (KJS::CodeGenerator::emitNotEqual):
1705 (KJS::CodeGenerator::emitResolveWithBase):
1706 (KJS::CodeGenerator::emitResolveFunction):
1707 (KJS::CodeGenerator::emitGetById):
1708 (KJS::CodeGenerator::emitPutById):
1709 (KJS::CodeGenerator::emitDeleteById):
1710 (KJS::CodeGenerator::emitGetByVal):
1711 (KJS::CodeGenerator::emitPutByVal):
1712 (KJS::CodeGenerator::emitDeleteByVal):
1713 (KJS::CodeGenerator::emitPutByIndex):
1714 * VM/CodeGenerator.h:
1716 (KJS::Machine::privateExecute):
1719 (KJS::ArrayNode::emitCode):
1720 (KJS::PropertyListNode::emitCode):
1721 (KJS::BracketAccessorNode::emitCode):
1722 (KJS::DotAccessorNode::emitCode):
1723 (KJS::EvalFunctionCallNode::emitCode):
1724 (KJS::FunctionCallResolveNode::emitCode):
1725 (KJS::FunctionCallBracketNode::emitCode):
1726 (KJS::FunctionCallDotNode::emitCode):
1727 (KJS::PostIncResolveNode::emitCode):
1728 (KJS::PostDecResolveNode::emitCode):
1729 (KJS::PostIncBracketNode::emitCode):
1730 (KJS::PostDecBracketNode::emitCode):
1731 (KJS::PostIncDotNode::emitCode):
1732 (KJS::PostDecDotNode::emitCode):
1733 (KJS::DeleteResolveNode::emitCode):
1734 (KJS::DeleteBracketNode::emitCode):
1735 (KJS::DeleteDotNode::emitCode):
1736 (KJS::TypeOfResolveNode::emitCode):
1737 (KJS::PreIncResolveNode::emitCode):
1738 (KJS::PreDecResolveNode::emitCode):
1739 (KJS::PreIncBracketNode::emitCode):
1740 (KJS::PreDecBracketNode::emitCode):
1741 (KJS::PreIncDotNode::emitCode):
1742 (KJS::PreDecDotNode::emitCode):
1743 (KJS::ReadModifyResolveNode::emitCode):
1744 (KJS::AssignResolveNode::emitCode):
1745 (KJS::AssignDotNode::emitCode):
1746 (KJS::ReadModifyDotNode::emitCode):
1747 (KJS::AssignBracketNode::emitCode):
1748 (KJS::ReadModifyBracketNode::emitCode):
1749 (KJS::ConstDeclNode::emitCodeSingle):
1750 (KJS::ForInNode::emitCode):
1751 (KJS::TryNode::emitCode):
1753 2008-05-04 Oliver Hunt <oliver@apple.com>
1757 Fix assertion when accessing arguments object with too many arguments provided
1759 The arguments constructor was assuming that the register offset given for argv
1760 was an absolute offset into the registerfile, rather than the offset from the
1761 frame. This patches corrects that issue.
1763 * kjs/JSActivation.cpp:
1764 (KJS::JSActivation::createArgumentsObject):
1766 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1768 Rubber stamped by Sam Weinig.
1770 Cleaned up Machine.cpp according to our style guidelines: moved static
1771 data to the top of the file; moved stand-alone functions below that;
1772 moved the Machine constructor above other Machine member functions.
1774 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1778 - fix accidental breakage from last patch
1781 (KJS::Machine::privateExecute):
1783 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1787 - a bunch more opcode documentation and corresponding parameter name fixes
1789 I renamed a few opcodes:
1791 type_of --> typeof (that's what the JS operator is named)
1792 instance_of --> instanceof (ditto)
1793 create_error --> new_error (for consistency with other new_* opcodes)
1795 I documented the following opcodes:
1817 I also fixed formatting on some existing opcode docs.
1820 (KJS::CodeBlock::dump):
1821 * VM/CodeGenerator.cpp:
1822 (KJS::CodeGenerator::emitMove):
1823 (KJS::CodeGenerator::emitNot):
1824 (KJS::CodeGenerator::emitPreInc):
1825 (KJS::CodeGenerator::emitPreDec):
1826 (KJS::CodeGenerator::emitPostInc):
1827 (KJS::CodeGenerator::emitPostDec):
1828 (KJS::CodeGenerator::emitToJSNumber):
1829 (KJS::CodeGenerator::emitNegate):
1830 (KJS::CodeGenerator::emitBitNot):
1831 (KJS::CodeGenerator::emitInstanceOf):
1832 (KJS::CodeGenerator::emitTypeOf):
1833 (KJS::CodeGenerator::emitIn):
1834 (KJS::CodeGenerator::emitLoad):
1835 (KJS::CodeGenerator::emitNewObject):
1836 (KJS::CodeGenerator::emitNewArray):
1837 (KJS::CodeGenerator::emitNewRegExp):
1838 (KJS::CodeGenerator::emitNewError):
1839 * VM/CodeGenerator.h:
1840 (KJS::CodeGenerator::scopeDepth):
1841 (KJS::CodeGenerator::addVar):
1843 (KJS::Machine::privateExecute):
1846 (KJS::Node::emitThrowError):
1847 (KJS::RegExpNode::emitCode):
1848 (KJS::TypeOfValueNode::emitCode):
1849 (KJS::UnaryPlusNode::emitCode):
1850 (KJS::NegateNode::emitCode):
1851 (KJS::BitwiseNotNode::emitCode):
1852 (KJS::LogicalNotNode::emitCode):
1853 (KJS::InstanceOfNode::emitCode):
1854 (KJS::InNode::emitCode):
1856 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1858 Reviewed by Geoff and Sam.
1860 - generate HTML bytecode docs at build time
1862 * DerivedSources.make:
1864 * docs/make-bytecode-docs.pl: Added.
1866 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1868 Reviewed by Sam Weinig.
1870 Update ExecState::m_scopeChain when switching scope chains inside the
1873 This fixes uses of lexicalGlobalObject, such as, in a subframe
1875 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1877 and a bunch of the security failures listed in
1878 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1879 seemingly because of regressions in exception messages).
1881 SunSpider reports no change.
1883 * VM/Machine.cpp: Factored out scope chain updating into a common
1884 function that takes care to update ExecState::m_scopeChain, too.
1886 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1887 could update ExecState::m_scopeChain, even though that value is
1888 read-only for everyone else.
1890 * kjs/JSGlobalObject.h:
1891 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1892 this client to be a little friendlier to ExecState's internal
1893 storage type for scope chain data.
1895 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1897 Reviewed by Sam Weinig.
1899 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1900 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1902 SunSpider reports no change.
1905 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1906 since the direct threaded interpreter will goto across its destructor.
1908 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1910 Reviewed by Oliver Hunt.
1912 A bit more efficient fix than r32832: Don't copy globals into function
1913 register files; instead, have the RegisterFileStack track only the base
1914 of the last *global* register file, so the global object's register
1915 references stay good.
1917 SunSpider reports a .3% speedup. Not sure what that's about.
1919 2008-05-03 Oliver Hunt <oliver@apple.com>
1923 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1924 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1926 Add new opcodes to allow us to add getters and setters to an object. These are
1927 only used by the codegen for object literals.
1929 * VM/CodeGenerator.cpp:
1930 (KJS::CodeGenerator::emitPutGetter):
1931 (KJS::CodeGenerator::emitPutSetter):
1932 * VM/CodeGenerator.h:
1934 (KJS::Machine::privateExecute):
1937 (KJS::PropertyListNode::emitCode):
1939 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1943 - properly copy globals into and out of implicit call register
1944 files, otherwise they will fail at global lookup
1946 Fixes fast/js/array-tostring-and-join.html layout test.
1948 * VM/RegisterFileStack.cpp:
1949 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1950 (KJS::RegisterFileStack::popGlobalRegisterFile):
1951 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1952 (KJS::RegisterFileStack::popFunctionRegisterFile):
1954 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1956 Reviewed by Oliver Hunt.
1958 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1959 SQUIRRELFISH: incorrect eval used in some cases
1961 Changed all code inside the machine to fetch the lexical global object
1962 directly from the scope chain, instead of from the ExecState.
1964 Clients who fetch the lexical global object through the ExecState
1967 SunSpider reports no change.
1970 (KJS::Machine::privateExecute): Fetch the lexical global object from
1974 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1975 this function into ScopeChainNode, but kept this function around to
1976 support existing clients.
1978 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1980 Rubber stamped by Oliver Hunt.
1982 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1984 * JavaScriptCore.xcodeproj/project.pbxproj:
1985 * kjs/AllInOneFile.cpp:
1987 2008-05-01 Oliver Hunt <oliver@apple.com>
1989 Reviewed by Geoff and Maciej.
1991 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1992 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1994 Remove safe/unsafe RegisterFile concept, and instead just add additional
1995 logic to ensure we always push/pop RegisterFiles when executing getters
1996 and setters, similar to the logic for valueOf and toString.
1999 (KJS::Machine::privateExecute):
2000 * VM/RegisterFile.h:
2002 (KJS::FunctionImp::callAsFunction):
2004 (KJS::JSObject::put):
2005 * kjs/property_slot.cpp:
2006 (KJS::PropertySlot::functionGetter):
2008 2008-05-01 Oliver Hunt <oliver@apple.com>
2012 Rename unsafeForReentry to safeForReentry to avoid double negatives.
2015 (KJS::Machine::privateExecute):
2016 * VM/RegisterFile.h:
2018 (KJS::FunctionImp::callAsFunction):
2020 2008-05-01 Oliver Hunt <oliver@apple.com>
2024 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
2025 <https://bugs.webkit.org/show_bug.cgi?id=18827>
2027 This patch makes getters and setters work. It does this by
2028 tracking whether the RegisterFile is "safe", that is whether
2029 the interpreter is in a state that in which it can handle
2030 the RegisterFile being reallocated.
2034 (KJS::Machine::privateExecute):
2035 * VM/RegisterFile.h:
2037 (KJS::FunctionImp::callAsFunction):
2039 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2041 Release build fix: Always compile in "isGlobalObject", since it's
2042 listed in our .exp file.
2044 * kjs/ExecState.cpp:
2045 (KJS::ExecState::isGlobalObject):
2048 2008-04-30 Oliver Hunt <oliver@apple.com>
2052 Minor code restructuring to prepare for getters and setters,
2053 also helps exception semantics a bit.
2056 (KJS::Machine::privateExecute):
2058 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2064 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2066 Debug build fix: export a missing symbol.
2068 * JavaScriptCore.exp:
2070 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2072 Reviewed by Oliver Hunt.
2074 A little more ExecState refactoring: Now, only the global object creates
2077 Also inlined ExecState::lexicalGlobalObject().
2079 SunSpider reports no change.
2081 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2083 WebCore build fix: forward-declare ScopeChain.
2085 * kjs/interpreter.h:
2087 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2089 Build fix for JavaScriptGlue: export a missing symbol.
2091 * JavaScriptCore.exp:
2093 2008-04-30 Geoffrey Garen <ggaren@apple.com>
2095 Reviewed by Oliver Hunt.
2097 Removed a lot of unused bits from ExecState, moving them into
2098 OldInterpreterExecState, the fake scaffolding class.
2100 The clutter was making it hard to see the forest from the trees.
2102 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
2105 2008-04-29 Oliver Hunt <oliver@apple.com>
2109 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
2110 <https://bugs.webkit.org/show_bug.cgi?id=18643>
2112 Prevent static slot optimisation for new variables and functions in
2113 globally re-entrant code called from an an implicit function call.
2115 This is necessary to prevent us from needing to resize the global
2116 slot portion of the root RegisterFile during an implicit (and hence
2117 unguarded) function call.
2119 * VM/CodeGenerator.cpp:
2120 (KJS::CodeGenerator::CodeGenerator):
2121 * VM/CodeGenerator.h:
2123 (KJS::Machine::execute):
2124 * VM/RegisterFile.h:
2125 * VM/RegisterFileStack.cpp:
2126 (KJS::RegisterFileStack::pushGlobalRegisterFile):
2127 (KJS::RegisterFileStack::popGlobalRegisterFile):
2128 (KJS::RegisterFileStack::pushFunctionRegisterFile):
2129 (KJS::RegisterFileStack::popFunctionRegisterFile):
2130 * VM/RegisterFileStack.h:
2131 (KJS::RegisterFileStack::inImplicitFunctionCall):
2132 (KJS::RegisterFileStack::lastGlobal):
2134 (KJS::ProgramNode::generateCode):
2136 (KJS::ProgramNode::):
2138 2008-04-29 Geoffrey Garen <ggaren@apple.com>
2140 Reviewed by Oliver Hunt.
2142 In nested program code, don't propogate "this" back to the parent
2143 register file. ("this" should remain constant in the parent register
2144 file, regardless of the scripts it invokes.)
2146 * VM/RegisterFile.cpp:
2147 (KJS::RegisterFile::copyGlobals):
2149 2008-04-28 Oliver Hunt <oliver@apple.com>
2153 Restore base pointer when popping a global RegisterFile
2155 * VM/RegisterFileStack.cpp:
2156 (KJS::RegisterFileStack::popGlobalRegisterFile):
2158 2008-04-28 Oliver Hunt <oliver@apple.com>
2162 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
2163 <https://bugs.webkit.org/show_bug.cgi?id=18643>
2165 Partial fix. This results in all implicit calls to toString or valueOf
2166 executing in a separate RegisterFile, so ensuring that the the pointers
2167 in the triggering interpreter don't get trashed. This still leaves the
2168 task of preventing new global re-entry from toString and valueOf from
2169 clobbering the RegisterFile.
2172 (KJS::Machine::execute):
2173 * VM/RegisterFileStack.cpp:
2174 (KJS::RegisterFileStack::pushFunctionRegisterFile):
2175 (KJS::RegisterFileStack::popFunctionRegisterFile):
2176 * VM/RegisterFileStack.h:
2178 (KJS::tryGetAndCallProperty):
2180 2008-04-28 Geoffrey Garen <ggaren@apple.com>
2182 Reviewed by Maciej Stachowiak.
2184 Simplified activation object a bit: No need to store the callee
2185 in the activation object -- we can pull it out of the call frame
2186 when needed, instead.
2188 SunSpider reports no change.
2190 2008-04-28 Geoffrey Garen <ggaren@apple.com>
2192 Reviewed by Maciej Stachowiak.
2194 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
2196 Substantially more handling of "arguments": "arguments" works fully
2197 now, but "f.arguments" still doesn't work.
2199 Fixes 10 regression tests.
2201 SunSpider reports no regression.
2203 * kjs/JSActivation.cpp:
2204 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
2205 List to pass to the arguments object constructor.
2207 * JavaScriptCore.xcodeproj/project.pbxproj:
2208 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
2209 because that seems to make GCC happy. (Previously, I had added
2210 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
2213 2008-04-28 Geoffrey Garen <ggaren@apple.com>
2215 Reviewed by Maciej Stachowiak.
2217 Groundwork for more handling of "arguments". I'm not checking in the
2218 actual handling of "arguments" yet, because it still needs a little
2219 fiddling to avoid a performance regression.
2221 SunSpider reports no change.
2224 (KJS::initializeCallFrame): Put argc in the register file, so the
2225 arguments object can find it later, to determine arguments.length.
2228 (KJS::FunctionBodyNode::): Added a special code accessor for when you
2229 know the code has already been generated, and you don't have a scopeChain
2230 to supply for potential code generation. (This is the case when the
2231 activation object creates the arguments object.)
2233 2008-04-28 Oliver Hunt <oliver@apple.com>
2237 Replace unsafe use of auto_ptr in Vector with manual memory
2240 * VM/RegisterFileStack.cpp:
2241 (KJS::RegisterFileStack::~RegisterFileStack):
2242 (KJS::RegisterFileStack::popRegisterFile):
2243 * VM/RegisterFileStack.h:
2245 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2249 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
2250 <https://bugs.webkit.org/show_bug.cgi?id=18746>
2252 Change the base to the correct value of the 'this' object after the direct
2253 eval test instead of before.
2255 Fixes 5 layout tests.
2258 (KJS::Machine::privateExecute):
2260 (KJS::EvalFunctionCallNode::emitCode):
2262 2008-04-26 Maciej Stachowiak <mjs@apple.com>
2266 - document all property getting, setting and deleting opcodes
2268 (And fix function parameter names to match corresponding opcode parameter names.)
2270 * VM/CodeGenerator.cpp:
2271 (KJS::CodeGenerator::emitResolve):
2272 (KJS::CodeGenerator::emitResolveBase):
2273 (KJS::CodeGenerator::emitResolveBaseAndProperty):
2274 (KJS::CodeGenerator::emitResolveBaseAndFunc):
2275 (KJS::CodeGenerator::emitGetPropId):
2276 (KJS::CodeGenerator::emitPutPropId):
2277 (KJS::CodeGenerator::emitDeletePropId):
2278 (KJS::CodeGenerator::emitPutPropVal):
2279 * VM/CodeGenerator.h:
2283 (KJS::resolveBaseAndProperty):
2284 (KJS::resolveBaseAndFunc):
2285 (KJS::Machine::privateExecute):
2287 (KJS::ResolveNode::emitCode):
2288 (KJS::ArrayNode::emitCode):
2289 (KJS::PropertyListNode::emitCode):
2290 (KJS::BracketAccessorNode::emitCode):
2291 (KJS::EvalFunctionCallNode::emitCode):
2292 (KJS::FunctionCallResolveNode::emitCode):
2293 (KJS::FunctionCallBracketNode::emitCode):
2294 (KJS::PostIncResolveNode::emitCode):
2295 (KJS::PostDecResolveNode::emitCode):
2296 (KJS::PostIncBracketNode::emitCode):
2297 (KJS::PostDecBracketNode::emitCode):
2298 (KJS::PostIncDotNode::emitCode):
2299 (KJS::PostDecDotNode::emitCode):
2300 (KJS::DeleteResolveNode::emitCode):
2301 (KJS::TypeOfResolveNode::emitCode):
2302 (KJS::PreIncResolveNode::emitCode):
2303 (KJS::PreDecResolveNode::emitCode):
2304 (KJS::PreIncBracketNode::emitCode):
2305 (KJS::PreDecBracketNode::emitCode):
2306 (KJS::AssignResolveNode::emitCode):
2307 (KJS::AssignDotNode::emitCode):
2308 (KJS::ReadModifyDotNode::emitCode):
2309 (KJS::AssignBracketNode::emitCode):
2310 (KJS::ReadModifyBracketNode::emitCode):
2311 (KJS::ConstDeclNode::emitCodeSingle):
2313 2008-04-26 Oliver Hunt <oliver@apple.com>
2317 Bug 18628: SQUIRRELFISH: need to support recursion limit
2318 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2320 Basically completes recursion limiting. There is still some
2321 tuning we may want to do to make things better in the face of
2322 very bad code, but certainly nothing worse than anything already
2325 Also fixes a WebKit test by fixing the exception text :D
2327 * JavaScriptCore.exp:
2328 * VM/ExceptionHelpers.cpp:
2330 (KJS::Machine::execute):
2331 * VM/RegisterFile.cpp:
2332 (KJS::RegisterFile::growBuffer):
2333 (KJS::RegisterFile::addGlobalSlots):
2334 * VM/RegisterFile.h:
2335 (KJS::RegisterFile::grow):
2336 (KJS::RegisterFile::uncheckedGrow):
2337 * VM/RegisterFileStack.cpp:
2338 (KJS::RegisterFileStack::pushRegisterFile):
2339 * VM/RegisterFileStack.h:
2341 2008-04-25 Oliver Hunt <oliver@apple.com>
2345 Bug 18628: SQUIRRELFISH: need to support recursion limit
2346 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2348 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
2349 seems reasonable as it is greater than the old eval limit, and a long way short of
2350 the reentry depth needed to overflow the stack.
2353 (KJS::Machine::execute):
2356 2008-04-25 Geoffrey Garen <ggaren@apple.com>
2358 Reviewed by Sam Weinig.
2360 A tiny bit of cleanup to the regexp code.
2362 Removed some static_cast.
2364 Removed createRegExpImp because it's no longer used.
2366 2008-04-25 Oliver Hunt <oliver@apple.com>
2370 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
2371 <https://bugs.webkit.org/show_bug.cgi?id=18736>
2373 Ensure the "default" target is correct in the absence of an explicit default handler.
2376 (KJS::CaseBlockNode::emitCodeForBlock):
2378 2008-04-25 Oliver Hunt <oliver@apple.com>
2382 Bug 18628: SQUIRRELFISH: need to support recursion limit
2383 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2385 More bounds checking.
2388 (KJS::Machine::execute):
2389 * VM/RegisterFile.cpp:
2390 (KJS::RegisterFile::growBuffer):
2391 * VM/RegisterFile.h:
2393 2008-04-25 Maciej Stachowiak <mjs@apple.com>
2397 - fix signal catching magic
2399 The signal handlers are restored to _exit but are only set when
2400 running under run-javascriptcore-tests. fprintf from a signal
2401 handler is not safe.
2406 * tests/mozilla/jsDriver.pl:
2408 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2412 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
2413 <https://bugs.webkit.org/show_bug.cgi?id=18732>
2415 Fixes another regression test.
2418 (KJS::Machine::privateExecute):
2420 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2424 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
2425 <https://bugs.webkit.org/show_bug.cgi?id=18728>
2427 Fixes another regression test.
2430 (KJS::RegExpNode::emitCode):
2432 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2434 Reviewed by Geoffrey Garen.
2436 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
2437 <https://bugs.webkit.org/show_bug.cgi?id=18735>
2439 The overloaded toThisObject method was not copied over to JSActivation.
2441 Fixes two regression tests.
2443 * kjs/JSActivation.cpp:
2444 (KJS::JSActivation::toThisObject):
2445 * kjs/JSActivation.h:
2447 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2449 Reviewed by Oliver Hunt.
2451 Added support for arguments.callee.
2453 2008-04-24 Oliver Hunt <oliver@apple.com>
2457 Bug 18628: SQUIRRELFISH: need to support recursion limit
2458 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2460 Partial fix -- this gets us some of the required bounds checking, but not
2461 complete coverage. But it does manage to do them without regressing :D
2463 * VM/ExceptionHelpers.cpp:
2465 (KJS::createStackOverflowError):
2466 * VM/ExceptionHelpers.h:
2468 (KJS::slideRegisterWindowForCall):
2469 (KJS::Machine::execute):
2470 (KJS::Machine::privateExecute):
2471 * VM/RegisterFile.cpp:
2472 * VM/RegisterFile.h:
2473 (KJS::RegisterFile::):
2474 (KJS::RegisterFile::RegisterFile):
2475 (KJS::RegisterFile::grow):
2477 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2479 Reviewed by Oliver Hunt.
2481 A tiny bit more handling of "arguments": create a real, but mostly
2482 hollow, arguments object.
2484 Fixes 2 regression tests.
2486 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2490 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2491 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2493 Fixes a regression test, but exposes the failure of another due to the
2494 lack of getters and setters.
2497 (KJS::ConstDeclNode::emitCodeSingle):
2498 (KJS::ConstDeclNode::emitCode):
2499 (KJS::ConstStatementNode::emitCode):
2500 (KJS::VarStatementNode::emitCode):
2503 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2505 Reviewed by Sam Weinig.
2507 Print a CRASH statement when crashing, so test failures are not a
2514 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2516 Reviewed by Geoffrey Garen.
2518 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2519 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2521 This fixes 2 more regression tests.
2524 (KJS::TypeOfResolveNode::emitCode):
2526 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2528 Reviewed by Sam Weinig.
2530 Put the callee in the call frame.
2532 Necessary in order to support "arguments" and "arguments.callee".
2534 Also fixes a latent GC bug, where an executing function could be
2535 subject to GC if the register holding it were overwritten. Here's
2536 an example that would have caused problems:
2540 // Flood the machine stack to eliminate any old pointers to f.
2543 // Overwrite f in the register file.
2547 for (var i = 0; i < 5000; ++i) {
2551 // Welcome to crash-ville.
2560 * VM/Machine.h: Changed the order of arguments to
2561 execute(FunctionBodyNode*...) to match the other execute functions.
2562 * kjs/function.cpp: Updated to match new argument requirements from
2563 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2564 rest of JavaScriptCore.
2566 SunSpider reports no change.
2568 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2572 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2573 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2575 This fixes 4 more regression tests.
2580 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2584 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2588 * VM/SegmentedVector.h:
2589 (KJS::SegmentedVector::grow):
2591 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2593 Reviewed by Maciej Stachowiak.
2595 Degenerate handling of "arguments" as a property of the activation
2596 object. Currently, we just return a vanilla object.
2598 SunSpider reports no change.
2602 ecma_3/Function/regress-94506.js.
2604 Reveals to have been secretly broken:
2606 ecma_3/Function/15.3.4.3-1.js
2607 ecma_3/Function/15.3.4.4-1.js
2609 These tests were passing incorrectly. testkjs creates a global array
2610 named "arguments" to hold command-line arguments. That array was
2611 tricking these tests into thinking that an arguments object with length
2612 0 had been created. Since our new vanilla object shadows the global
2613 property named arguments, that object no longer fools these tests into
2616 Net change: +1 failing test.
2618 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2619 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2621 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2625 - save and restore callFrame
2628 (KJS::slideRegisterWindowForCall):
2629 (KJS::Machine::execute):
2630 (KJS::Machine::privateExecute):
2634 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2636 Reviewed by Maciej Stachowiak.
2638 Fixed scopes for named function expressions.
2640 Fixes one regression test.
2644 (1) The function's name is supposed to have attributes DontDelete,
2645 ReadOnly, regardless of the type of code executing.
2647 (2) Push the name object on the function's scope chain, rather than
2648 the ExecState's scope chain because, well, that's where it belongs.
2650 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2652 Reviewed by Oliver Hunt.
2654 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2656 I did this as a first step toward removing nodes.cpp from
2657 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2659 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2661 Rubber stamped by Geoff.
2663 - add OldInterpreterExecState class and use it in dead code
2665 This will allow removing things from the real ExecState class
2666 without having to figure out how to remove all this code without
2667 getting a perf regression.
2670 (KJS::ExpressionNode::evaluateToNumber):
2671 (KJS::ExpressionNode::evaluateToBoolean):
2672 (KJS::ExpressionNode::evaluateToInt32):
2673 (KJS::ExpressionNode::evaluateToUInt32):
2674 (KJS::Node::setErrorCompletion):
2675 (KJS::Node::throwError):
2676 (KJS::Node::throwUndefinedVariableError):
2677 (KJS::Node::handleException):
2678 (KJS::Node::rethrowException):
2679 (KJS::BreakpointCheckStatement::execute):
2680 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2681 (KJS::NullNode::evaluate):
2682 (KJS::FalseNode::evaluate):
2683 (KJS::TrueNode::evaluate):
2684 (KJS::NumberNode::evaluate):
2685 (KJS::NumberNode::evaluateToNumber):
2686 (KJS::NumberNode::evaluateToBoolean):
2687 (KJS::NumberNode::evaluateToInt32):
2688 (KJS::NumberNode::evaluateToUInt32):
2689 (KJS::ImmediateNumberNode::evaluate):
2690 (KJS::ImmediateNumberNode::evaluateToInt32):
2691 (KJS::ImmediateNumberNode::evaluateToUInt32):
2692 (KJS::StringNode::evaluate):
2693 (KJS::StringNode::evaluateToNumber):
2694 (KJS::StringNode::evaluateToBoolean):
2695 (KJS::RegExpNode::evaluate):
2696 (KJS::ThisNode::evaluate):
2697 (KJS::ResolveNode::inlineEvaluate):
2698 (KJS::ResolveNode::evaluate):
2699 (KJS::ResolveNode::evaluateToNumber):
2700 (KJS::ResolveNode::evaluateToBoolean):
2701 (KJS::ResolveNode::evaluateToInt32):
2702 (KJS::ResolveNode::evaluateToUInt32):
2703 (KJS::getSymbolTableEntry):
2704 (KJS::ResolveNode::optimizeVariableAccess):
2705 (KJS::LocalVarAccessNode::inlineEvaluate):
2706 (KJS::LocalVarAccessNode::evaluate):
2707 (KJS::LocalVarAccessNode::evaluateToNumber):
2708 (KJS::LocalVarAccessNode::evaluateToBoolean):
2709 (KJS::LocalVarAccessNode::evaluateToInt32):
2710 (KJS::LocalVarAccessNode::evaluateToUInt32):
2711 (KJS::getNonLocalSymbol):
2712 (KJS::ScopedVarAccessNode::inlineEvaluate):
2713 (KJS::ScopedVarAccessNode::evaluate):
2714 (KJS::ScopedVarAccessNode::evaluateToNumber):
2715 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2716 (KJS::ScopedVarAccessNode::evaluateToInt32):
2717 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2718 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2719 (KJS::NonLocalVarAccessNode::evaluate):
2720 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2721 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2722 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2723 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2724 (KJS::ElementNode::optimizeVariableAccess):
2725 (KJS::ElementNode::evaluate):
2726 (KJS::ArrayNode::optimizeVariableAccess):
2727 (KJS::ArrayNode::evaluate):
2728 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2729 (KJS::ObjectLiteralNode::evaluate):
2730 (KJS::PropertyListNode::optimizeVariableAccess):
2731 (KJS::PropertyListNode::evaluate):
2732 (KJS::PropertyNode::optimizeVariableAccess):
2733 (KJS::PropertyNode::evaluate):
2734 (KJS::BracketAccessorNode::optimizeVariableAccess):
2735 (KJS::BracketAccessorNode::inlineEvaluate):
2736 (KJS::BracketAccessorNode::evaluate):
2737 (KJS::BracketAccessorNode::evaluateToNumber):
2738 (KJS::BracketAccessorNode::evaluateToBoolean):
2739 (KJS::BracketAccessorNode::evaluateToInt32):
2740 (KJS::BracketAccessorNode::evaluateToUInt32):
2741 (KJS::DotAccessorNode::optimizeVariableAccess):
2742 (KJS::DotAccessorNode::inlineEvaluate):
2743 (KJS::DotAccessorNode::evaluate):
2744 (KJS::DotAccessorNode::evaluateToNumber):
2745 (KJS::DotAccessorNode::evaluateToBoolean):
2746 (KJS::DotAccessorNode::evaluateToInt32):
2747 (KJS::DotAccessorNode::evaluateToUInt32):
2748 (KJS::ArgumentListNode::optimizeVariableAccess):
2749 (KJS::ArgumentListNode::evaluateList):
2750 (KJS::ArgumentsNode::optimizeVariableAccess):
2751 (KJS::NewExprNode::optimizeVariableAccess):
2752 (KJS::NewExprNode::inlineEvaluate):
2753 (KJS::NewExprNode::evaluate):
2754 (KJS::NewExprNode::evaluateToNumber):
2755 (KJS::NewExprNode::evaluateToBoolean):
2756 (KJS::NewExprNode::evaluateToInt32):
2757 (KJS::NewExprNode::evaluateToUInt32):
2758 (KJS::ExpressionNode::resolveAndCall):
2759 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2760 (KJS::EvalFunctionCallNode::evaluate):
2761 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2762 (KJS::FunctionCallValueNode::evaluate):
2763 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2764 (KJS::FunctionCallResolveNode::inlineEvaluate):
2765 (KJS::FunctionCallResolveNode::evaluate):
2766 (KJS::FunctionCallResolveNode::evaluateToNumber):
2767 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2768 (KJS::FunctionCallResolveNode::evaluateToInt32):
2769 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2770 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2771 (KJS::LocalVarFunctionCallNode::evaluate):
2772 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2773 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2774 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2775 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2776 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2777 (KJS::ScopedVarFunctionCallNode::evaluate):
2778 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2779 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2780 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2781 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2782 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2783 (KJS::NonLocalVarFunctionCallNode::evaluate):
2784 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2785 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2786 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2787 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2788 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2789 (KJS::FunctionCallBracketNode::evaluate):
2790 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2791 (KJS::FunctionCallDotNode::inlineEvaluate):
2792 (KJS::FunctionCallDotNode::evaluate):
2793 (KJS::FunctionCallDotNode::evaluateToNumber):
2794 (KJS::FunctionCallDotNode::evaluateToBoolean):
2795 (KJS::FunctionCallDotNode::evaluateToInt32):
2796 (KJS::FunctionCallDotNode::evaluateToUInt32):
2797 (KJS::PostIncResolveNode::optimizeVariableAccess):
2798 (KJS::PostIncResolveNode::evaluate):
2799 (KJS::PostIncLocalVarNode::evaluate):
2800 (KJS::PostDecResolveNode::optimizeVariableAccess):
2801 (KJS::PostDecResolveNode::evaluate):
2802 (KJS::PostDecLocalVarNode::evaluate):
2803 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2804 (KJS::PostDecLocalVarNode::evaluateToNumber):
2805 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2806 (KJS::PostDecLocalVarNode::evaluateToInt32):
2807 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2808 (KJS::PostfixBracketNode::optimizeVariableAccess):
2809 (KJS::PostIncBracketNode::evaluate):
2810 (KJS::PostDecBracketNode::evaluate):
2811 (KJS::PostfixDotNode::optimizeVariableAccess):
2812 (KJS::PostIncDotNode::evaluate):
2813 (KJS::PostDecDotNode::evaluate):
2814 (KJS::PostfixErrorNode::evaluate):
2815 (KJS::DeleteResolveNode::optimizeVariableAccess):
2816 (KJS::DeleteResolveNode::evaluate):
2817 (KJS::LocalVarDeleteNode::evaluate):
2818 (KJS::DeleteBracketNode::optimizeVariableAccess):
2819 (KJS::DeleteBracketNode::evaluate):
2820 (KJS::DeleteDotNode::optimizeVariableAccess):
2821 (KJS::DeleteDotNode::evaluate):
2822 (KJS::DeleteValueNode::optimizeVariableAccess):
2823 (KJS::DeleteValueNode::evaluate):
2824 (KJS::VoidNode::optimizeVariableAccess):
2825 (KJS::VoidNode::evaluate):
2826 (KJS::TypeOfValueNode::optimizeVariableAccess):
2827 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2828 (KJS::LocalVarTypeOfNode::evaluate):
2829 (KJS::TypeOfResolveNode::evaluate):
2830 (KJS::TypeOfValueNode::evaluate):
2831 (KJS::PreIncResolveNode::optimizeVariableAccess):
2832 (KJS::PreIncLocalVarNode::evaluate):
2833 (KJS::PreIncResolveNode::evaluate):
2834 (KJS::PreDecResolveNode::optimizeVariableAccess):
2835 (KJS::PreDecLocalVarNode::evaluate):
2836 (KJS::PreDecResolveNode::evaluate):
2837 (KJS::PreIncConstNode::evaluate):
2838 (KJS::PreDecConstNode::evaluate):
2839 (KJS::PostIncConstNode::evaluate):
2840 (KJS::PostDecConstNode::evaluate):
2841 (KJS::PrefixBracketNode::optimizeVariableAccess):
2842 (KJS::PreIncBracketNode::evaluate):
2843 (KJS::PreDecBracketNode::evaluate):
2844 (KJS::PrefixDotNode::optimizeVariableAccess):
2845 (KJS::PreIncDotNode::evaluate):
2846 (KJS::PreDecDotNode::evaluate):
2847 (KJS::PrefixErrorNode::evaluate):
2848 (KJS::UnaryPlusNode::optimizeVariableAccess):
2849 (KJS::UnaryPlusNode::evaluate):
2850 (KJS::UnaryPlusNode::evaluateToBoolean):
2851 (KJS::UnaryPlusNode::evaluateToNumber):
2852 (KJS::UnaryPlusNode::evaluateToInt32):
2853 (KJS::UnaryPlusNode::evaluateToUInt32):
2854 (KJS::NegateNode::optimizeVariableAccess):
2855 (KJS::NegateNode::evaluate):
2856 (KJS::NegateNode::evaluateToNumber):
2857 (KJS::BitwiseNotNode::optimizeVariableAccess):
2858 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2859 (KJS::BitwiseNotNode::evaluate):
2860 (KJS::BitwiseNotNode::evaluateToNumber):
2861 (KJS::BitwiseNotNode::evaluateToBoolean):
2862 (KJS::BitwiseNotNode::evaluateToInt32):
2863 (KJS::BitwiseNotNode::evaluateToUInt32):
2864 (KJS::LogicalNotNode::optimizeVariableAccess):
2865 (KJS::LogicalNotNode::evaluate):
2866 (KJS::LogicalNotNode::evaluateToBoolean):
2867 (KJS::MultNode::optimizeVariableAccess):
2868 (KJS::MultNode::inlineEvaluateToNumber):
2869 (KJS::MultNode::evaluate):
2870 (KJS::MultNode::evaluateToNumber):
2871 (KJS::MultNode::evaluateToBoolean):
2872 (KJS::MultNode::evaluateToInt32):
2873 (KJS::MultNode::evaluateToUInt32):
2874 (KJS::DivNode::optimizeVariableAccess):
2875 (KJS::DivNode::inlineEvaluateToNumber):
2876 (KJS::DivNode::evaluate):
2877 (KJS::DivNode::evaluateToNumber):
2878 (KJS::DivNode::evaluateToInt32):
2879 (KJS::DivNode::evaluateToUInt32):
2880 (KJS::ModNode::optimizeVariableAccess):
2881 (KJS::ModNode::inlineEvaluateToNumber):
2882 (KJS::ModNode::evaluate):
2883 (KJS::ModNode::evaluateToNumber):
2884 (KJS::ModNode::evaluateToBoolean):
2885 (KJS::ModNode::evaluateToInt32):
2886 (KJS::ModNode::evaluateToUInt32):
2887 (KJS::throwOutOfMemoryErrorToNumber):
2889 (KJS::addSlowCaseToNumber):
2892 (KJS::AddNode::optimizeVariableAccess):
2893 (KJS::AddNode::evaluate):
2894 (KJS::AddNode::inlineEvaluateToNumber):
2895 (KJS::AddNode::evaluateToNumber):
2896 (KJS::AddNode::evaluateToInt32):
2897 (KJS::AddNode::evaluateToUInt32):
2898 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2899 (KJS::AddNumbersNode::evaluate):
2900 (KJS::AddNumbersNode::evaluateToNumber):
2901 (KJS::AddNumbersNode::evaluateToInt32):
2902 (KJS::AddNumbersNode::evaluateToUInt32):
2903 (KJS::AddStringsNode::evaluate):
2904 (KJS::AddStringLeftNode::evaluate):
2905 (KJS::AddStringRightNode::evaluate):
2906 (KJS::SubNode::optimizeVariableAccess):
2907 (KJS::SubNode::inlineEvaluateToNumber):
2908 (KJS::SubNode::evaluate):
2909 (KJS::SubNode::evaluateToNumber):
2910 (KJS::SubNode::evaluateToInt32):
2911 (KJS::SubNode::evaluateToUInt32):
2912 (KJS::LeftShiftNode::optimizeVariableAccess):
2913 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2914 (KJS::LeftShiftNode::evaluate):
2915 (KJS::LeftShiftNode::evaluateToNumber):
2916 (KJS::LeftShiftNode::evaluateToInt32):
2917 (KJS::LeftShiftNode::evaluateToUInt32):
2918 (KJS::RightShiftNode::optimizeVariableAccess):
2919 (KJS::RightShiftNode::inlineEvaluateToInt32):
2920 (KJS::RightShiftNode::evaluate):
2921 (KJS::RightShiftNode::evaluateToNumber):
2922 (KJS::RightShiftNode::evaluateToInt32):
2923 (KJS::RightShiftNode::evaluateToUInt32):
2924 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2925 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2926 (KJS::UnsignedRightShiftNode::evaluate):
2927 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2928 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2929 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2932 (KJS::LessNode::optimizeVariableAccess):
2933 (KJS::LessNode::inlineEvaluateToBoolean):
2934 (KJS::LessNode::evaluate):
2935 (KJS::LessNode::evaluateToBoolean):
2936 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2937 (KJS::LessNumbersNode::evaluate):
2938 (KJS::LessNumbersNode::evaluateToBoolean):
2939 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2940 (KJS::LessStringsNode::evaluate):
2941 (KJS::LessStringsNode::evaluateToBoolean):
2942 (KJS::GreaterNode::optimizeVariableAccess):
2943 (KJS::GreaterNode::inlineEvaluateToBoolean):
2944 (KJS::GreaterNode::evaluate):
2945 (KJS::GreaterNode::evaluateToBoolean):
2946 (KJS::LessEqNode::optimizeVariableAccess):
2947 (KJS::LessEqNode::inlineEvaluateToBoolean):
2948 (KJS::LessEqNode::evaluate):
2949 (KJS::LessEqNode::evaluateToBoolean):
2950 (KJS::GreaterEqNode::optimizeVariableAccess):
2951 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2952 (KJS::GreaterEqNode::evaluate):
2953 (KJS::GreaterEqNode::evaluateToBoolean):
2954 (KJS::InstanceOfNode::optimizeVariableAccess):
2955 (KJS::InstanceOfNode::evaluate):
2956 (KJS::InstanceOfNode::evaluateToBoolean):
2957 (KJS::InNode::optimizeVariableAccess):
2958 (KJS::InNode::evaluate):
2959 (KJS::InNode::evaluateToBoolean):
2960 (KJS::EqualNode::optimizeVariableAccess):
2961 (KJS::EqualNode::inlineEvaluateToBoolean):
2962 (KJS::EqualNode::evaluate):
2963 (KJS::EqualNode::evaluateToBoolean):
2964 (KJS::NotEqualNode::optimizeVariableAccess):
2965 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2966 (KJS::NotEqualNode::evaluate):
2967 (KJS::NotEqualNode::evaluateToBoolean):
2968 (KJS::StrictEqualNode::optimizeVariableAccess):
2969 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2970 (KJS::StrictEqualNode::evaluate):
2971 (KJS::StrictEqualNode::evaluateToBoolean):
2972 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2973 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2974 (KJS::NotStrictEqualNode::evaluate):
2975 (KJS::NotStrictEqualNode::evaluateToBoolean):
2976 (KJS::BitAndNode::optimizeVariableAccess):
2977 (KJS::BitAndNode::evaluate):
2978 (KJS::BitAndNode::inlineEvaluateToInt32):
2979 (KJS::BitAndNode::evaluateToNumber):
2980 (KJS::BitAndNode::evaluateToBoolean):
2981 (KJS::BitAndNode::evaluateToInt32):
2982 (KJS::BitAndNode::evaluateToUInt32):
2983 (KJS::BitXOrNode::optimizeVariableAccess):
2984 (KJS::BitXOrNode::inlineEvaluateToInt32):
2985 (KJS::BitXOrNode::evaluate):
2986 (KJS::BitXOrNode::evaluateToNumber):
2987 (KJS::BitXOrNode::evaluateToBoolean):
2988 (KJS::BitXOrNode::evaluateToInt32):
2989 (KJS::BitXOrNode::evaluateToUInt32):
2990 (KJS::BitOrNode::optimizeVariableAccess):
2991 (KJS::BitOrNode::inlineEvaluateToInt32):
2992 (KJS::BitOrNode::evaluate):
2993 (KJS::BitOrNode::evaluateToNumber):
2994 (KJS::BitOrNode::evaluateToBoolean):
2995 (KJS::BitOrNode::evaluateToInt32):
2996 (KJS::BitOrNode::evaluateToUInt32):
2997 (KJS::LogicalAndNode::optimizeVariableAccess):
2998 (KJS::LogicalAndNode::evaluate):
2999 (KJS::LogicalAndNode::evaluateToBoolean):
3000 (KJS::LogicalOrNode::optimizeVariableAccess):
3001 (KJS::LogicalOrNode::evaluate):
3002 (KJS::LogicalOrNode::evaluateToBoolean):
3003 (KJS::ConditionalNode::optimizeVariableAccess):
3004 (KJS::ConditionalNode::evaluate):
3005 (KJS::ConditionalNode::evaluateToBoolean):
3006 (KJS::ConditionalNode::evaluateToNumber):
3007 (KJS::ConditionalNode::evaluateToInt32):
3008 (KJS::ConditionalNode::evaluateToUInt32):
3009 (KJS::valueForReadModifyAssignment):
3010 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
3011 (KJS::AssignResolveNode::optimizeVariableAccess):
3012 (KJS::ReadModifyLocalVarNode::evaluate):
3013 (KJS::AssignLocalVarNode::evaluate):
3014 (KJS::ReadModifyConstNode::evaluate):
3015 (KJS::AssignConstNode::evaluate):
3016 (KJS::ReadModifyResolveNode::evaluate):
3017 (KJS::AssignResolveNode::evaluate):
3018 (KJS::AssignDotNode::optimizeVariableAccess):
3019 (KJS::AssignDotNode::evaluate):
3020 (KJS::ReadModifyDotNode::optimizeVariableAccess):
3021 (KJS::ReadModifyDotNode::evaluate):
3022 (KJS::AssignErrorNode::evaluate):
3023 (KJS::AssignBracketNode::optimizeVariableAccess):
3024 (KJS::AssignBracketNode::evaluate):
3025 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
3026 (KJS::ReadModifyBracketNode::evaluate):
3027 (KJS::CommaNode::optimizeVariableAccess):
3028 (KJS::CommaNode::evaluate):
3029 (KJS::ConstDeclNode::optimizeVariableAccess):
3030 (KJS::ConstDeclNode::handleSlowCase):
3031 (KJS::ConstDeclNode::evaluateSingle):
3032 (KJS::ConstDeclNode::evaluate):
3033 (KJS::ConstStatementNode::optimizeVariableAccess):
3034 (KJS::ConstStatementNode::execute):
3035 (KJS::statementListExecute):
3036 (KJS::BlockNode::optimizeVariableAccess):
3037 (KJS::BlockNode::execute):
3038 (KJS::EmptyStatementNode::execute):
3039 (KJS::ExprStatementNode::optimizeVariableAccess):
3040 (KJS::ExprStatementNode::execute):
3041 (KJS::VarStatementNode::optimizeVariableAccess):
3042 (KJS::VarStatementNode::execute):
3043 (KJS::IfNode::optimizeVariableAccess):
3044 (KJS::IfNode::execute):
3045 (KJS::IfElseNode::optimizeVariableAccess):
3046 (KJS::IfElseNode::execute):
3047 (KJS::DoWhileNode::optimizeVariableAccess):
3048 (KJS::DoWhileNode::execute):
3049 (KJS::WhileNode::optimizeVariableAccess):
3050 (KJS::WhileNode::execute):
3051 (KJS::ForNode::optimizeVariableAccess):
3052 (KJS::ForNode::execute):
3053 (KJS::ForInNode::optimizeVariableAccess):
3054 (KJS::ForInNode::execute):
3055 (KJS::ContinueNode::execute):
3056 (KJS::BreakNode::execute):
3057 (KJS::ReturnNode::optimizeVariableAccess):
3058 (KJS::ReturnNode::execute):
3059 (KJS::WithNode::optimizeVariableAccess):
3060 (KJS::WithNode::execute):
3061 (KJS::CaseClauseNode::optimizeVariableAccess):
3062 (KJS::CaseClauseNode::evaluate):
3063 (KJS::CaseClauseNode::executeStatements):
3064 (KJS::ClauseListNode::optimizeVariableAccess):
3065 (KJS::CaseBlockNode::optimizeVariableAccess):
3066 (KJS::CaseBlockNode::executeBlock):
3067 (KJS::SwitchNode::optimizeVariableAccess):
3068 (KJS::SwitchNode::execute):
3069 (KJS::LabelNode::optimizeVariableAccess):
3070 (KJS::LabelNode::execute):
3071 (KJS::ThrowNode::optimizeVariableAccess):
3072 (KJS::ThrowNode::execute):
3073 (KJS::TryNode::optimizeVariableAccess):
3074 (KJS::TryNode::execute):
3075 (KJS::ProgramNode::initializeSymbolTable):
3076 (KJS::ScopeNode::optimizeVariableAccess):
3077 (KJS::ProgramNode::processDeclarations):
3078 (KJS::EvalNode::processDeclarations):
3079 (KJS::ProgramNode::execute):
3080 (KJS::EvalNode::execute):
3081 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
3082 (KJS::FuncDeclNode::execute):
3083 (KJS::FuncExprNode::evaluate):
3088 (KJS::ArgumentsNode::):
3090 2008-04-23 Oliver Hunt <oliver@apple.com>
3094 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
3095 <https://bugs.webkit.org/show_bug.cgi?id=18672>
3097 Add a SegmentedVector type, which provides a Vector<T> which maintains
3098 existing memory locations during resize. This allows dynamically sizing
3099 local, temporary and label "vectors" in CodeGenerator.
3101 * JavaScriptCore.xcodeproj/project.pbxproj:
3102 * VM/CodeGenerator.cpp:
3103 (KJS::CodeGenerator::addVar):
3104 (KJS::CodeGenerator::CodeGenerator):
3105 (KJS::CodeGenerator::newTemporary):
3106 (KJS::CodeGenerator::newLabel):
3107 * VM/CodeGenerator.h:
3108 * VM/SegmentedVector.h: Added.
3109 (KJS::SegmentedVector::SegmentedVector):
3110 (KJS::SegmentedVector::~SegmentedVector):
3111 (KJS::SegmentedVector::last):
3112 (KJS::SegmentedVector::append):
3113 (KJS::SegmentedVector::removeLast):
3114 (KJS::SegmentedVector::size):
3115 (KJS::SegmentedVector::operator[]):
3116 (KJS::SegmentedVector::resize):
3117 (KJS::SegmentedVector::shrink):
3118 (KJS::SegmentedVector::grow):
3120 2008-04-23 Geoffrey Garen <ggaren@apple.com>
3122 Reviewed by Maciej Stachowiak.
3124 A little refactoring in preparation for supporting 'arguments'.
3126 Fixes 2 regression tests.
3128 SunSpider reports no change.
3130 We now check the activation register, instead of the codeBlock, to
3131 determine whether we need to tear off the activation. This is to support
3132 "f.arguments", which will create an activation/arguments pair for f,
3133 even though the needsFullScopeChain flag is false for f's codeBlock.
3135 The test fixes resulted from calling initializeCallFrame for re-entrant
3136 function code, instead of initializing (not enough) parts of the call
3139 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3143 - propagate the "this" value properly to local eval
3145 (fixes a measly one regression test)
3148 (KJS::CodeBlock::CodeBlock):
3149 (KJS::ProgramCodeBlock::ProgramCodeBlock):
3150 (KJS::EvalCodeBlock::EvalCodeBlock):
3152 (KJS::Machine::privateExecute):
3154 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3158 Add support for function declarations in eval code.
3160 (this fixes 12 more regression tests)
3163 * VM/CodeGenerator.cpp:
3164 (KJS::CodeGenerator::CodeGenerator):
3165 * VM/CodeGenerator.h:
3167 (KJS::Machine::execute):
3169 (KJS::EvalNode::generateCode):
3171 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3175 Implement LabelNode.
3177 * VM/CodeGenerator.cpp:
3178 (KJS::CodeGenerator::pushJumpContext):
3179 (KJS::CodeGenerator::jumpContextForContinue):
3180 (KJS::CodeGenerator::jumpContextForBreak):
3181 * VM/CodeGenerator.h:
3183 (KJS::DoWhileNode::emitCode):
3184 (KJS::WhileNode::emitCode):
3185 (KJS::ForNode::emitCode):
3186 (KJS::ForInNode::emitCode):
3187 (KJS::ContinueNode::emitCode):
3188 (KJS::BreakNode::emitCode):
3189 (KJS::SwitchNode::emitCode):
3190 (KJS::LabelNode::emitCode):
3192 2008-04-22 Geoffrey Garen <ggaren@apple.com>
3194 Reviewed by Oliver Hunt.
3196 Fixed crash when unwinding from exceptions inside eval.
3199 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
3200 current call frame's scope chain is an activation: it can be the global
3203 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3208 (main): Convert signals to exit codes, so that crashing tests are
3209 detected as regression test failures.
3211 2008-04-22 Geoffrey Garen <ggaren@apple.com>
3213 Reviewed by Oliver Hunt and Maciej Stachowiak.
3215 Renamed "needsActivation" to "needsFullScopeChain" because lying will
3216 make hair grow on the backs of your hands.
3218 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3220 Reviewed by Maciej Stachowiak.
3222 Fixed ScopeChainNode lifetime problems:
3224 (1) In "with" and "catch" scopes, we would construct a ScopeChain
3225 object and then jump across its destructor, leaking the ScopeChainNode
3228 (2) In global and eval scopes, we would fail to initially ref
3229 "scopeChain", causing us to overrelease it later. Now that we ref
3230 "scopeChain" properly, we also need to deref it when the script
3233 SunSpider reports a .2% regression, but an earlier round of ScopeChain
3234 refactoring was a .4% speedup, so there.
3236 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3240 - use global object instead of null for "this" on unqualified calls
3242 This fixes 10 more JSC test regressions.
3245 (KJS::Machine::privateExecute):
3247 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3251 - throw proper exceptions for objects that don't implement call or construct
3253 This fixes 21 more JSC test regressions. It is also seemingly an
3256 * VM/ExceptionHelpers.cpp:
3257 (KJS::createNotAnObjectError):
3258 (KJS::createNotAConstructorError):
3259 (KJS::createNotAFunctionError):
3260 * VM/ExceptionHelpers.h:
3262 (KJS::Machine::privateExecute):
3264 2008-04-21 Oliver Hunt <oliver@apple.com>
3268 Implement emitCode for ConstDeclNode.
3270 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
3272 * VM/CodeGenerator.cpp:
3273 (KJS::CodeGenerator::registerForLocalConstInit):
3274 * VM/CodeGenerator.h:
3276 (KJS::AssignResolveNode::emitCode):
3277 (KJS::ConstDeclNode::emitCodeSingle):
3278 (KJS::ConstDeclNode::emitCode):
3279 (KJS::ConstStatementNode::emitCode):
3282 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3286 - add some support for the split window object
3288 This fixes many layout tests.
3291 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
3292 wrapper global, if one exists, as the "this" object.
3294 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
3297 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3301 - restore ScopeChain::operator= to avoid crash on many layout tests
3303 Otherwise, FunctionImp::setScope would cause a reference
3304 underflow. I implemented using the copy construct and swap idiom.
3306 * kjs/scope_chain.h:
3307 (KJS::ScopeChain::swap):
3308 (KJS::ScopeChain::operator=):
3310 2008-04-21 Oliver Hunt <oliver@apple.com>
3314 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3315 <https://bugs.webkit.org/show_bug.cgi?id=18649>
3317 Allocate a callframe for eval() and initialise with a null codeBlock to
3318 indicate native code. This prevents the unwinder from clobbering the
3322 (KJS::Machine::execute):
3324 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3326 Reviewed by Sam Weinig.
3328 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
3329 ScopeChain::print to ScopeChainNode.
3331 ScopeChain is now nothing more than a resource-handling wrapper around
3334 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3338 Bug 18671: SquirrelFish: continue inside switch fails
3339 <https://bugs.webkit.org/show_bug.cgi?id=18671>
3341 * VM/CodeGenerator.cpp:
3342 (KJS::CodeGenerator::jumpContextForLabel):
3343 * VM/CodeGenerator.h:
3345 (KJS::ContinueNode::emitCode):
3347 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3349 Reviewed by Sam Weinig.
3351 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
3352 rearranging scope_chain.h a bit.
3354 SunSpider reports no change.
3356 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3358 Reviewed by Sam Weinig.
3360 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
3361 on the knowledge that the ScopeChain is never empty.
3363 SunSpider reports no change.
3365 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3367 Reviewed by Oliver Hunt.
3369 Moved begin() and end() from ScopeChain to ScopeChainNode.
3371 Also marked a few methods "const".
3373 SunSpider reports no change.
3375 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3377 Reviewed by Maciej Stachowiak.
3379 Turned ScopeChain::depth into a stand-alone function, and simplified it
3382 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
3383 the true depth of the ScopeChain -- just the Machine's perspective of
3384 its depth within a given call frame.
3386 SunSpider reports no change.
3388 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3390 Reviewed by Maciej Stachowiak.
3392 Removed indirection in ScopeChain::ref / ScopeChain::deref.
3394 SunSpider reports no change.
3396 * kjs/scope_chain.h:
3397 (KJS::ScopeChain::ScopeChain):
3398 (KJS::ScopeChain::~ScopeChain):
3399 (KJS::ScopeChain::clear):
3401 2008-04-21 Oliver Hunt <oliver@apple.com>
3403 Reviewed by NOBODY(Build fix)
3408 (KJS::ConstDeclNode::evaluateSingle):
3410 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3414 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
3415 <https://bugs.webkit.org/show_bug.cgi?id=18664>
3417 Correctly throw a SyntaxError when parsing of eval code fails.
3422 2008-04-21 Oliver Hunt <oliver@apple.com>
3426 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3428 Make sure we correct the register state before jumping to vm_throw.
3431 (KJS::Machine::privateExecute):
3433 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3435 Reviewed by Maciej Stachowiak.
3437 Simplified ScopeChain ref/deref.
3439 SunSpider reports a .4% speedup.
3441 * kjs/scope_chain.h:
3442 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
3443 ScopeChainNodes are initialized with a refCount of 1, so the loop was
3444 guaranteed to iterate exactly once.
3446 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3448 Reviewed by Maciej Stachowiak.
3450 Removed support for empty ScopeChains.
3452 SunSpider reports no change.
3454 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3456 Reviewed by Maciej Stachowiak.
3458 Removed some completely unused ScopeChain member functions.
3460 SunSpider reports no change.
3462 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3464 Reviewed by Maciej Stachowiak.
3466 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3468 SunSpider reports no change.
3470 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3472 Rubber stamped by Alexey.
3479 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3483 - only print "End:" output when -d flag is passed.
3485 This fixes half of our failing JSC regression tests.
3490 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3494 Add support for variable declarations in eval code.
3497 (KJS::EvalCodeBlock::EvalCodeBlock):
3498 * VM/CodeGenerator.cpp:
3499 (KJS::CodeGenerator::CodeGenerator):
3500 * VM/CodeGenerator.h:
3502 (KJS::Machine::execute):
3505 (KJS::globalFuncEval):
3507 (KJS::EvalNode::generateCode):
3511 2008-04-20 Oliver Hunt <oliver@apple.com>
3515 Throw exceptions for invalid continue, break, and return statements.
3517 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3519 * VM/CodeGenerator.cpp:
3520 (KJS::CodeGenerator::CodeGenerator):
3521 (KJS::CodeGenerator::pushJumpContext):
3522 (KJS::CodeGenerator::popJumpContext):
3523 (KJS::CodeGenerator::jumpContextForLabel):
3524 * VM/CodeGenerator.h:
3526 (KJS::Node::emitThrowError):
3527 (KJS::ContinueNode::emitCode):
3528 (KJS::BreakNode::emitCode):
3529 (KJS::ReturnNode::emitCode):
3532 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3534 Reviewed by Oliver Hunt.
3536 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3537 things that used to be inlined automatically.
3539 1.9% speedup on SunSpider.
3541 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3542 that GCC is making fewer decisions. The speedup seems to confirm that.
3544 2008-04-20 Oliver Hunt <oliver@apple.com>
3548 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3549 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3551 To prevent incorrectly reusing what will become the result register for
3552 eval and global code execution, we need to request and ref the destination
3553 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3554 although in future we can probably limit this. Curiously SunSpider shows
3555 a progression in a number of tests, although it comes out as a wash overall.
3558 (KJS::EvalNode::emitCode):
3559 (KJS::ProgramNode::emitCode):
3561 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3565 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3568 (KJS::CodeBlock::dump):
3569 * VM/CodeGenerator.cpp:
3570 (KJS::CodeGenerator::emitCreateError):
3571 * VM/CodeGenerator.h:
3573 (KJS::Machine::privateExecute):
3576 (KJS::PostfixErrorNode::emitCode):
3577 (KJS::PrefixErrorNode::emitCode):
3578 (KJS::AssignErrorNode::emitCode):
3581 2008-04-20 Oliver Hunt <oliver@apple.com>
3583 Reviewed by Geoff and Mark.
3585 Provide line number information in exceptions
3587 Simple patch, adds line number information metadata to CodeBlock
3588 and a simple method to get the line number responsible for a given
3592 (KJS::CodeBlock::lineNumberForVPC):
3594 * VM/CodeGenerator.h:
3595 (KJS::CodeGenerator::emitNode):
3597 (KJS::Machine::throwException):
3599 2008-04-20 Oliver Hunt <oliver@apple.com>
3603 Provide "sourceURL" in exceptions
3607 (KJS::Machine::throwException):
3609 (KJS::EvalNode::generateCode):
3610 (KJS::ProgramNode::generateCode):
3612 2008-04-19 Oliver Hunt <oliver@apple.com>
3616 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3618 This patch just a preparation for tracking line numbers.
3621 (KJS::ObjectLiteralNode::emitCode):
3622 (KJS::PropertyListNode::emitCode):
3623 (KJS::ArgumentListNode::emitCode):
3624 (KJS::TryNode::emitCode):
3626 2008-04-19 Oliver Hunt <oliver@apple.com>
3630 Bug 18619: Support continue, break, and return in try .. finally blocks
3631 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3633 This patch replaces the current partial finally support (which uses code
3634 duplication to achieve what it does) with a subroutine based approach.
3635 This has a number of advantages over code duplication:
3637 * Simplified exception handling as the finaliser code only exists in
3638 one place, so no "magic" is needed to get the correct handler for a
3640 * When we support instruction to line number mapping we won't need to
3641 worry about the dramatic code movement caused by duplication
3643 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3644 to enter and exit the finaliser subroutines, happily SunSpider reports
3645 a performance progression (gcc amazes me) and ubench reports a wash.
3647 While jsr and sret provide a mechanism that allows us to enter and exit
3648 any arbitrary finaliser we need to, it was still necessary to increase
3649 the amount of information tracked when entering and exiting both finaliser
3650 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3651 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3652 now use a scopeContextStack to ensure that we pop scopes and execute
3653 finalisers in the correct order. This increases the cost of "with" nodes
3654 during codegen, but it should not be significant enough to effect real
3655 world performance and greatly simplifies codegen for return, break and
3656 continue when interacting with finalisers.
3659 (KJS::CodeBlock::dump):
3660 Pretty printing of jsr/sret opcodes
3662 * VM/CodeGenerator.cpp:
3663 (KJS::CodeGenerator::CodeGenerator):
3664 (KJS::CodeGenerator::emitPushScope):
3665 (KJS::CodeGenerator::emitPopScope):
3666 Dynamic scopes need to be tracked on the scopeContextStack now
3668 (KJS::CodeGenerator::pushFinallyContext):
3669 (KJS::CodeGenerator::popFinallyContext):
3670 Handle entry and exit from code regions with finalisers. This is
3671 needed solely to support return, continue and break inside finaliser
3674 (KJS::CodeGenerator::emitComplexJumpScopes):
3675 Helper function for emitJumpScopes to handle the complex codegen
3676 needed to handle return, continue and break inside a finaliser region
3678 (KJS::CodeGenerator::emitJumpScopes):
3679 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3680 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3681 we can handle the normal (trivial) case with a single instruction.
3683 (KJS::CodeGenerator::emitJumpSubroutine):
3684 (KJS::CodeGenerator::emitSubroutineReturn):
3685 Trivial opcode emitter functions.
3687 * VM/CodeGenerator.h:
3688 (KJS::CodeGenerator::scopeDepth):
3690 (KJS::Machine::privateExecute):
3691 Implement op_jsr and op_sret.
3694 Ad op_jsr and op_sret
3697 (KJS::TryNode::emitCode):
3698 Fix codegen for new finaliser model.
3700 2008-04-17 Mark Rowe <mrowe@apple.com>
3702 Rubber-stamped by Oliver Hunt.
3704 Remove unnecessary files from testkjs, testapi and minidom targets.
3706 * JavaScriptCore.xcodeproj/project.pbxproj:
3708 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3710 Reviewed by Oliver Hunt.
3712 Fixed ASSERT seen during run-sunspider of a debug build.
3714 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3715 runs all tests in one global environment, so you end up with more than
3716 128 locals. This is just a stop-gap until we code up a real
3717 solution to arbitrary symbol and label limits.
3719 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3721 Reviewed by Oliver Hunt.
3723 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3724 chain in global scope, so we would leak ScopeChainNodes when exceptions
3725 were thrown inside "with" and "catch" scopes.
3727 Also did some cleanup of the unwinding code along the way.
3729 Scope chain reference counting is still wrong in a few ways. I thought
3730 I would fix this portion of it first.
3732 run-sunspider shows no change.
3735 (KJS::Machine::unwindCallFrame):
3736 (KJS::Machine::throwException):
3737 (KJS::Machine::privateExecute):
3740 2008-04-17 Oliver Hunt <oliver@apple.com>
3744 Add more exception checking to toNumber conversions
3746 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3749 (KJS::Machine::privateExecute):
3751 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3753 Reviewed by Oliver Hunt.
3757 Introduced a new opcode: op_call_eval. In the normal case, it performs
3758 an eval. In the case where eval has been overridden in some way, it
3759 performs a function call.
3761 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3762 to optimized locals in eval code.
3764 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3766 Reviewed by Sam Weinig.
3768 Added some ASSERTs to document codegen failures in
3769 run-javascriptcore-tests.
3771 For all tests, program-level codegen now either succeeds, or fails with
3774 * VM/CodeGenerator.cpp:
3775 (KJS::CodeGenerator::addVar):
3776 (KJS::CodeGenerator::CodeGenerator):
3777 (KJS::CodeGenerator::newTemporary):
3778 (KJS::CodeGenerator::newLabel):
3780 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3782 Reviewed by Maciej Stachowiak.
3784 Fixed another case of a dst register being an unreferenced temporary
3785 (caused an ASSERT when running the full sunspider suite).
3788 (KJS::CaseBlockNode::emitCodeForBlock):
3790 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3794 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
3797 (KJS::CodeBlock::dump):
3798 * VM/CodeGenerator.cpp:
3799 (KJS::CodeGenerator::emitMul):
3800 (KJS::CodeGenerator::emitDiv):
3801 (KJS::CodeGenerator::emitMod):
3802 (KJS::CodeGenerator::emitSub):
3803 (KJS::CodeGenerator::emitLeftShift):
3804 (KJS::CodeGenerator::emitRightShift):
3805 (KJS::CodeGenerator::emitUnsignedRightShift):
3806 (KJS::CodeGenerator::emitBitAnd):
3807 (KJS::CodeGenerator::emitBitXOr):
3808 (KJS::CodeGenerator::emitBitOr):
3809 * VM/CodeGenerator.h:
3811 (KJS::Machine::privateExecute):
3814 (KJS::MultNode::emitCode):
3815 (KJS::DivNode::emitCode):
3816 (KJS::ModNode::emitCode):
3817 (KJS::SubNode::emitCode):
3818 (KJS::LeftShiftNode::emitCode):
3819 (KJS::RightShiftNode::emitCode):
3820 (KJS::UnsignedRightShiftNode::emitCode):
3821 (KJS::BitAndNode::emitCode):
3822 (KJS::BitXOrNode::emitCode):
3823 (KJS::BitOrNode::emitCode):
3824 (KJS::emitReadModifyAssignment):
3825 (KJS::ReadModifyResolveNode::emitCode):
3827 2008-04-16 Oliver Hunt <oliver@apple.com>
3831 Exception checks for toNumber in op_pre_inc
3833 This is somewhat more convoluted than the simple hadException checks
3834 we currently use. Instead we use special toNumber conversions that
3835 select between the exception and ordinary vPC. This allows us to
3836 remove any branches in the common case (incrementing a number).
3838 * API/JSCallbackObject.h:
3839 * API/JSCallbackObjectFunctions.h:
3842 * JavaScriptCore.exp:
3843 * JavaScriptCore.xcodeproj/project.pbxproj:
3844 * VM/JSPropertyNameIterator.cpp:
3845 (KJS::JSPropertyNameIterator::toNumber):
3846 * VM/JSPropertyNameIterator.h:
3848 (KJS::Machine::privateExecute):
3850 * kjs/ExecState.cpp:
3851 (KJS::ExecState::ExecState):
3853 * kjs/JSNotAnObject.cpp:
3854 (KJS::JSNotAnObject::toNumber):
3855 * kjs/JSNotAnObject.h:
3857 (KJS::StringImp::toNumber):
3858 (KJS::NumberImp::toNumber):
3859 (KJS::GetterSetterImp::toNumber):
3862 (KJS::JSObject::toNumber):
3865 (KJS::JSValue::toNumber):
3867 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3871 - ensure that activations are kept in a register to protect them from GC
3873 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
3874 that is what is now kept there, and there is no more need to keep the scope chain in
3878 (KJS::initializeCallFrame):
3879 (KJS::scopeChainForCall):
3883 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3885 Reviewed by Oliver Hunt.
3887 Made "this" work in program code / global scope.
3889 The machine can initialize "this" prior to execution because it knows
3890 that, for program code, "this" is always stored in lr1.
3893 (KJS::Machine::execute):
3896 * kjs/interpreter.cpp:
3897 (KJS::Interpreter::evaluate):
3899 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3901 Reviewed by Oliver Hunt.
3903 Fixed a codegen bug when returning from inside a dynamic scope (a with
3904 or catch block): we need to pop any dynamic scope(s) that have been
3905 added so op_ret can find the activation object at the top of the scope
3909 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
3910 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
3911 and then branching to the return instruction.
3913 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3917 - document the add and get_prop_id opcodes
3919 In addition to adding documentation in comments, I changed
3920 references to register IDs or indices relating to these opcodes to
3921 have meaningful names instead of r0 r1 r2.
3923 * VM/CodeGenerator.cpp:
3924 (KJS::CodeGenerator::emitAdd):
3925 * VM/CodeGenerator.h:
3927 (KJS::Machine::privateExecute):
3929 (KJS::DotAccessorNode::emitCode):
3930 (KJS::FunctionCallDotNode::emitCode):
3931 (KJS::PostIncDotNode::emitCode):
3932 (KJS::PostDecDotNode::emitCode):
3933 (KJS::PreIncDotNode::emitCode):
3934 (KJS::PreDecDotNode::emitCode):
3935 (KJS::AddNode::emitCode):
3936 (KJS::ReadModifyDotNode::emitCode):
3938 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3940 Reviewed by Oliver Hunt and Maciej Stachowiak.
3942 Fixed a codegen bug in with and switch, and added an ASSERT to
3943 make sure it doesn't happen again.
3945 emitCode() assumes that dst, if non-zero, is either referenced or
3946 non-temporary (i.e., it assumes that newTemporary() will return a
3947 register not equal to dst). Certain callers to emitCode() weren't
3948 guaranteeing that to be so, so temporary register values were being
3951 * VM/CodeGenerator.h:
3952 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
3955 (KJS::CommaNode::emitCode): Reference the dst we pass.
3957 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
3959 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
3960 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
3962 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
3965 2008-04-15 Oliver Hunt <oliver@apple.com>
3969 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
3970 <https://bugs.webkit.org/show_bug.cgi?id=18526>
3972 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
3975 (KJS::resolveBaseAndFunc):
3976 (KJS::Machine::privateExecute):
3978 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3982 - fix incorrect result on 3d-raytrace test
3984 Oliver found and tracked down this bug, I just typed in the fix.
3987 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
3988 account for the space for local variables.
3990 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3994 - fix codegen handling of dst registers
3996 1.006x speedup (not sure why).
3998 Most emitCode functions take an optional "dst" parameter that says
3999 where the output of the instruction should be written. I made some
4000 functions for convenient handling of the dst register:
4002 * VM/CodeGenerator.h:
4003 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
4004 it is not null and is a temporary, otherwise allocates a new temporary. This is
4005 intended for cases where an intermediate value might be written into the dst
4007 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
4008 register that was used as a temp destination. Picks the right thing for the final
4009 output. Intended to be used as the output register for the instruction that generates
4010 the final value of a particular node.
4012 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
4013 RegisterID; moves from the register to dst if dst is defined and
4014 different from the register. This is intended for cases where the
4015 result of a node is already in a specific register (likely a
4016 local), and so no code needs to be generated unless a specific
4017 destination has been requested, in which case a move is needed.
4019 I also applied these methods throughout emitCode functions. In
4020 some cases this was just cleanup, in other cases I fixed actual
4021 codegen bugs. Below I have given specific comments for the cases
4022 where I believe I fixed a codegen bug, or improved quality of codegen.
4025 (KJS::NullNode::emitCode):
4026 (KJS::FalseNode::emitCode):
4027 (KJS::TrueNode::emitCode):
4028 (KJS::NumberNode::emitCode):
4029 (KJS::StringNode::emitCode):
4030 (KJS::RegExpNode::emitCode):
4031 (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
4032 the same as the this register (the unlikely case of "this = this");
4033 (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
4034 is the same as the local regiester, in the local var case (the
4035 unlikely case of "x = x");
4036 (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
4037 literal element expressions may have observed an intermediate
4038 value of constructing the array.
4039 (KJS::ObjectLiteralNode::emitCode):
4040 (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
4041 property definition expressions may have obesrved an intermediate value of
4042 constructing the object.
4043 (KJS::BracketAccessorNode::emitCode):
4044 (KJS::DotAccessorNode::emitCode):
4045 (KJS::NewExprNode::emitCode):
4046 (KJS::FunctionCallValueNode::emitCode):
4047 (KJS::FunctionCallBracketNode::emitCode):
4048 (KJS::FunctionCallDotNode::emitCode):
4049 (KJS::PostIncResolveNode::emitCode):
4050 (KJS::PostDecResolveNode::emitCode):
4051 (KJS::PostIncBracketNode::emitCode):
4052 (KJS::PostDecBracketNode::emitCode):
4053 (KJS::PostIncDotNode::emitCode):
4054 (KJS::PostDecDotNode::emitCode):
4055 (KJS::DeleteResolveNode::emitCode):
4056 (KJS::DeleteBracketNode::emitCode):
4057 (KJS::DeleteDotNode::emitCode):
4058 (KJS::DeleteValueNode::emitCode):
4059 (KJS::VoidNode::emitCode):
4060 (KJS::TypeOfResolveNode::emitCode):
4061 (KJS::TypeOfValueNode::emitCode):
4062 (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
4063 value would not be output to the dst register in the local var case.
4064 (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
4065 value would not be output to the dst register in the local var case.
4066 (KJS::PreIncBracketNode::emitCode):
4067 (KJS::PreDecBracketNode::emitCode):
4068 (KJS::PreIncDotNode::emitCode):
4069 (KJS::PreDecDotNode::emitCode):
4070 (KJS::UnaryPlusNode::emitCode):
4071 (KJS::NegateNode::emitCode):
4072 (KJS::BitwiseNotNode::emitCode):
4073 (KJS::LogicalNotNode::emitCode):
4074 (KJS::MultNode::emitCode):
4075 (KJS::DivNode::emitCode):
4076 (KJS::ModNode::emitCode):
4077 (KJS::AddNode::emitCode):
4078 (KJS::SubNode::emitCode):
4079 (KJS::LeftShiftNode::emitCode):
4080 (KJS::RightShiftNode::emitCode):
4081 (KJS::UnsignedRightShiftNode::emitCode):
4082 (KJS::LessNode::emitCode):
4083 (KJS::GreaterNode::emitCode):
4084 (KJS::LessEqNode::emitCode):
4085 (KJS::GreaterEqNode::emitCode):
4086 (KJS::InstanceOfNode::emitCode):
4087 (KJS::InNode::emitCode):
4088 (KJS::EqualNode::emitCode):
4089 (KJS::NotEqualNode::emitCode):
4090 (KJS::StrictEqualNode::emitCode):
4091 (KJS::NotStrictEqualNode::emitCode):
4092 (KJS::BitAndNode::emitCode):
4093 (KJS::BitXOrNode::emitCode):
4094 (KJS::BitOrNode::emitCode):
4095 (KJS::LogicalAndNode::emitCode):
4096 (KJS::LogicalOrNode::emitCode):
4097 (KJS::ConditionalNode::emitCode):
4098 (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
4099 needed for fixes below.
4100 (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
4101 the expression may observe an intermediate value.
4102 (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
4103 expression may observe an intermediate value.
4104 (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
4105 expression may observe an intermediate value.
4106 (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
4107 expression may observe an intermediate value.
4108 (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
4109 (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
4110 (KJS::FuncExprNode::emitCode):
4112 2008-04-15 Maciej Stachowiak <mjs@apple.com>
4116 - fix huge performance regression (from trunk) in string-unpack-code
4118 This restores string-unpack-code performance to parity with
4119 trunk (2.27x speedup relative to previous SquirrelFish)
4122 (KJS::Machine::execute): Shrink register file after call to avoid
4125 2008-04-15 Geoffrey Garen <ggaren@apple.com>
4127 Reviewed by Sam Weinig.
4129 Fixed dumpCallFrame to match our new convention of passing around a
4130 ScopeChainNode* instead of a ScopeChain*.
4132 * JavaScriptCore.exp:
4134 (KJS::Machine::dumpCallFrame):
4137 2008-04-15 Oliver Hunt <oliver@apple.com>
4141 Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
4142 <https://bugs.webkit.org/show_bug.cgi?id=18436>
4144 Add op_resolve_base_and_property for read/modify/write operations,
4145 this adds a "superinstruction" to resolve the base and value of a
4146 property simultaneously. Just using resolveBase and resolve results
4147 in an 5% regression in ubench, 30% in loop-empty-resolve (which is
4148 expected). 1.3% progression in sunspider, 2.1% in ubench, with a
4149 21% gain in loop-empty-resolve. The only outlier is function-missing-args
4150 which gets a 3% regression that I could never resolve.
4153 (KJS::CodeBlock::dump):
4154 * VM/CodeGenerator.cpp:
4155 (KJS::CodeGenerator::emitResolveBaseAndProperty):
4156 * VM/CodeGenerator.h:
4158 (KJS::resolveBaseAndProperty):
4159 (KJS::Machine::privateExecute):
4162 (KJS::PostIncResolveNode::emitCode):
4163 (KJS::PostDecResolveNode::emitCode):
4164 (KJS::PreIncResolveNode::emitCode):
4165 (KJS::PreDecResolveNode::emitCode):
4166 (KJS::ReadModifyResolveNode::emitCode):
4168 2008-04-15 Maciej Stachowiak <mjs@apple.com>
4172 - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
4173 https://bugs.webkit.org/show_bug.cgi?id=18508