1 2008-05-22 David Kilzer <ddkilzer@apple.com>
3 <rdar://problem/5954233> Add method to release free memory from FastMalloc
5 Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
7 * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
9 (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
10 system malloc and FastMalloc code paths.
11 * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
13 2008-05-22 Oliver Hunt <oliver@apple.com>
17 Roll out r34020 as it causes recursion tests to fail.
20 (KJS::JSObject::call):
22 2008-05-22 Oliver Hunt <oliver@apple.com>
26 Don't leak the SymbolTable when compiling eval code.
29 (KJS::EvalNode::generateCode):
31 2008-05-22 Simon Hausmann <hausmann@webkit.org>
37 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
38 * VM/LabelID.h: Include limits.h for UINT_MAX.
39 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
41 2008-05-22 Geoffrey Garen <ggaren@apple.com>
43 Reviewed by Adam Roben.
45 Removed the old recursion guard mechanism, since squirrelfish has its
46 own mechanism. Also removed some old JS call tracing code, since we
47 have other ways to do that, too.
49 SunSpider reports no change.
52 (KJS::JSObject::call):
54 2008-05-22 Maciej Stachowiak <mjs@apple.com>
58 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
61 (KJS::WithNode::emitCode):
62 (KJS::TryNode::emitCode):
64 2008-05-21 Kevin McCullough <kmccullough@apple.com>
66 Reviewed by Maciej and Geoff.
68 <rdar://problem/5951561> Turn on JavaScript Profiler
69 -As part of the effort to turn on the profiler it would be helpful if it
70 did not need ExecStates to represent the stack location of the currently
72 -We now create each node as necessary with a reference to the current
73 node and each node knows its parent so that the tree can be made without
76 * profiler/Profile.cpp:
77 (KJS::Profile::Profile): The current node starts at the head.
78 (KJS::Profile::stopProfiling): The current node is cleared when profiling
80 (KJS::Profile::willExecute): The current node either adds a new child or
81 starts and returns a reference to an already existing child if the call
82 ID that is requested already exists.
83 (KJS::Profile::didExecute): The current node finishes and returns its
85 * profiler/Profile.h: Use a single callIdentifier instead of a vector
86 since we no longer use the whole stack.
87 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
89 (KJS::ProfileNode::ProfileNode): Initialize the parent.
90 (KJS::ProfileNode::didExecute): Record the time and return the parent.
91 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
92 already a child, start it and return it, otherwise create a new one and
94 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
95 * profiler/ProfileNode.h: Utilize the parent.
96 (KJS::ProfileNode::create):
97 (KJS::ProfileNode::parent):
98 * profiler/Profiler.cpp:
99 (KJS::Profiler::startProfiling): Here is the only place where the
100 ExecState is used to figure out where in the stack the profiler is
102 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
104 (KJS::Profiler::willExecute): Ditto.
105 (KJS::Profiler::didExecute): Ditto.
106 (KJS::createCallIdentifier): Create only one CallIdentifier.
107 (KJS::createCallIdentifierFromFunctionImp): Ditto.
108 * profiler/Profiler.h:
110 2008-05-21 Darin Adler <darin@apple.com>
114 - https://bugs.webkit.org/show_bug.cgi?id=19180
115 speed up the < operator for the case when both values are integers
117 Makes standalone SunSpider 1.022x faster.
120 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
122 2008-05-21 Maciej Stachowiak <mjs@apple.com>
124 Reviewed by Oliver and Sam.
126 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
128 Track global this value in the scope chain so we can retrieve it
129 efficiently but it follows lexical scope properly.
132 (KJS::ExecState::globalThisValue):
133 * kjs/JSGlobalObject.h:
134 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
135 * kjs/function_object.cpp:
136 (KJS::FunctionObjectImp::construct):
138 (KJS::ScopeChainNode::ScopeChainNode):
139 (KJS::ScopeChainNode::globalThisObject):
140 (KJS::ScopeChainNode::push):
141 (KJS::ScopeChain::ScopeChain):
143 2008-05-21 Kevin McCullough <kmccullough@apple.com>
149 2008-05-21 Kevin McCullough <kmccullough@apple.com>
153 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
155 - This patch updatest the times of the visible nodes correctly, but to do
156 so, some of the design of the ProfileNode changed.
158 * JavaScriptCore.exp: export focus' symbol.
159 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
160 the profile tree to get up-to-date accurate total profile time.
161 (KJS::Profile::Profile): Pass 0 for the head node.
162 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
163 passed into it, since it can get it from the head and it does not need to
164 be told it is the head because it can figure it out on it's own.
165 (KJS::Profile::willExecute): Set the head node for each created node.
166 * profiler/Profile.h:
167 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
168 would have to create, now focus() takes a ProfileNode that they should
169 already have a reference to and focus() can extract the CallIdentifier
171 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
172 total and self times for focus and exclude. Also add a head node
173 reference so that nodes can get information from their head.
174 (KJS::ProfileNode::ProfileNode):
175 (KJS::ProfileNode::stopProfiling): Rename the total and self time
176 variables and set the visual ones to the actual ones, so that without any
177 changes to the visual versions of these variables, their times will match
179 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
180 to be visible if this node is visible. If this node does not match the
181 CallIdentifier being focused then the visibleTotalTime is only updated if
182 one or more of it's children is the CallIdentifier being focused.
183 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
184 the visible data in the ProfileNode.
185 (KJS::ProfileNode::endAndRecordCall): Name change.
186 (KJS::ProfileNode::debugPrintData): Dump the new variables.
187 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
188 * profiler/ProfileNode.h: Use the new variables and reference to the head
190 (KJS::ProfileNode::create):
191 (KJS::ProfileNode::totalTime):
192 (KJS::ProfileNode::setTotalTime):
193 (KJS::ProfileNode::selfTime):
194 (KJS::ProfileNode::setSelfTime):
195 (KJS::ProfileNode::totalPercent):
196 (KJS::ProfileNode::selfPercent):
197 (KJS::ProfileNode::setVisible):
199 2008-05-21 Alp Toker <alp@nuanti.com>
201 GTK+/UNIX testkjs build fix. Include signal.h.
205 2008-05-21 Oliver Hunt <oliver@apple.com>
207 Reviewed by NOBODY (Build fix).
209 Yet more windows build fixes
211 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
213 2008-05-21 Oliver Hunt <oliver@apple.com>
215 Reviewed by NOBODY (Build fix).
217 Yet more windows build fixes
219 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
221 2008-05-21 Alp Toker <alp@nuanti.com>
223 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
224 changes into account.
228 2008-05-21 Oliver Hunt <oliver@apple.com>
230 Reviewed by NOBODY (Build fix).
232 Add DebuggerCallFrame.{h,cpp} to the project file
234 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
236 2008-05-21 Alp Toker <alp@nuanti.com>
238 GTK+ port build fixes following squirrelfish merge r33979.
242 2008-05-21 Maciej Stachowiak <mjs@apple.com>
246 - save a hash lookup wne writing to global properties
247 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
250 (KJS::resolveBase): Check for being a the end of the scope chain
253 2008-05-21 Alp Toker <alp@nuanti.com>
255 Rubber-stamped by Maciej.
257 Replace non-standard #pragma marks with comments to avoid compiler
260 * profiler/ProfileNode.cpp:
262 2008-05-21 Geoffrey Garen <ggaren@apple.com>
264 Reviewed by Mark Rowe.
266 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
268 * JavaScriptCore.exp:
269 * kjs/JSGlobalObject.cpp:
270 (KJS::JSGlobalObject::defineGetter):
271 (KJS::JSGlobalObject::defineSetter):
272 * kjs/JSGlobalObject.h:
274 === End merge of squirrelfish ===
276 2008-05-21 Geoffrey Garen <ggaren@apple.com>
278 Reviewed by Tim Hatcher.
280 Merged with trunk WebCore's new debugger.
282 * kjs/DebuggerCallFrame.cpp:
283 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
284 the exception value from the return value. The WebKit debugger treats
285 them as one, but the WebCore debugger doesn't.
287 * kjs/DebuggerCallFrame.h:
288 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
289 the dynamic global object, since the debugger doesn't want the lexical
292 2008-05-21 Oliver Hunt <oliver@apple.com>
296 Bug 19116: SquirrelFish shouldn't regress on variable lookups
297 <https://bugs.webkit.org/show_bug.cgi?id=19116>
299 Optimise cross scope assignment, 0.4% progression in sunspider.
302 (KJS::CodeBlock::dump):
303 * VM/CodeGenerator.cpp:
304 (KJS::CodeGenerator::emitPutScopedVar):
305 * VM/CodeGenerator.h:
307 (KJS::Machine::privateExecute):
310 (KJS::AssignResolveNode::emitCode):
312 2008-05-21 Maciej Stachowiak <mjs@apple.com>
316 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
317 0.5% speedup on SunSpider
319 * kjs/JSGlobalObject.h:
320 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
321 because symbol table access is likely to have been optimized.
323 2008-05-21 Oliver Hunt <oliver@apple.com>
327 Bug 19116: SquirrelFish shouldn't regress on variable lookups
328 <https://bugs.webkit.org/show_bug.cgi?id=19116>
330 Optimise multiscope lookup of statically resolvable function calls.
331 SunSpider reports a 1.5% improvement, including 37% on
332 controlflow-recursive for some reason :D
335 (KJS::CodeBlock::dump):
336 * VM/CodeGenerator.cpp:
337 (KJS::CodeGenerator::emitResolve):
338 * VM/CodeGenerator.h:
340 (KJS::FunctionCallResolveNode::emitCode):
342 2008-05-21 Maciej Stachowiak <mjs@apple.com>
346 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
347 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
349 * JavaScriptCore.exp:
350 * kjs/JSGlobalObject.h:
351 (KJS::JSGlobalObject::getOwnPropertySlot):
352 * kjs/JSVariableObject.h:
353 (KJS::JSVariableObject::symbolTableGet):
355 (KJS::JSObject::getDirectLocation):
356 (KJS::JSObject::getOwnPropertySlotForWrite):
357 * kjs/property_map.cpp:
358 (KJS::PropertyMap::getLocation):
359 * kjs/property_map.h:
360 * kjs/property_slot.h:
361 (KJS::PropertySlot::putValue):
363 2008-05-20 Oliver Hunt <oliver@apple.com>
367 Bug 19116: SquirrelFish shouldn't regress on variable lookups
368 <https://bugs.webkit.org/show_bug.cgi?id=19116>
370 This restores multiscope optimisation to simple resolve, producing
371 a 2.6% progression in SunSpider. Have verified that none of the
372 sites broken by the multiscope optimisation in trunk were effected
376 (KJS::CodeBlock::dump):
378 (KJS::CodeBlock::CodeBlock):
379 * VM/CodeGenerator.cpp:
380 (KJS::CodeGenerator::findScopedProperty):
381 (KJS::CodeGenerator::emitResolve):
382 * VM/CodeGenerator.h:
385 (KJS::Machine::privateExecute):
387 * kjs/JSVariableObject.h:
389 2008-05-20 Oliver Hunt <oliver@apple.com>
391 Reviewed by NOBODY (Build fix).
393 Fixerate the windows build.
395 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
396 * VM/CodeGenerator.cpp:
398 * kjs/JSGlobalObject.h:
402 2008-05-20 Oliver Hunt <oliver@apple.com>
406 Bug 19110: SquirrelFish: Google Maps - no maps
407 <https://bugs.webkit.org/show_bug.cgi?id=19110>
409 Correct a comedy of errors present in my original patch to "fix"
410 exceptions occurring midway through pre and post increment. This
411 solution is cleaner than the original, doesn't need the additional
412 opcodes, and as an added benefit does not break Google Maps.
414 Sunspider reports a 0.4% progression.
417 (KJS::CodeBlock::dump):
418 * VM/CodeGenerator.cpp:
419 * VM/CodeGenerator.h:
421 (KJS::Machine::privateExecute):
424 (KJS::PreIncResolveNode::emitCode):
425 (KJS::PreDecResolveNode::emitCode):
426 (KJS::PreIncBracketNode::emitCode):
427 (KJS::PreDecBracketNode::emitCode):
428 (KJS::PreIncDotNode::emitCode):
429 (KJS::PreDecDotNode::emitCode):
431 2008-05-20 Maciej Stachowiak <mjs@apple.com>
435 - inline JSGlobalObject::getOwnPropertySlot
436 1% improvement on in-browser SunSpider (a wash command-line)
438 * kjs/JSGlobalObject.cpp:
439 * kjs/JSGlobalObject.h:
440 (KJS::JSGlobalObject::getOwnPropertySlot):
442 2008-05-18 Oliver Hunt <oliver@apple.com>
446 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
447 <https://bugs.webkit.org/show_bug.cgi?id=18752>
449 Handle exceptions thrown by toString conversion in subscript operators,
450 this should basically complete exception handling in SquirrelFish.
452 Sunspider reports no regression.
455 (KJS::Machine::privateExecute):
457 2008-05-17 Geoffrey Garen <ggaren@apple.com>
459 Reviewed by Oliver Hunt.
461 [Reapplying patch with previously missing files from r33553 -- Oliver]
465 SunSpider reports no change.
467 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
468 and created a debugger folder.
470 * VM/CodeGenerator.cpp:
471 (KJS::CodeGenerator::generate): If the debugger is attached, always
472 generate full scope chains for its sake.
475 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
476 due to an exception, so it doesn't keep stale call frames around.
478 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
479 debugger can distinguish them from function call frames.
481 (KJS::Machine::debug): Simplified this function, since the debugger
482 doesn't actually need all the information we used to provide.
484 (KJS::Machine::privateExecute): Treat debugging hooks like other function
485 calls, so the code we hook into (the debugger UI) can be optimized.
487 * kjs/debugger.cpp: Nixed these default callback implementations and
488 made the callbacks pure virtual instead, so the compiler could tell me
489 if I made a mistake in one of the subclasses.
491 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
492 callbacks. Changed from passing an ExecState* to passing a
493 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
497 (KJS::globalFuncEval): Easiest bug fix evar!
499 [Previously missing files from r33553]
500 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
501 (KJS::DebuggerCallFrame::functionName):
502 (KJS::DebuggerCallFrame::thisObject):
503 (KJS::DebuggerCallFrame::evaluateScript):
504 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
505 (KJS::DebuggerCallFrame::DebuggerCallFrame):
506 (KJS::DebuggerCallFrame::scopeChain):
507 (KJS::DebuggerCallFrame::exception):
509 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
513 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
514 <https://bugs.webkit.org/show_bug.cgi?id=18991>
516 Fix the last remaining blocking cases of this bug.
520 (KJS::ReadModifyResolveNode::emitCode):
522 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
528 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
529 <https://bugs.webkit.org/show_bug.cgi?id=18991>
531 Ensure that the code generated for assignments uses temporaries whenever
532 necessary. This patch covers the vast majority of situations, but there
533 are still a few left.
535 This patch also adds some missing cases to CodeBlock::dump().
538 (KJS::CodeBlock::dump):
539 * VM/CodeGenerator.h:
540 (KJS::CodeGenerator::destinationForAssignResult):
541 (KJS::CodeGenerator::leftHandSideNeedsCopy):
542 (KJS::CodeGenerator::emitNodeForLeftHandSide):
546 (KJS::AssignDotNode::emitCode):
547 (KJS::ReadModifyDotNode::emitCode):
548 (KJS::AssignBracketNode::emitCode):
549 (KJS::ReadModifyBracketNode::emitCode):
550 (KJS::ForInNode::ForInNode):
552 (KJS::ReadModifyResolveNode::):
553 (KJS::AssignResolveNode::):
554 (KJS::ReadModifyBracketNode::):
555 (KJS::AssignBracketNode::):
556 (KJS::AssignDotNode::):
557 (KJS::ReadModifyDotNode::):
559 2008-05-17 Oliver Hunt <oliver@apple.com>
563 Bug 19106: SquirrelFish: Activation is not marked correctly
564 <https://bugs.webkit.org/show_bug.cgi?id=19106>
566 We can't rely on the symbol table for a count of the number of globals
567 we need to mark as that misses duplicate parameters and 'this'. Now we
568 use the actual local register count from the codeBlock.
570 * kjs/JSActivation.cpp:
571 (KJS::JSActivation::mark):
573 2008-05-16 Oliver Hunt <oliver@apple.com>
577 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
578 <https://bugs.webkit.org/show_bug.cgi?id=19076>
580 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
581 to allocate the global 'this' register safely at any point after initialisation of the Global
584 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
585 support for the static slot optimisation for the global Math object which brings it to a 0.3%
588 * VM/CodeGenerator.cpp:
589 (KJS::CodeGenerator::programCodeThis):
590 (KJS::CodeGenerator::CodeGenerator):
591 (KJS::CodeGenerator::addParameter):
592 * VM/CodeGenerator.h:
594 (KJS::Machine::execute):
596 * kjs/JSGlobalObject.cpp:
597 (KJS::JSGlobalObject::reset):
598 * kjs/JSGlobalObject.h:
599 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
600 (KJS::JSGlobalObject::addStaticGlobals):
603 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
605 Reviewed by Oliver Hunt.
607 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
608 <https://bugs.webkit.org/show_bug.cgi?id=19098>
610 When doing code generation for a statement list, increase the reference
611 count on a register that might eventually be returned, so that it doesn't
612 get clobbered by a request for a new temporary.
615 (KJS::statementListEmitCode):
617 2008-05-16 Maciej Stachowiak <mjs@apple.com>
621 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
622 https://bugs.webkit.org/show_bug.cgi?id=19044
624 * kjs/JSActivation.cpp:
625 (KJS::JSActivation::copyRegisters): Use numLocals from the code
626 block rather than the size of the symbol table for the number of
627 registers to copy, to account for duplicate parameters and vars
628 with the same name as parameters (we still have potentially
629 suboptimal codegen in that we allocate a local register for the
630 var in the latter case but it is never used).
632 2008-05-15 Geoffrey Garen <ggaren@apple.com>
636 We regret to inform you that your program is crashing because you were
640 (KJS::Machine::privateExecute): Math is hard.
642 2008-05-14 Geoffrey Garen <ggaren@apple.com>
644 Reviewed by Oliver Hunt.
646 A little more debugger action: filled in op_debug. All debugger control
647 flow works now, but variable inspection and backtraces still don't.
649 SunSpider reports no change.
651 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
654 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
655 NEVER_INLINE function to avoid a stunning 10% performance regression.
656 Also factored out a common function for retrieving the function and
657 arguments from a call frame.
659 * kjs/JSActivation.cpp:
660 (KJS::JSActivation::createArgumentsObject): Use the new factored out
661 function mentioned above.
664 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
665 sourceId we send to the debugger matches the sourceId recorded in the
668 * kjs/nodes.cpp: Emit debugging hooks.
670 2008-05-14 Oliver Hunt <oliver@apple.com>
674 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
675 <https://bugs.webkit.org/show_bug.cgi?id=19024>
677 This fixes a number of issues. The most important is that we now check every register
678 file for tainting rather than just looking for function register files as that was
679 insufficient. Additionally guarded against implicit re-entry into Eval code.
681 Also added a few additional assertions to reduce the amout of time between something
682 going wrong and us seeing the error.
685 (KJS::Machine::execute):
686 (KJS::Machine::privateExecute):
687 * VM/RegisterFile.cpp:
688 (KJS::RegisterFile::growBuffer):
689 (KJS::RegisterFile::addGlobalSlots):
690 * VM/RegisterFileStack.cpp:
691 (KJS::RegisterFileStack::pushGlobalRegisterFile):
692 (KJS::RegisterFileStack::pushFunctionRegisterFile):
693 * VM/RegisterFileStack.h:
694 (KJS::RegisterFileStack::inImplicitCall):
696 2008-05-14 Geoffrey Garen <ggaren@apple.com>
698 Reviewed by Oliver Hunt.
700 A little more debugger action: emit opcodes for debugger hooks. Right
701 now, the opcode implementation is just a stub.
703 SunSpider reports no change.
705 Some example codegen for "function f() { 1; }":
707 [ 0] dbg DidEnterCallFrame
708 [ 2] dbg WillExecuteStatement
709 [ 4] load tr0, 1(@k0)
710 [ 7] load tr0, undefined(@k1)
711 [ 10] dbg WillLeaveCallFrame
714 2008-05-14 Oliver Hunt <oliver@apple.com>
718 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
719 <https://bugs.webkit.org/show_bug.cgi?id=19025>
721 Simple fix -- move the use of functionBodyNode to after the null check.
723 * kjs/function_object.cpp:
724 (KJS::FunctionObjectImp::construct):
726 2008-05-13 Geoffrey Garen <ggaren@apple.com>
728 Reviewed by Oliver Hunt.
730 Fixed a codegen crash with run-time parse errors.
732 SunSpider reports no change.
734 emitThrowError needs to return the temporary holding the error, not dst,
735 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
736 parameter at all, since exceptions should not modify the destination
739 2008-05-13 Oliver Hunt <oliver@apple.com>
743 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
744 <https://bugs.webkit.org/show_bug.cgi?id=19027>
746 This fixes the codegen issues for the pre-inc/decrement operators
747 to prevent incorrectly clobbering the destination in the event of
751 (KJS::CodeBlock::dump):
752 * VM/CodeGenerator.cpp:
753 (KJS::CodeGenerator::emitPreInc):
754 (KJS::CodeGenerator::emitPreDec):
755 * VM/CodeGenerator.h:
757 (KJS::Machine::privateExecute):
760 (KJS::PreIncResolveNode::emitCode):
761 (KJS::PreDecResolveNode::emitCode):
762 (KJS::PreIncBracketNode::emitCode):
763 (KJS::PreDecBracketNode::emitCode):
764 (KJS::PreIncDotNode::emitCode):
765 (KJS::PreDecDotNode::emitCode):
767 2008-05-13 Geoffrey Garen <ggaren@apple.com>
769 Reviewed by Oliver Hunt.
771 A little more debugger action: supply a real line number, sourceId,
772 and sourceURL in op_new_error.
774 SunSpider reports a .2% speedup. Not sure what that's about.
777 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
780 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
783 2008-05-13 Geoffrey Garen <ggaren@apple.com>
785 Reviewed by Oliver Hunt.
787 A little more debugger action: implemented the exception callback.
789 SunSpider reports a .2% speedup. Not sure what that's about.
791 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
792 owner ScopeNode so we can retrieve data from it. This allows us to
793 stop storing copies of the data ourselves. Also, store a "this" register
794 instead of a code type, since we were only using the code type to
795 calculate the "this" register.
797 * VM/CodeGenerator.cpp:
798 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
799 above. Also, take care of removing "this" from the symbol table after
800 codegen is done, since relying on the timing of a destructor for correct
801 behavior is not so good.
804 (KJS::Machine::throwException): Invoke the debugger's exception callback.
805 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
807 2008-05-13 Geoffrey Garen <ggaren@apple.com>
809 Reviewed by Oliver Hunt.
811 Removed some unused exception machinery.
813 SunSpider reports a .3% speedup.
815 * API/JSCallbackObject.h:
816 * API/JSCallbackObjectFunctions.h:
817 * JavaScriptCore.exp:
819 (KJS::Machine::privateExecute):
825 2008-05-13 Geoffrey Garen <ggaren@apple.com>
827 Reviewed by Oliver Hunt.
829 A little more debugger action.
832 * kjs/debugger.h: Removed debuggersPresent because it was unused.
833 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
834 is faster and simpler. Changed all functions to return void instead of
835 bool, because no clients ever return false, and we don't want to support
838 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
839 (KJS::Node::handleException):
840 (KJS::BreakpointCheckStatement::execute):
841 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
843 2008-05-13 Oliver Hunt <oliver@apple.com>
847 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
848 <https://bugs.webkit.org/show_bug.cgi?id=18752>
850 Replace old attempt at "branchless" exceptions as the extra information
851 being passed made gcc an unhappy compiler, replacing these custom toNumber
852 calls with ordinary toNumber logic (by relying on toNumber now preventing
853 side effects after an exception has been thrown) provided sufficient leeway
854 to add the additional checks for the remaining unchecked cases.
856 This leaves only toString conversions in certain contexts as possibly
862 (KJS::resolveBaseAndProperty):
863 (KJS::resolveBaseAndFunc):
864 (KJS::Machine::privateExecute):
867 (KJS::JSValue::safeGetNumber):
869 2008-05-13 Geoffrey Garen <ggaren@apple.com>
871 Reviewed by Oliver Hunt.
873 First steps toward supporting the debugger API: support the sourceParsed
874 callback; plus some minor fixups.
876 SunSpider reports no regression.
878 * VM/CodeGenerator.h: Removed a misleading comment.
880 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
881 implement the sourceParsed callback -- that way, we only have to
882 implement the callback in one place.
884 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
885 was to demonstrate the misapplication of design patterns.
887 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
888 reduce copying, and not to return a value, because pausing execution
889 after parsing is complicated, and no clients needed that ability, anyway.
891 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
892 didFinishParsing -- that simplifies some code down the road.
894 * kjs/nodes.cpp: Don't generate special AST nodes just because the
895 debugger is attached -- that's a relic of the old AST execution model,
896 and those nodes haven't been maintained.
898 2008-05-13 Oliver Hunt <oliver@apple.com>
902 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
903 <https://bugs.webkit.org/show_bug.cgi?id=18752>
905 First step: prevent incorrect evaluation of valueOf/toString conversion
906 in right hand side of expression after earlier conversion throws.
908 * API/JSCallbackObjectFunctions.h:
911 (KJS::JSObject::defaultValue):
913 2008-05-12 Oliver Hunt <oliver@apple.com>
917 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
918 <https://bugs.webkit.org/show_bug.cgi?id=18934>
920 Unfortunately we cannot create new statically optimised globals if there are any
921 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
922 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
925 (KJS::Machine::execute):
926 * VM/RegisterFileStack.cpp:
927 (KJS::RegisterFileStack::pushFunctionRegisterFile):
928 * VM/RegisterFileStack.h:
930 2008-05-12 Geoffrey Garen <ggaren@apple.com>
932 Reviewed by Maciej Stachowiak.
934 Introduced support for function.caller.
936 Improved support for walking interesting scopes for function introspection.
938 This fixes all remaining layout tests not blocked by rebasing to trunk.
940 SunSpider reports no change.
943 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
945 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
949 Bug 18961: SQUIRRELFISH: Gmail doesn't load
950 <https://bugs.webkit.org/show_bug.cgi?id=18961>
952 Fix codegen for logical nodes so that they don't use their destination
956 (KJS::LogicalAndNode::emitCode):
957 (KJS::LogicalOrNode::emitCode):
959 2008-05-10 Maciej Stachowiak <mjs@apple.com>
963 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
964 https://bugs.webkit.org/show_bug.cgi?id=18869
966 Three layout tests are fixed:
967 fast/js/toString-elision-trailing-comma.html
968 fast/js/toString-prefix-postfix-preserve-parens.html
969 fast/js/kde/lval-exceptions.html
971 Functions now save a shared subrange of the original source used
972 to make them (so in the common case this adds no storage above the
975 * kjs/SourceProvider.h: Added.
976 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
977 to the source for a JavaScript program. This allows function objects to have access to their
978 original source without copying.
979 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
980 (KJS::UStringSourceProvider::create):
981 (KJS::UStringSourceProvider::getRange):
982 (KJS::UStringSourceProvider::data):
983 (KJS::UStringSourceProvider::length):
984 (KJS::UStringSourceProvider::UStringSourceProvider):
985 * kjs/SourceRange.h: Added.
986 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
987 the source, to encapsulate on-demand access to the source of a function.
988 (KJS::SourceRange::toString):
990 (KJS::eval): Pass a UStringSourceProvider to the parser.
992 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
994 (KJS::Parser::parse): Take a SourceProvider.
996 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
997 use it to get the raw buffer and length.
999 (KJS::Lexer::sourceRange): Convenience function to get a source
1000 range based on the lexer's source provieder, and char offsets
1001 right before and after the desired range.
1003 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
1004 * kjs/function_object.cpp:
1005 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
1006 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
1007 * kjs/grammar.y: When parsing a function declaration, function
1008 expression, or getter or setter, tell the function body about its
1010 * kjs/interpreter.cpp:
1011 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
1012 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
1013 * kjs/interpreter.h:
1015 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
1016 (KJS::FunctionBodyNode::toSourceString): Get the source string out
1018 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
1019 (KJS::FuncDeclNode::): ditto
1021 (prettyPrintScript): Use a SourceProvider appropriately.
1022 * JavaScriptCore.exp: Export new symbols.
1023 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
1024 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
1026 2008-05-09 Oliver Hunt <oliver@apple.com>
1030 Bring back RegisterFile tainting in order to correctly handle
1031 natively implemented getters and setters that re-enter JavaScript
1034 (KJS::Machine::privateExecute):
1035 * VM/RegisterFile.h:
1037 (KJS::FunctionImp::callAsFunction):
1039 (KJS::JSObject::put):
1040 (KJS::tryGetAndCallProperty):
1041 * kjs/property_slot.cpp:
1042 (KJS::PropertySlot::functionGetter):
1044 2008-05-09 Maciej Stachowiak <mjs@apple.com>
1048 - track character offsets of open and close braces, in preparation for saving function source
1050 I verified that there is no performance regression from this change.
1055 (KJS::Lexer::matchPunctuator):
1058 2008-05-09 Oliver Hunt <oliver@apple.com>
1060 Reviewed by Nobody (build fix).
1064 * kjs/JSGlobalObject.cpp:
1065 (KJS::JSGlobalObject::restoreLocalStorage):
1067 2008-05-09 Oliver Hunt <oliver@apple.com>
1071 Build fixes for SquirrelFish on windows.
1073 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1074 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1076 * kjs/JSGlobalObject.cpp:
1077 (KJS::JSGlobalObject::restoreLocalStorage):
1078 * kjs/collector.cpp:
1079 (KJS::Collector::allocate):
1080 (KJS::Collector::allocateNumber):
1082 (KJS::Collector::allocate):
1083 (KJS::Collector::allocateNumber):
1084 * kjs/property_slot.cpp:
1086 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1090 - fix activation tearoff in the case where functions are called with too many arguments
1093 fast/canvas/patternfill-repeat.html
1094 fast/dom/SelectorAPI/bug-17313.html
1097 (KJS::slideRegisterWindowForCall):
1098 (KJS::scopeChainForCall):
1099 (KJS::Machine::execute):
1100 (KJS::Machine::privateExecute):
1102 2008-05-08 Geoffrey Garen <ggaren@apple.com>
1104 Reviewed by Oliver Hunt.
1106 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
1108 SunSpider reports a small speedup. Not sure what that's about.
1111 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
1112 This helped me while debugging.
1115 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
1116 off, don't use the scope chain. Inside eval, the scope chain doesn't
1117 belong to us; it belongs to our calling function.
1119 Also, don't use the needsFullScopeChain flag to decide whether to tear
1120 off the activation. "function.arguments" can create an activation
1121 for a function whose needsFullScopeChain flag is set to false.
1123 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1127 - fix function.call for calls of more than 8 arguments
1129 Fixes svg/carto.net/button.svg
1132 (KJS::List::getSlice): properly set up the m_buffer of the target list.
1134 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1138 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
1141 - fast/regex/early-acid3-86.html
1142 - http/tests/misc/acid3.html
1145 (KJS::RegExpNode::emitCode):
1147 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1151 Fix a performance regression caused by the introduction of property
1152 attributes to SymbolTable in r32859 by encoding the attributes and the
1153 register index into a single field of SymbolTableEntry.
1155 This leaves Node::optimizeVariableAccess() definitely broken, although
1156 it was probably not entirely correct in SquirrelFish before this change.
1159 (KJS::missingThisObjectMarker):
1160 * VM/CodeGenerator.cpp:
1161 (KJS::CodeGenerator::addVar):
1162 (KJS::CodeGenerator::CodeGenerator):
1163 (KJS::CodeGenerator::registerForLocal):
1164 (KJS::CodeGenerator::registerForLocalConstInit):
1165 (KJS::CodeGenerator::isLocalConstant):
1166 (KJS::CodeGenerator::addConstant):
1167 (KJS::CodeGenerator::emitCall):
1168 * VM/CodeGenerator.h:
1169 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
1171 (KJS::Machine::privateExecute):
1172 * kjs/JSGlobalObject.cpp:
1173 (KJS::JSGlobalObject::saveLocalStorage):
1174 * kjs/JSVariableObject.cpp:
1175 (KJS::JSVariableObject::getPropertyNames):
1176 (KJS::JSVariableObject::getPropertyAttributes):
1177 * kjs/JSVariableObject.h:
1178 (KJS::JSVariableObject::symbolTableGet):
1179 (KJS::JSVariableObject::symbolTablePut):
1180 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1181 * kjs/SymbolTable.h:
1182 (KJS::SymbolTableEntry::SymbolTableEntry):
1183 (KJS::SymbolTableEntry::isEmpty):
1184 (KJS::SymbolTableEntry::getIndex):
1185 (KJS::SymbolTableEntry::getAttributes):
1186 (KJS::SymbolTableEntry::setAttributes):
1187 (KJS::SymbolTableEntry::isReadOnly):
1189 (KJS::getSymbolTableEntry):
1190 (KJS::PostIncResolveNode::optimizeVariableAccess):
1191 (KJS::PostDecResolveNode::optimizeVariableAccess):
1192 (KJS::DeleteResolveNode::optimizeVariableAccess):
1193 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1194 (KJS::PreIncResolveNode::optimizeVariableAccess):
1195 (KJS::PreDecResolveNode::optimizeVariableAccess):
1196 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1197 (KJS::AssignResolveNode::optimizeVariableAccess):
1198 (KJS::ProgramNode::initializeSymbolTable):
1200 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1202 Rubber stamped by Oliver.
1204 - add missing ! in an assert that I failed to reverse
1206 * VM/CodeGenerator.cpp:
1207 (KJS::CodeGenerator::CodeGenerator):
1209 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1213 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
1214 https://bugs.webkit.org/show_bug.cgi?id=18868
1216 The basic approach is to have "this" only be present in the symbol
1217 table at compile time, not runtime.
1219 * VM/CodeGenerator.cpp:
1220 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
1221 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
1223 * VM/CodeGenerator.h:
1225 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
1227 2008-05-06 Geoffrey Garen <ggaren@apple.com>
1229 Reviewed by Oliver Hunt.
1231 Trivial support for function.arguments: Currently, we only support
1232 function.arguments from within the scope of function.
1234 This fixes the remaining Mozilla JS test failures.
1236 SunSpider reports no change.
1238 * JavaScriptCore.exp:
1241 (KJS::Machine::privateExecute): Separated scope chain deref from
1242 activation register copying: since it is now possible for client code
1243 to create an activation on behalf of a function that otherwise wouldn't
1244 need one, having an activation no longer necessarily means that you need
1245 to deref the scope chain.
1247 (KJS::Machine::getCallFrame): For now, this function only examines the
1248 current scope. Walking parent scopes requires some refactoring in the
1249 way we track execution stacks.
1251 * kjs/ExecState.cpp:
1252 (KJS::ExecState::ExecState): We use a negative call frame offset to
1253 indicate that a given scope is not a function call scope.
1255 2008-05-05 Oliver Hunt <oliver@apple.com>
1259 Fix call frame set up for native -> JS function calls.
1262 (KJS::Machine::execute):
1264 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1266 Reviewed by Maciej Stachowiak.
1268 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1270 SunSpider reports a .4% speedup. Not sure what that's about.
1273 (KJS::Machine::privateExecute): Check for exception return from equal,
1274 since toPrimitive can throw.
1276 * kjs/operations.cpp:
1277 (KJS::strictEqual): In response to an error I made in an earlier version
1278 of this patch, I changed strictEqual to make clear the fact that it
1279 performs no conversions and can't throw, making it slightly more efficient
1282 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1286 - fix some dumb mistakes in my last patch
1288 * VM/CodeGenerator.cpp:
1289 (KJS::CodeGenerator::emitPushScope):
1290 (KJS::CodeGenerator::emitGetPropertyNames):
1292 (KJS::Machine::privateExecute):
1294 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1298 - document opcodes relating to jumps, scopes, and property name iteration
1300 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1301 next_pname and jmp_scopes.
1303 * VM/CodeGenerator.cpp:
1304 (KJS::CodeGenerator::emitJump):
1305 (KJS::CodeGenerator::emitJumpIfTrue):
1306 (KJS::CodeGenerator::emitJumpIfFalse):
1307 (KJS::CodeGenerator::emitPushScope):
1308 (KJS::CodeGenerator::emitNextPropertyName):
1309 (KJS::CodeGenerator::emitGetPropertyNames):
1310 * VM/CodeGenerator.h:
1312 (KJS::Machine::privateExecute):
1314 (KJS::LogicalAndNode::emitCode):
1315 (KJS::LogicalOrNode::emitCode):
1316 (KJS::ConditionalNode::emitCode):
1317 (KJS::IfNode::emitCode):
1318 (KJS::IfElseNode::emitCode):
1319 (KJS::DoWhileNode::emitCode):
1320 (KJS::WhileNode::emitCode):
1321 (KJS::ForNode::emitCode):
1322 (KJS::ForInNode::emitCode):
1323 (KJS::WithNode::emitCode):
1325 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1329 Bug 18749: SQUIRRELFISH: const support is broken
1330 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1332 Adds support for const during code generation.
1334 Fixes 2 layout tests.
1337 * VM/CodeGenerator.cpp:
1338 (KJS::CodeGenerator::addVar):
1339 (KJS::CodeGenerator::CodeGenerator):
1340 (KJS::CodeGenerator::isLocalConstant):
1341 * VM/CodeGenerator.h:
1342 (KJS::CodeGenerator::addVar):
1344 (KJS::PostIncResolveNode::emitCode):
1345 (KJS::PostDecResolveNode::emitCode):
1346 (KJS::PreIncResolveNode::emitCode):
1347 (KJS::PreDecResolveNode::emitCode):
1348 (KJS::ReadModifyResolveNode::emitCode):
1349 (KJS::AssignResolveNode::emitCode):
1351 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1355 - document some more opcodes (and fix argument names)
1357 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1359 * VM/CodeGenerator.cpp:
1360 (KJS::CodeGenerator::emitEqual):
1361 (KJS::CodeGenerator::emitNotEqual):
1362 (KJS::CodeGenerator::emitStrictEqual):
1363 (KJS::CodeGenerator::emitNotStrictEqual):
1364 (KJS::CodeGenerator::emitLess):
1365 (KJS::CodeGenerator::emitLessEq):
1366 * VM/CodeGenerator.h:
1368 (KJS::Machine::privateExecute):
1370 (KJS::LessNode::emitCode):
1371 (KJS::GreaterNode::emitCode):
1372 (KJS::LessEqNode::emitCode):
1373 (KJS::GreaterEqNode::emitCode):
1374 (KJS::EqualNode::emitCode):
1375 (KJS::NotEqualNode::emitCode):
1376 (KJS::StrictEqualNode::emitCode):
1377 (KJS::NotStrictEqualNode::emitCode):
1378 (KJS::CaseBlockNode::emitCodeForBlock):
1380 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1382 Reviewed by Maciej Stachowiak.
1384 More scaffolding for f.arguments.
1386 Track the offset of the last call frame in the ExecState, so we can
1387 produce a backtrace at any time.
1389 Also, record numLocals, the sum of numVars + numParameters, in each code
1390 block, to make updates to the ExecState a little cheaper than they
1393 We now use numLocals in a bunch of places where we used to calculate
1394 numVars + numParameters or -numVars - numParameters.
1396 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1398 2008-05-04 Oliver Hunt <oliver@apple.com>
1402 Whoops, correctly handle properties that don't exist in the
1405 * kjs/JSVariableObject.h:
1406 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1408 2008-05-04 Oliver Hunt <oliver@apple.com>
1412 Add attribute information to SymbolTable as ground work for
1413 various DontEnum and ReadOnly issues.
1415 * VM/CodeGenerator.cpp:
1416 (KJS::CodeGenerator::addVar):
1417 (KJS::CodeGenerator::CodeGenerator):
1418 (KJS::CodeGenerator::registerForLocal):
1419 (KJS::CodeGenerator::registerForLocalConstInit):
1420 (KJS::CodeGenerator::addConstant):
1422 (KJS::Machine::execute):
1423 * kjs/JSGlobalObject.cpp:
1424 (KJS::JSGlobalObject::saveLocalStorage):
1425 * kjs/JSVariableObject.cpp:
1426 (KJS::JSVariableObject::getPropertyNames):
1427 (KJS::JSVariableObject::getPropertyAttributes):
1428 * kjs/JSVariableObject.h:
1429 (KJS::JSVariableObject::symbolTablePut):
1430 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1431 * kjs/SymbolTable.h:
1432 (KJS::SymbolTableEntry::SymbolTableEntry):
1433 (KJS::SymbolTableIndexHashTraits::emptyValue):
1435 (KJS::getSymbolTableEntry):
1436 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1437 (KJS::AssignResolveNode::optimizeVariableAccess):
1438 (KJS::ProgramNode::initializeSymbolTable):
1440 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1442 Reviewed by Oliver Hunt.
1444 More scaffolding for f.arguments.
1446 Store the register file associated with an ExecState in the ExecState.
1448 SunSpider reports no change.
1450 * kjs/JSGlobalObject.h:
1451 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1452 registerFileStack above globalExec, so it gets initialized first.
1453 Removed remnants of old activation scheme.
1455 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1457 Rubber stamped by Oliver.
1459 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1463 resolve_base_and_property --> resolve_with_base
1464 resolve_base_and_func --> resolve_func
1465 get_prop_id --> get_by_id
1466 put_prop_id --> put_by_id
1467 delete_prop_id --> del_by_id
1468 get_prop_val --> get_by_val
1469 put_prop_val --> put_by_val
1470 delete_prop_val --> del_by_val
1471 put_prop_index --> put_by_index
1474 (KJS::printUnaryOp):
1475 (KJS::printBinaryOp):
1476 (KJS::printConditionalJump):
1477 (KJS::CodeBlock::dump):
1478 * VM/CodeGenerator.cpp:
1479 (KJS::CodeGenerator::emitEqual):
1480 (KJS::CodeGenerator::emitNotEqual):
1481 (KJS::CodeGenerator::emitResolveWithBase):
1482 (KJS::CodeGenerator::emitResolveFunction):
1483 (KJS::CodeGenerator::emitGetById):
1484 (KJS::CodeGenerator::emitPutById):
1485 (KJS::CodeGenerator::emitDeleteById):
1486 (KJS::CodeGenerator::emitGetByVal):
1487 (KJS::CodeGenerator::emitPutByVal):
1488 (KJS::CodeGenerator::emitDeleteByVal):
1489 (KJS::CodeGenerator::emitPutByIndex):
1490 * VM/CodeGenerator.h:
1492 (KJS::Machine::privateExecute):
1495 (KJS::ArrayNode::emitCode):
1496 (KJS::PropertyListNode::emitCode):
1497 (KJS::BracketAccessorNode::emitCode):
1498 (KJS::DotAccessorNode::emitCode):
1499 (KJS::EvalFunctionCallNode::emitCode):
1500 (KJS::FunctionCallResolveNode::emitCode):
1501 (KJS::FunctionCallBracketNode::emitCode):
1502 (KJS::FunctionCallDotNode::emitCode):
1503 (KJS::PostIncResolveNode::emitCode):
1504 (KJS::PostDecResolveNode::emitCode):
1505 (KJS::PostIncBracketNode::emitCode):
1506 (KJS::PostDecBracketNode::emitCode):
1507 (KJS::PostIncDotNode::emitCode):
1508 (KJS::PostDecDotNode::emitCode):
1509 (KJS::DeleteResolveNode::emitCode):
1510 (KJS::DeleteBracketNode::emitCode):
1511 (KJS::DeleteDotNode::emitCode):
1512 (KJS::TypeOfResolveNode::emitCode):
1513 (KJS::PreIncResolveNode::emitCode):
1514 (KJS::PreDecResolveNode::emitCode):
1515 (KJS::PreIncBracketNode::emitCode):
1516 (KJS::PreDecBracketNode::emitCode):
1517 (KJS::PreIncDotNode::emitCode):
1518 (KJS::PreDecDotNode::emitCode):
1519 (KJS::ReadModifyResolveNode::emitCode):
1520 (KJS::AssignResolveNode::emitCode):
1521 (KJS::AssignDotNode::emitCode):
1522 (KJS::ReadModifyDotNode::emitCode):
1523 (KJS::AssignBracketNode::emitCode):
1524 (KJS::ReadModifyBracketNode::emitCode):
1525 (KJS::ConstDeclNode::emitCodeSingle):
1526 (KJS::ForInNode::emitCode):
1527 (KJS::TryNode::emitCode):
1529 2008-05-04 Oliver Hunt <oliver@apple.com>
1533 Fix assertion when accessing arguments object with too many arguments provided
1535 The arguments constructor was assuming that the register offset given for argv
1536 was an absolute offset into the registerfile, rather than the offset from the
1537 frame. This patches corrects that issue.
1539 * kjs/JSActivation.cpp:
1540 (KJS::JSActivation::createArgumentsObject):
1542 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1544 Rubber stamped by Sam Weinig.
1546 Cleaned up Machine.cpp according to our style guidelines: moved static
1547 data to the top of the file; moved stand-alone functions below that;
1548 moved the Machine constructor above other Machine member functions.
1550 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1554 - fix accidental breakage from last patch
1557 (KJS::Machine::privateExecute):
1559 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1563 - a bunch more opcode documentation and corresponding parameter name fixes
1565 I renamed a few opcodes:
1567 type_of --> typeof (that's what the JS operator is named)
1568 instance_of --> instanceof (ditto)
1569 create_error --> new_error (for consistency with other new_* opcodes)
1571 I documented the following opcodes:
1593 I also fixed formatting on some existing opcode docs.
1596 (KJS::CodeBlock::dump):
1597 * VM/CodeGenerator.cpp:
1598 (KJS::CodeGenerator::emitMove):
1599 (KJS::CodeGenerator::emitNot):
1600 (KJS::CodeGenerator::emitPreInc):
1601 (KJS::CodeGenerator::emitPreDec):
1602 (KJS::CodeGenerator::emitPostInc):
1603 (KJS::CodeGenerator::emitPostDec):
1604 (KJS::CodeGenerator::emitToJSNumber):
1605 (KJS::CodeGenerator::emitNegate):
1606 (KJS::CodeGenerator::emitBitNot):
1607 (KJS::CodeGenerator::emitInstanceOf):
1608 (KJS::CodeGenerator::emitTypeOf):
1609 (KJS::CodeGenerator::emitIn):
1610 (KJS::CodeGenerator::emitLoad):
1611 (KJS::CodeGenerator::emitNewObject):
1612 (KJS::CodeGenerator::emitNewArray):
1613 (KJS::CodeGenerator::emitNewRegExp):
1614 (KJS::CodeGenerator::emitNewError):
1615 * VM/CodeGenerator.h:
1616 (KJS::CodeGenerator::scopeDepth):
1617 (KJS::CodeGenerator::addVar):
1619 (KJS::Machine::privateExecute):
1622 (KJS::Node::emitThrowError):
1623 (KJS::RegExpNode::emitCode):
1624 (KJS::TypeOfValueNode::emitCode):
1625 (KJS::UnaryPlusNode::emitCode):
1626 (KJS::NegateNode::emitCode):
1627 (KJS::BitwiseNotNode::emitCode):
1628 (KJS::LogicalNotNode::emitCode):
1629 (KJS::InstanceOfNode::emitCode):
1630 (KJS::InNode::emitCode):
1632 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1634 Reviewed by Geoff and Sam.
1636 - generate HTML bytecode docs at build time
1638 * DerivedSources.make:
1640 * docs/make-bytecode-docs.pl: Added.
1642 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1644 Reviewed by Sam Weinig.
1646 Update ExecState::m_scopeChain when switching scope chains inside the
1649 This fixes uses of lexicalGlobalObject, such as, in a subframe
1651 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1653 and a bunch of the security failures listed in
1654 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1655 seemingly because of regressions in exception messages).
1657 SunSpider reports no change.
1659 * VM/Machine.cpp: Factored out scope chain updating into a common
1660 function that takes care to update ExecState::m_scopeChain, too.
1662 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1663 could update ExecState::m_scopeChain, even though that value is
1664 read-only for everyone else.
1666 * kjs/JSGlobalObject.h:
1667 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1668 this client to be a little friendlier to ExecState's internal
1669 storage type for scope chain data.
1671 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1673 Reviewed by Sam Weinig.
1675 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1676 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1678 SunSpider reports no change.
1681 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1682 since the direct threaded interpreter will goto across its destructor.
1684 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1686 Reviewed by Oliver Hunt.
1688 A bit more efficient fix than r32832: Don't copy globals into function
1689 register files; instead, have the RegisterFileStack track only the base
1690 of the last *global* register file, so the global object's register
1691 references stay good.
1693 SunSpider reports a .3% speedup. Not sure what that's about.
1695 2008-05-03 Oliver Hunt <oliver@apple.com>
1699 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1700 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1702 Add new opcodes to allow us to add getters and setters to an object. These are
1703 only used by the codegen for object literals.
1705 * VM/CodeGenerator.cpp:
1706 (KJS::CodeGenerator::emitPutGetter):
1707 (KJS::CodeGenerator::emitPutSetter):
1708 * VM/CodeGenerator.h:
1710 (KJS::Machine::privateExecute):
1713 (KJS::PropertyListNode::emitCode):
1715 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1719 - properly copy globals into and out of implicit call register
1720 files, otherwise they will fail at global lookup
1722 Fixes fast/js/array-tostring-and-join.html layout test.
1724 * VM/RegisterFileStack.cpp:
1725 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1726 (KJS::RegisterFileStack::popGlobalRegisterFile):
1727 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1728 (KJS::RegisterFileStack::popFunctionRegisterFile):
1730 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1732 Reviewed by Oliver Hunt.
1734 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1735 SQUIRRELFISH: incorrect eval used in some cases
1737 Changed all code inside the machine to fetch the lexical global object
1738 directly from the scope chain, instead of from the ExecState.
1740 Clients who fetch the lexical global object through the ExecState
1743 SunSpider reports no change.
1746 (KJS::Machine::privateExecute): Fetch the lexical global object from
1750 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1751 this function into ScopeChainNode, but kept this function around to
1752 support existing clients.
1754 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1756 Rubber stamped by Oliver Hunt.
1758 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1760 * JavaScriptCore.xcodeproj/project.pbxproj:
1761 * kjs/AllInOneFile.cpp:
1763 2008-05-01 Oliver Hunt <oliver@apple.com>
1765 Reviewed by Geoff and Maciej.
1767 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1768 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1770 Remove safe/unsafe RegisterFile concept, and instead just add additional
1771 logic to ensure we always push/pop RegisterFiles when executing getters
1772 and setters, similar to the logic for valueOf and toString.
1775 (KJS::Machine::privateExecute):
1776 * VM/RegisterFile.h:
1778 (KJS::FunctionImp::callAsFunction):
1780 (KJS::JSObject::put):
1781 * kjs/property_slot.cpp:
1782 (KJS::PropertySlot::functionGetter):
1784 2008-05-01 Oliver Hunt <oliver@apple.com>
1788 Rename unsafeForReentry to safeForReentry to avoid double negatives.
1791 (KJS::Machine::privateExecute):
1792 * VM/RegisterFile.h:
1794 (KJS::FunctionImp::callAsFunction):
1796 2008-05-01 Oliver Hunt <oliver@apple.com>
1800 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1801 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1803 This patch makes getters and setters work. It does this by
1804 tracking whether the RegisterFile is "safe", that is whether
1805 the interpreter is in a state that in which it can handle
1806 the RegisterFile being reallocated.
1810 (KJS::Machine::privateExecute):
1811 * VM/RegisterFile.h:
1813 (KJS::FunctionImp::callAsFunction):
1815 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1817 Release build fix: Always compile in "isGlobalObject", since it's
1818 listed in our .exp file.
1820 * kjs/ExecState.cpp:
1821 (KJS::ExecState::isGlobalObject):
1824 2008-04-30 Oliver Hunt <oliver@apple.com>
1828 Minor code restructuring to prepare for getters and setters,
1829 also helps exception semantics a bit.
1832 (KJS::Machine::privateExecute):
1834 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1840 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1842 Debug build fix: export a missing symbol.
1844 * JavaScriptCore.exp:
1846 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1848 Reviewed by Oliver Hunt.
1850 A little more ExecState refactoring: Now, only the global object creates
1853 Also inlined ExecState::lexicalGlobalObject().
1855 SunSpider reports no change.
1857 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1859 WebCore build fix: forward-declare ScopeChain.
1861 * kjs/interpreter.h:
1863 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1865 Build fix for JavaScriptGlue: export a missing symbol.
1867 * JavaScriptCore.exp:
1869 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1871 Reviewed by Oliver Hunt.
1873 Removed a lot of unused bits from ExecState, moving them into
1874 OldInterpreterExecState, the fake scaffolding class.
1876 The clutter was making it hard to see the forest from the trees.
1878 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
1881 2008-04-29 Oliver Hunt <oliver@apple.com>
1885 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1886 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1888 Prevent static slot optimisation for new variables and functions in
1889 globally re-entrant code called from an an implicit function call.
1891 This is necessary to prevent us from needing to resize the global
1892 slot portion of the root RegisterFile during an implicit (and hence
1893 unguarded) function call.
1895 * VM/CodeGenerator.cpp:
1896 (KJS::CodeGenerator::CodeGenerator):
1897 * VM/CodeGenerator.h:
1899 (KJS::Machine::execute):
1900 * VM/RegisterFile.h:
1901 * VM/RegisterFileStack.cpp:
1902 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1903 (KJS::RegisterFileStack::popGlobalRegisterFile):
1904 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1905 (KJS::RegisterFileStack::popFunctionRegisterFile):
1906 * VM/RegisterFileStack.h:
1907 (KJS::RegisterFileStack::inImplicitFunctionCall):
1908 (KJS::RegisterFileStack::lastGlobal):
1910 (KJS::ProgramNode::generateCode):
1912 (KJS::ProgramNode::):
1914 2008-04-29 Geoffrey Garen <ggaren@apple.com>
1916 Reviewed by Oliver Hunt.
1918 In nested program code, don't propogate "this" back to the parent
1919 register file. ("this" should remain constant in the parent register
1920 file, regardless of the scripts it invokes.)
1922 * VM/RegisterFile.cpp:
1923 (KJS::RegisterFile::copyGlobals):
1925 2008-04-28 Oliver Hunt <oliver@apple.com>
1929 Restore base pointer when popping a global RegisterFile
1931 * VM/RegisterFileStack.cpp:
1932 (KJS::RegisterFileStack::popGlobalRegisterFile):
1934 2008-04-28 Oliver Hunt <oliver@apple.com>
1938 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1939 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1941 Partial fix. This results in all implicit calls to toString or valueOf
1942 executing in a separate RegisterFile, so ensuring that the the pointers
1943 in the triggering interpreter don't get trashed. This still leaves the
1944 task of preventing new global re-entry from toString and valueOf from
1945 clobbering the RegisterFile.
1948 (KJS::Machine::execute):
1949 * VM/RegisterFileStack.cpp:
1950 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1951 (KJS::RegisterFileStack::popFunctionRegisterFile):
1952 * VM/RegisterFileStack.h:
1954 (KJS::tryGetAndCallProperty):
1956 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1958 Reviewed by Maciej Stachowiak.
1960 Simplified activation object a bit: No need to store the callee
1961 in the activation object -- we can pull it out of the call frame
1962 when needed, instead.
1964 SunSpider reports no change.
1966 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1968 Reviewed by Maciej Stachowiak.
1970 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
1972 Substantially more handling of "arguments": "arguments" works fully
1973 now, but "f.arguments" still doesn't work.
1975 Fixes 10 regression tests.
1977 SunSpider reports no regression.
1979 * kjs/JSActivation.cpp:
1980 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
1981 List to pass to the arguments object constructor.
1983 * JavaScriptCore.xcodeproj/project.pbxproj:
1984 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
1985 because that seems to make GCC happy. (Previously, I had added
1986 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
1989 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1991 Reviewed by Maciej Stachowiak.
1993 Groundwork for more handling of "arguments". I'm not checking in the
1994 actual handling of "arguments" yet, because it still needs a little
1995 fiddling to avoid a performance regression.
1997 SunSpider reports no change.
2000 (KJS::initializeCallFrame): Put argc in the register file, so the
2001 arguments object can find it later, to determine arguments.length.
2004 (KJS::FunctionBodyNode::): Added a special code accessor for when you
2005 know the code has already been generated, and you don't have a scopeChain
2006 to supply for potential code generation. (This is the case when the
2007 activation object creates the arguments object.)
2009 2008-04-28 Oliver Hunt <oliver@apple.com>
2013 Replace unsafe use of auto_ptr in Vector with manual memory
2016 * VM/RegisterFileStack.cpp:
2017 (KJS::RegisterFileStack::~RegisterFileStack):
2018 (KJS::RegisterFileStack::popRegisterFile):
2019 * VM/RegisterFileStack.h:
2021 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2025 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
2026 <https://bugs.webkit.org/show_bug.cgi?id=18746>
2028 Change the base to the correct value of the 'this' object after the direct
2029 eval test instead of before.
2031 Fixes 5 layout tests.
2034 (KJS::Machine::privateExecute):
2036 (KJS::EvalFunctionCallNode::emitCode):
2038 2008-04-26 Maciej Stachowiak <mjs@apple.com>
2042 - document all property getting, setting and deleting opcodes
2044 (And fix function parameter names to match corresponding opcode parameter names.)
2046 * VM/CodeGenerator.cpp:
2047 (KJS::CodeGenerator::emitResolve):
2048 (KJS::CodeGenerator::emitResolveBase):
2049 (KJS::CodeGenerator::emitResolveBaseAndProperty):
2050 (KJS::CodeGenerator::emitResolveBaseAndFunc):
2051 (KJS::CodeGenerator::emitGetPropId):
2052 (KJS::CodeGenerator::emitPutPropId):
2053 (KJS::CodeGenerator::emitDeletePropId):
2054 (KJS::CodeGenerator::emitPutPropVal):
2055 * VM/CodeGenerator.h:
2059 (KJS::resolveBaseAndProperty):
2060 (KJS::resolveBaseAndFunc):
2061 (KJS::Machine::privateExecute):
2063 (KJS::ResolveNode::emitCode):
2064 (KJS::ArrayNode::emitCode):
2065 (KJS::PropertyListNode::emitCode):
2066 (KJS::BracketAccessorNode::emitCode):
2067 (KJS::EvalFunctionCallNode::emitCode):
2068 (KJS::FunctionCallResolveNode::emitCode):
2069 (KJS::FunctionCallBracketNode::emitCode):
2070 (KJS::PostIncResolveNode::emitCode):
2071 (KJS::PostDecResolveNode::emitCode):
2072 (KJS::PostIncBracketNode::emitCode):
2073 (KJS::PostDecBracketNode::emitCode):
2074 (KJS::PostIncDotNode::emitCode):
2075 (KJS::PostDecDotNode::emitCode):
2076 (KJS::DeleteResolveNode::emitCode):
2077 (KJS::TypeOfResolveNode::emitCode):
2078 (KJS::PreIncResolveNode::emitCode):
2079 (KJS::PreDecResolveNode::emitCode):
2080 (KJS::PreIncBracketNode::emitCode):
2081 (KJS::PreDecBracketNode::emitCode):
2082 (KJS::AssignResolveNode::emitCode):
2083 (KJS::AssignDotNode::emitCode):
2084 (KJS::ReadModifyDotNode::emitCode):
2085 (KJS::AssignBracketNode::emitCode):
2086 (KJS::ReadModifyBracketNode::emitCode):
2087 (KJS::ConstDeclNode::emitCodeSingle):
2089 2008-04-26 Oliver Hunt <oliver@apple.com>
2093 Bug 18628: SQUIRRELFISH: need to support recursion limit
2094 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2096 Basically completes recursion limiting. There is still some
2097 tuning we may want to do to make things better in the face of
2098 very bad code, but certainly nothing worse than anything already
2101 Also fixes a WebKit test by fixing the exception text :D
2103 * JavaScriptCore.exp:
2104 * VM/ExceptionHelpers.cpp:
2106 (KJS::Machine::execute):
2107 * VM/RegisterFile.cpp:
2108 (KJS::RegisterFile::growBuffer):
2109 (KJS::RegisterFile::addGlobalSlots):
2110 * VM/RegisterFile.h:
2111 (KJS::RegisterFile::grow):
2112 (KJS::RegisterFile::uncheckedGrow):
2113 * VM/RegisterFileStack.cpp:
2114 (KJS::RegisterFileStack::pushRegisterFile):
2115 * VM/RegisterFileStack.h:
2117 2008-04-25 Oliver Hunt <oliver@apple.com>
2121 Bug 18628: SQUIRRELFISH: need to support recursion limit
2122 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2124 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
2125 seems reasonable as it is greater than the old eval limit, and a long way short of
2126 the reentry depth needed to overflow the stack.
2129 (KJS::Machine::execute):
2132 2008-04-25 Geoffrey Garen <ggaren@apple.com>
2134 Reviewed by Sam Weinig.
2136 A tiny bit of cleanup to the regexp code.
2138 Removed some static_cast.
2140 Removed createRegExpImp because it's no longer used.
2142 2008-04-25 Oliver Hunt <oliver@apple.com>
2146 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
2147 <https://bugs.webkit.org/show_bug.cgi?id=18736>
2149 Ensure the "default" target is correct in the absence of an explicit default handler.
2152 (KJS::CaseBlockNode::emitCodeForBlock):
2154 2008-04-25 Oliver Hunt <oliver@apple.com>
2158 Bug 18628: SQUIRRELFISH: need to support recursion limit
2159 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2161 More bounds checking.
2164 (KJS::Machine::execute):
2165 * VM/RegisterFile.cpp:
2166 (KJS::RegisterFile::growBuffer):
2167 * VM/RegisterFile.h:
2169 2008-04-25 Maciej Stachowiak <mjs@apple.com>
2173 - fix signal catching magic
2175 The signal handlers are restored to _exit but are only set when
2176 running under run-javascriptcore-tests. fprintf from a signal
2177 handler is not safe.
2182 * tests/mozilla/jsDriver.pl:
2184 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2188 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
2189 <https://bugs.webkit.org/show_bug.cgi?id=18732>
2191 Fixes another regression test.
2194 (KJS::Machine::privateExecute):
2196 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2200 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
2201 <https://bugs.webkit.org/show_bug.cgi?id=18728>
2203 Fixes another regression test.
2206 (KJS::RegExpNode::emitCode):
2208 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2210 Reviewed by Geoffrey Garen.
2212 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
2213 <https://bugs.webkit.org/show_bug.cgi?id=18735>
2215 The overloaded toThisObject method was not copied over to JSActivation.
2217 Fixes two regression tests.
2219 * kjs/JSActivation.cpp:
2220 (KJS::JSActivation::toThisObject):
2221 * kjs/JSActivation.h:
2223 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2225 Reviewed by Oliver Hunt.
2227 Added support for arguments.callee.
2229 2008-04-24 Oliver Hunt <oliver@apple.com>
2233 Bug 18628: SQUIRRELFISH: need to support recursion limit
2234 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2236 Partial fix -- this gets us some of the required bounds checking, but not
2237 complete coverage. But it does manage to do them without regressing :D
2239 * VM/ExceptionHelpers.cpp:
2241 (KJS::createStackOverflowError):
2242 * VM/ExceptionHelpers.h:
2244 (KJS::slideRegisterWindowForCall):
2245 (KJS::Machine::execute):
2246 (KJS::Machine::privateExecute):
2247 * VM/RegisterFile.cpp:
2248 * VM/RegisterFile.h:
2249 (KJS::RegisterFile::):
2250 (KJS::RegisterFile::RegisterFile):
2251 (KJS::RegisterFile::grow):
2253 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2255 Reviewed by Oliver Hunt.
2257 A tiny bit more handling of "arguments": create a real, but mostly
2258 hollow, arguments object.
2260 Fixes 2 regression tests.
2262 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2266 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2267 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2269 Fixes a regression test, but exposes the failure of another due to the
2270 lack of getters and setters.
2273 (KJS::ConstDeclNode::emitCodeSingle):
2274 (KJS::ConstDeclNode::emitCode):
2275 (KJS::ConstStatementNode::emitCode):
2276 (KJS::VarStatementNode::emitCode):
2279 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2281 Reviewed by Sam Weinig.
2283 Print a CRASH statement when crashing, so test failures are not a
2290 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2292 Reviewed by Geoffrey Garen.
2294 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2295 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2297 This fixes 2 more regression tests.
2300 (KJS::TypeOfResolveNode::emitCode):
2302 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2304 Reviewed by Sam Weinig.
2306 Put the callee in the call frame.
2308 Necessary in order to support "arguments" and "arguments.callee".
2310 Also fixes a latent GC bug, where an executing function could be
2311 subject to GC if the register holding it were overwritten. Here's
2312 an example that would have caused problems:
2316 // Flood the machine stack to eliminate any old pointers to f.
2319 // Overwrite f in the register file.
2323 for (var i = 0; i < 5000; ++i) {
2327 // Welcome to crash-ville.
2336 * VM/Machine.h: Changed the order of arguments to
2337 execute(FunctionBodyNode*...) to match the other execute functions.
2338 * kjs/function.cpp: Updated to match new argument requirements from
2339 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2340 rest of JavaScriptCore.
2342 SunSpider reports no change.
2344 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2348 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2349 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2351 This fixes 4 more regression tests.
2356 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2360 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2364 * VM/SegmentedVector.h:
2365 (KJS::SegmentedVector::grow):
2367 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2369 Reviewed by Maciej Stachowiak.
2371 Degenerate handling of "arguments" as a property of the activation
2372 object. Currently, we just return a vanilla object.
2374 SunSpider reports no change.
2378 ecma_3/Function/regress-94506.js.
2380 Reveals to have been secretly broken:
2382 ecma_3/Function/15.3.4.3-1.js
2383 ecma_3/Function/15.3.4.4-1.js
2385 These tests were passing incorrectly. testkjs creates a global array
2386 named "arguments" to hold command-line arguments. That array was
2387 tricking these tests into thinking that an arguments object with length
2388 0 had been created. Since our new vanilla object shadows the global
2389 property named arguments, that object no longer fools these tests into
2392 Net change: +1 failing test.
2394 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2395 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2397 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2401 - save and restore callFrame
2404 (KJS::slideRegisterWindowForCall):
2405 (KJS::Machine::execute):
2406 (KJS::Machine::privateExecute):
2410 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2412 Reviewed by Maciej Stachowiak.
2414 Fixed scopes for named function expressions.
2416 Fixes one regression test.
2420 (1) The function's name is supposed to have attributes DontDelete,
2421 ReadOnly, regardless of the type of code executing.
2423 (2) Push the name object on the function's scope chain, rather than
2424 the ExecState's scope chain because, well, that's where it belongs.
2426 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2428 Reviewed by Oliver Hunt.
2430 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2432 I did this as a first step toward removing nodes.cpp from
2433 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2435 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2437 Rubber stamped by Geoff.
2439 - add OldInterpreterExecState class and use it in dead code
2441 This will allow removing things from the real ExecState class
2442 without having to figure out how to remove all this code without
2443 getting a perf regression.
2446 (KJS::ExpressionNode::evaluateToNumber):
2447 (KJS::ExpressionNode::evaluateToBoolean):
2448 (KJS::ExpressionNode::evaluateToInt32):
2449 (KJS::ExpressionNode::evaluateToUInt32):
2450 (KJS::Node::setErrorCompletion):
2451 (KJS::Node::throwError):
2452 (KJS::Node::throwUndefinedVariableError):
2453 (KJS::Node::handleException):
2454 (KJS::Node::rethrowException):
2455 (KJS::BreakpointCheckStatement::execute):
2456 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2457 (KJS::NullNode::evaluate):
2458 (KJS::FalseNode::evaluate):
2459 (KJS::TrueNode::evaluate):
2460 (KJS::NumberNode::evaluate):
2461 (KJS::NumberNode::evaluateToNumber):
2462 (KJS::NumberNode::evaluateToBoolean):
2463 (KJS::NumberNode::evaluateToInt32):
2464 (KJS::NumberNode::evaluateToUInt32):
2465 (KJS::ImmediateNumberNode::evaluate):
2466 (KJS::ImmediateNumberNode::evaluateToInt32):
2467 (KJS::ImmediateNumberNode::evaluateToUInt32):
2468 (KJS::StringNode::evaluate):
2469 (KJS::StringNode::evaluateToNumber):
2470 (KJS::StringNode::evaluateToBoolean):
2471 (KJS::RegExpNode::evaluate):
2472 (KJS::ThisNode::evaluate):
2473 (KJS::ResolveNode::inlineEvaluate):
2474 (KJS::ResolveNode::evaluate):
2475 (KJS::ResolveNode::evaluateToNumber):
2476 (KJS::ResolveNode::evaluateToBoolean):
2477 (KJS::ResolveNode::evaluateToInt32):
2478 (KJS::ResolveNode::evaluateToUInt32):
2479 (KJS::getSymbolTableEntry):
2480 (KJS::ResolveNode::optimizeVariableAccess):
2481 (KJS::LocalVarAccessNode::inlineEvaluate):
2482 (KJS::LocalVarAccessNode::evaluate):
2483 (KJS::LocalVarAccessNode::evaluateToNumber):
2484 (KJS::LocalVarAccessNode::evaluateToBoolean):
2485 (KJS::LocalVarAccessNode::evaluateToInt32):
2486 (KJS::LocalVarAccessNode::evaluateToUInt32):
2487 (KJS::getNonLocalSymbol):
2488 (KJS::ScopedVarAccessNode::inlineEvaluate):
2489 (KJS::ScopedVarAccessNode::evaluate):
2490 (KJS::ScopedVarAccessNode::evaluateToNumber):
2491 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2492 (KJS::ScopedVarAccessNode::evaluateToInt32):
2493 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2494 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2495 (KJS::NonLocalVarAccessNode::evaluate):
2496 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2497 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2498 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2499 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2500 (KJS::ElementNode::optimizeVariableAccess):
2501 (KJS::ElementNode::evaluate):
2502 (KJS::ArrayNode::optimizeVariableAccess):
2503 (KJS::ArrayNode::evaluate):
2504 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2505 (KJS::ObjectLiteralNode::evaluate):
2506 (KJS::PropertyListNode::optimizeVariableAccess):
2507 (KJS::PropertyListNode::evaluate):
2508 (KJS::PropertyNode::optimizeVariableAccess):
2509 (KJS::PropertyNode::evaluate):
2510 (KJS::BracketAccessorNode::optimizeVariableAccess):
2511 (KJS::BracketAccessorNode::inlineEvaluate):
2512 (KJS::BracketAccessorNode::evaluate):
2513 (KJS::BracketAccessorNode::evaluateToNumber):
2514 (KJS::BracketAccessorNode::evaluateToBoolean):
2515 (KJS::BracketAccessorNode::evaluateToInt32):
2516 (KJS::BracketAccessorNode::evaluateToUInt32):
2517 (KJS::DotAccessorNode::optimizeVariableAccess):
2518 (KJS::DotAccessorNode::inlineEvaluate):
2519 (KJS::DotAccessorNode::evaluate):
2520 (KJS::DotAccessorNode::evaluateToNumber):
2521 (KJS::DotAccessorNode::evaluateToBoolean):
2522 (KJS::DotAccessorNode::evaluateToInt32):
2523 (KJS::DotAccessorNode::evaluateToUInt32):
2524 (KJS::ArgumentListNode::optimizeVariableAccess):
2525 (KJS::ArgumentListNode::evaluateList):
2526 (KJS::ArgumentsNode::optimizeVariableAccess):
2527 (KJS::NewExprNode::optimizeVariableAccess):
2528 (KJS::NewExprNode::inlineEvaluate):
2529 (KJS::NewExprNode::evaluate):
2530 (KJS::NewExprNode::evaluateToNumber):
2531 (KJS::NewExprNode::evaluateToBoolean):
2532 (KJS::NewExprNode::evaluateToInt32):
2533 (KJS::NewExprNode::evaluateToUInt32):
2534 (KJS::ExpressionNode::resolveAndCall):
2535 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2536 (KJS::EvalFunctionCallNode::evaluate):
2537 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2538 (KJS::FunctionCallValueNode::evaluate):
2539 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2540 (KJS::FunctionCallResolveNode::inlineEvaluate):
2541 (KJS::FunctionCallResolveNode::evaluate):
2542 (KJS::FunctionCallResolveNode::evaluateToNumber):
2543 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2544 (KJS::FunctionCallResolveNode::evaluateToInt32):
2545 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2546 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2547 (KJS::LocalVarFunctionCallNode::evaluate):
2548 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2549 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2550 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2551 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2552 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2553 (KJS::ScopedVarFunctionCallNode::evaluate):
2554 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2555 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2556 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2557 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2558 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2559 (KJS::NonLocalVarFunctionCallNode::evaluate):
2560 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2561 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2562 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2563 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2564 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2565 (KJS::FunctionCallBracketNode::evaluate):
2566 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2567 (KJS::FunctionCallDotNode::inlineEvaluate):
2568 (KJS::FunctionCallDotNode::evaluate):
2569 (KJS::FunctionCallDotNode::evaluateToNumber):
2570 (KJS::FunctionCallDotNode::evaluateToBoolean):
2571 (KJS::FunctionCallDotNode::evaluateToInt32):
2572 (KJS::FunctionCallDotNode::evaluateToUInt32):
2573 (KJS::PostIncResolveNode::optimizeVariableAccess):
2574 (KJS::PostIncResolveNode::evaluate):
2575 (KJS::PostIncLocalVarNode::evaluate):
2576 (KJS::PostDecResolveNode::optimizeVariableAccess):
2577 (KJS::PostDecResolveNode::evaluate):
2578 (KJS::PostDecLocalVarNode::evaluate):
2579 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2580 (KJS::PostDecLocalVarNode::evaluateToNumber):
2581 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2582 (KJS::PostDecLocalVarNode::evaluateToInt32):
2583 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2584 (KJS::PostfixBracketNode::optimizeVariableAccess):
2585 (KJS::PostIncBracketNode::evaluate):
2586 (KJS::PostDecBracketNode::evaluate):
2587 (KJS::PostfixDotNode::optimizeVariableAccess):
2588 (KJS::PostIncDotNode::evaluate):
2589 (KJS::PostDecDotNode::evaluate):
2590 (KJS::PostfixErrorNode::evaluate):
2591 (KJS::DeleteResolveNode::optimizeVariableAccess):
2592 (KJS::DeleteResolveNode::evaluate):
2593 (KJS::LocalVarDeleteNode::evaluate):
2594 (KJS::DeleteBracketNode::optimizeVariableAccess):
2595 (KJS::DeleteBracketNode::evaluate):
2596 (KJS::DeleteDotNode::optimizeVariableAccess):
2597 (KJS::DeleteDotNode::evaluate):
2598 (KJS::DeleteValueNode::optimizeVariableAccess):
2599 (KJS::DeleteValueNode::evaluate):
2600 (KJS::VoidNode::optimizeVariableAccess):
2601 (KJS::VoidNode::evaluate):
2602 (KJS::TypeOfValueNode::optimizeVariableAccess):
2603 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2604 (KJS::LocalVarTypeOfNode::evaluate):
2605 (KJS::TypeOfResolveNode::evaluate):
2606 (KJS::TypeOfValueNode::evaluate):
2607 (KJS::PreIncResolveNode::optimizeVariableAccess):
2608 (KJS::PreIncLocalVarNode::evaluate):
2609 (KJS::PreIncResolveNode::evaluate):
2610 (KJS::PreDecResolveNode::optimizeVariableAccess):
2611 (KJS::PreDecLocalVarNode::evaluate):
2612 (KJS::PreDecResolveNode::evaluate):
2613 (KJS::PreIncConstNode::evaluate):
2614 (KJS::PreDecConstNode::evaluate):
2615 (KJS::PostIncConstNode::evaluate):
2616 (KJS::PostDecConstNode::evaluate):
2617 (KJS::PrefixBracketNode::optimizeVariableAccess):
2618 (KJS::PreIncBracketNode::evaluate):
2619 (KJS::PreDecBracketNode::evaluate):
2620 (KJS::PrefixDotNode::optimizeVariableAccess):
2621 (KJS::PreIncDotNode::evaluate):
2622 (KJS::PreDecDotNode::evaluate):
2623 (KJS::PrefixErrorNode::evaluate):
2624 (KJS::UnaryPlusNode::optimizeVariableAccess):
2625 (KJS::UnaryPlusNode::evaluate):
2626 (KJS::UnaryPlusNode::evaluateToBoolean):
2627 (KJS::UnaryPlusNode::evaluateToNumber):
2628 (KJS::UnaryPlusNode::evaluateToInt32):
2629 (KJS::UnaryPlusNode::evaluateToUInt32):
2630 (KJS::NegateNode::optimizeVariableAccess):
2631 (KJS::NegateNode::evaluate):
2632 (KJS::NegateNode::evaluateToNumber):
2633 (KJS::BitwiseNotNode::optimizeVariableAccess):
2634 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2635 (KJS::BitwiseNotNode::evaluate):
2636 (KJS::BitwiseNotNode::evaluateToNumber):
2637 (KJS::BitwiseNotNode::evaluateToBoolean):
2638 (KJS::BitwiseNotNode::evaluateToInt32):
2639 (KJS::BitwiseNotNode::evaluateToUInt32):
2640 (KJS::LogicalNotNode::optimizeVariableAccess):
2641 (KJS::LogicalNotNode::evaluate):
2642 (KJS::LogicalNotNode::evaluateToBoolean):
2643 (KJS::MultNode::optimizeVariableAccess):
2644 (KJS::MultNode::inlineEvaluateToNumber):
2645 (KJS::MultNode::evaluate):
2646 (KJS::MultNode::evaluateToNumber):
2647 (KJS::MultNode::evaluateToBoolean):
2648 (KJS::MultNode::evaluateToInt32):
2649 (KJS::MultNode::evaluateToUInt32):
2650 (KJS::DivNode::optimizeVariableAccess):
2651 (KJS::DivNode::inlineEvaluateToNumber):
2652 (KJS::DivNode::evaluate):
2653 (KJS::DivNode::evaluateToNumber):
2654 (KJS::DivNode::evaluateToInt32):
2655 (KJS::DivNode::evaluateToUInt32):
2656 (KJS::ModNode::optimizeVariableAccess):
2657 (KJS::ModNode::inlineEvaluateToNumber):
2658 (KJS::ModNode::evaluate):
2659 (KJS::ModNode::evaluateToNumber):
2660 (KJS::ModNode::evaluateToBoolean):
2661 (KJS::ModNode::evaluateToInt32):
2662 (KJS::ModNode::evaluateToUInt32):
2663 (KJS::throwOutOfMemoryErrorToNumber):
2665 (KJS::addSlowCaseToNumber):
2668 (KJS::AddNode::optimizeVariableAccess):
2669 (KJS::AddNode::evaluate):
2670 (KJS::AddNode::inlineEvaluateToNumber):
2671 (KJS::AddNode::evaluateToNumber):
2672 (KJS::AddNode::evaluateToInt32):
2673 (KJS::AddNode::evaluateToUInt32):
2674 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2675 (KJS::AddNumbersNode::evaluate):
2676 (KJS::AddNumbersNode::evaluateToNumber):
2677 (KJS::AddNumbersNode::evaluateToInt32):
2678 (KJS::AddNumbersNode::evaluateToUInt32):
2679 (KJS::AddStringsNode::evaluate):
2680 (KJS::AddStringLeftNode::evaluate):
2681 (KJS::AddStringRightNode::evaluate):
2682 (KJS::SubNode::optimizeVariableAccess):
2683 (KJS::SubNode::inlineEvaluateToNumber):
2684 (KJS::SubNode::evaluate):
2685 (KJS::SubNode::evaluateToNumber):
2686 (KJS::SubNode::evaluateToInt32):
2687 (KJS::SubNode::evaluateToUInt32):
2688 (KJS::LeftShiftNode::optimizeVariableAccess):
2689 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2690 (KJS::LeftShiftNode::evaluate):
2691 (KJS::LeftShiftNode::evaluateToNumber):
2692 (KJS::LeftShiftNode::evaluateToInt32):
2693 (KJS::LeftShiftNode::evaluateToUInt32):
2694 (KJS::RightShiftNode::optimizeVariableAccess):
2695 (KJS::RightShiftNode::inlineEvaluateToInt32):
2696 (KJS::RightShiftNode::evaluate):
2697 (KJS::RightShiftNode::evaluateToNumber):
2698 (KJS::RightShiftNode::evaluateToInt32):
2699 (KJS::RightShiftNode::evaluateToUInt32):
2700 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2701 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2702 (KJS::UnsignedRightShiftNode::evaluate):
2703 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2704 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2705 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2708 (KJS::LessNode::optimizeVariableAccess):
2709 (KJS::LessNode::inlineEvaluateToBoolean):
2710 (KJS::LessNode::evaluate):
2711 (KJS::LessNode::evaluateToBoolean):
2712 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2713 (KJS::LessNumbersNode::evaluate):
2714 (KJS::LessNumbersNode::evaluateToBoolean):
2715 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2716 (KJS::LessStringsNode::evaluate):
2717 (KJS::LessStringsNode::evaluateToBoolean):
2718 (KJS::GreaterNode::optimizeVariableAccess):
2719 (KJS::GreaterNode::inlineEvaluateToBoolean):
2720 (KJS::GreaterNode::evaluate):
2721 (KJS::GreaterNode::evaluateToBoolean):
2722 (KJS::LessEqNode::optimizeVariableAccess):
2723 (KJS::LessEqNode::inlineEvaluateToBoolean):
2724 (KJS::LessEqNode::evaluate):
2725 (KJS::LessEqNode::evaluateToBoolean):
2726 (KJS::GreaterEqNode::optimizeVariableAccess):
2727 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2728 (KJS::GreaterEqNode::evaluate):
2729 (KJS::GreaterEqNode::evaluateToBoolean):
2730 (KJS::InstanceOfNode::optimizeVariableAccess):
2731 (KJS::InstanceOfNode::evaluate):
2732 (KJS::InstanceOfNode::evaluateToBoolean):
2733 (KJS::InNode::optimizeVariableAccess):
2734 (KJS::InNode::evaluate):
2735 (KJS::InNode::evaluateToBoolean):
2736 (KJS::EqualNode::optimizeVariableAccess):
2737 (KJS::EqualNode::inlineEvaluateToBoolean):
2738 (KJS::EqualNode::evaluate):
2739 (KJS::EqualNode::evaluateToBoolean):
2740 (KJS::NotEqualNode::optimizeVariableAccess):
2741 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2742 (KJS::NotEqualNode::evaluate):
2743 (KJS::NotEqualNode::evaluateToBoolean):
2744 (KJS::StrictEqualNode::optimizeVariableAccess):
2745 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2746 (KJS::StrictEqualNode::evaluate):
2747 (KJS::StrictEqualNode::evaluateToBoolean):
2748 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2749 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2750 (KJS::NotStrictEqualNode::evaluate):
2751 (KJS::NotStrictEqualNode::evaluateToBoolean):
2752 (KJS::BitAndNode::optimizeVariableAccess):
2753 (KJS::BitAndNode::evaluate):
2754 (KJS::BitAndNode::inlineEvaluateToInt32):
2755 (KJS::BitAndNode::evaluateToNumber):
2756 (KJS::BitAndNode::evaluateToBoolean):
2757 (KJS::BitAndNode::evaluateToInt32):
2758 (KJS::BitAndNode::evaluateToUInt32):
2759 (KJS::BitXOrNode::optimizeVariableAccess):
2760 (KJS::BitXOrNode::inlineEvaluateToInt32):
2761 (KJS::BitXOrNode::evaluate):
2762 (KJS::BitXOrNode::evaluateToNumber):
2763 (KJS::BitXOrNode::evaluateToBoolean):
2764 (KJS::BitXOrNode::evaluateToInt32):
2765 (KJS::BitXOrNode::evaluateToUInt32):
2766 (KJS::BitOrNode::optimizeVariableAccess):
2767 (KJS::BitOrNode::inlineEvaluateToInt32):
2768 (KJS::BitOrNode::evaluate):
2769 (KJS::BitOrNode::evaluateToNumber):
2770 (KJS::BitOrNode::evaluateToBoolean):
2771 (KJS::BitOrNode::evaluateToInt32):
2772 (KJS::BitOrNode::evaluateToUInt32):
2773 (KJS::LogicalAndNode::optimizeVariableAccess):
2774 (KJS::LogicalAndNode::evaluate):
2775 (KJS::LogicalAndNode::evaluateToBoolean):
2776 (KJS::LogicalOrNode::optimizeVariableAccess):
2777 (KJS::LogicalOrNode::evaluate):
2778 (KJS::LogicalOrNode::evaluateToBoolean):
2779 (KJS::ConditionalNode::optimizeVariableAccess):
2780 (KJS::ConditionalNode::evaluate):
2781 (KJS::ConditionalNode::evaluateToBoolean):
2782 (KJS::ConditionalNode::evaluateToNumber):
2783 (KJS::ConditionalNode::evaluateToInt32):
2784 (KJS::ConditionalNode::evaluateToUInt32):
2785 (KJS::valueForReadModifyAssignment):
2786 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2787 (KJS::AssignResolveNode::optimizeVariableAccess):
2788 (KJS::ReadModifyLocalVarNode::evaluate):
2789 (KJS::AssignLocalVarNode::evaluate):
2790 (KJS::ReadModifyConstNode::evaluate):
2791 (KJS::AssignConstNode::evaluate):
2792 (KJS::ReadModifyResolveNode::evaluate):
2793 (KJS::AssignResolveNode::evaluate):
2794 (KJS::AssignDotNode::optimizeVariableAccess):
2795 (KJS::AssignDotNode::evaluate):
2796 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2797 (KJS::ReadModifyDotNode::evaluate):
2798 (KJS::AssignErrorNode::evaluate):
2799 (KJS::AssignBracketNode::optimizeVariableAccess):
2800 (KJS::AssignBracketNode::evaluate):
2801 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2802 (KJS::ReadModifyBracketNode::evaluate):
2803 (KJS::CommaNode::optimizeVariableAccess):
2804 (KJS::CommaNode::evaluate):
2805 (KJS::ConstDeclNode::optimizeVariableAccess):
2806 (KJS::ConstDeclNode::handleSlowCase):
2807 (KJS::ConstDeclNode::evaluateSingle):
2808 (KJS::ConstDeclNode::evaluate):
2809 (KJS::ConstStatementNode::optimizeVariableAccess):
2810 (KJS::ConstStatementNode::execute):
2811 (KJS::statementListExecute):
2812 (KJS::BlockNode::optimizeVariableAccess):
2813 (KJS::BlockNode::execute):
2814 (KJS::EmptyStatementNode::execute):
2815 (KJS::ExprStatementNode::optimizeVariableAccess):
2816 (KJS::ExprStatementNode::execute):
2817 (KJS::VarStatementNode::optimizeVariableAccess):
2818 (KJS::VarStatementNode::execute):
2819 (KJS::IfNode::optimizeVariableAccess):
2820 (KJS::IfNode::execute):
2821 (KJS::IfElseNode::optimizeVariableAccess):
2822 (KJS::IfElseNode::execute):
2823 (KJS::DoWhileNode::optimizeVariableAccess):
2824 (KJS::DoWhileNode::execute):
2825 (KJS::WhileNode::optimizeVariableAccess):
2826 (KJS::WhileNode::execute):
2827 (KJS::ForNode::optimizeVariableAccess):
2828 (KJS::ForNode::execute):
2829 (KJS::ForInNode::optimizeVariableAccess):
2830 (KJS::ForInNode::execute):
2831 (KJS::ContinueNode::execute):
2832 (KJS::BreakNode::execute):
2833 (KJS::ReturnNode::optimizeVariableAccess):
2834 (KJS::ReturnNode::execute):
2835 (KJS::WithNode::optimizeVariableAccess):
2836 (KJS::WithNode::execute):
2837 (KJS::CaseClauseNode::optimizeVariableAccess):
2838 (KJS::CaseClauseNode::evaluate):
2839 (KJS::CaseClauseNode::executeStatements):
2840 (KJS::ClauseListNode::optimizeVariableAccess):
2841 (KJS::CaseBlockNode::optimizeVariableAccess):
2842 (KJS::CaseBlockNode::executeBlock):
2843 (KJS::SwitchNode::optimizeVariableAccess):
2844 (KJS::SwitchNode::execute):
2845 (KJS::LabelNode::optimizeVariableAccess):
2846 (KJS::LabelNode::execute):
2847 (KJS::ThrowNode::optimizeVariableAccess):
2848 (KJS::ThrowNode::execute):
2849 (KJS::TryNode::optimizeVariableAccess):
2850 (KJS::TryNode::execute):
2851 (KJS::ProgramNode::initializeSymbolTable):
2852 (KJS::ScopeNode::optimizeVariableAccess):
2853 (KJS::ProgramNode::processDeclarations):
2854 (KJS::EvalNode::processDeclarations):
2855 (KJS::ProgramNode::execute):
2856 (KJS::EvalNode::execute):
2857 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2858 (KJS::FuncDeclNode::execute):
2859 (KJS::FuncExprNode::evaluate):
2864 (KJS::ArgumentsNode::):
2866 2008-04-23 Oliver Hunt <oliver@apple.com>
2870 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
2871 <https://bugs.webkit.org/show_bug.cgi?id=18672>
2873 Add a SegmentedVector type, which provides a Vector<T> which maintains
2874 existing memory locations during resize. This allows dynamically sizing
2875 local, temporary and label "vectors" in CodeGenerator.
2877 * JavaScriptCore.xcodeproj/project.pbxproj:
2878 * VM/CodeGenerator.cpp:
2879 (KJS::CodeGenerator::addVar):
2880 (KJS::CodeGenerator::CodeGenerator):
2881 (KJS::CodeGenerator::newTemporary):
2882 (KJS::CodeGenerator::newLabel):
2883 * VM/CodeGenerator.h:
2884 * VM/SegmentedVector.h: Added.
2885 (KJS::SegmentedVector::SegmentedVector):
2886 (KJS::SegmentedVector::~SegmentedVector):
2887 (KJS::SegmentedVector::last):
2888 (KJS::SegmentedVector::append):
2889 (KJS::SegmentedVector::removeLast):
2890 (KJS::SegmentedVector::size):
2891 (KJS::SegmentedVector::operator[]):
2892 (KJS::SegmentedVector::resize):
2893 (KJS::SegmentedVector::shrink):
2894 (KJS::SegmentedVector::grow):
2896 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2898 Reviewed by Maciej Stachowiak.
2900 A little refactoring in preparation for supporting 'arguments'.
2902 Fixes 2 regression tests.
2904 SunSpider reports no change.
2906 We now check the activation register, instead of the codeBlock, to
2907 determine whether we need to tear off the activation. This is to support
2908 "f.arguments", which will create an activation/arguments pair for f,
2909 even though the needsFullScopeChain flag is false for f's codeBlock.
2911 The test fixes resulted from calling initializeCallFrame for re-entrant
2912 function code, instead of initializing (not enough) parts of the call
2915 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2919 - propagate the "this" value properly to local eval
2921 (fixes a measly one regression test)
2924 (KJS::CodeBlock::CodeBlock):
2925 (KJS::ProgramCodeBlock::ProgramCodeBlock):
2926 (KJS::EvalCodeBlock::EvalCodeBlock):
2928 (KJS::Machine::privateExecute):
2930 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2934 Add support for function declarations in eval code.
2936 (this fixes 12 more regression tests)
2939 * VM/CodeGenerator.cpp:
2940 (KJS::CodeGenerator::CodeGenerator):
2941 * VM/CodeGenerator.h:
2943 (KJS::Machine::execute):
2945 (KJS::EvalNode::generateCode):
2947 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2951 Implement LabelNode.
2953 * VM/CodeGenerator.cpp:
2954 (KJS::CodeGenerator::pushJumpContext):
2955 (KJS::CodeGenerator::jumpContextForContinue):
2956 (KJS::CodeGenerator::jumpContextForBreak):
2957 * VM/CodeGenerator.h:
2959 (KJS::DoWhileNode::emitCode):
2960 (KJS::WhileNode::emitCode):
2961 (KJS::ForNode::emitCode):
2962 (KJS::ForInNode::emitCode):
2963 (KJS::ContinueNode::emitCode):
2964 (KJS::BreakNode::emitCode):
2965 (KJS::SwitchNode::emitCode):
2966 (KJS::LabelNode::emitCode):
2968 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2970 Reviewed by Oliver Hunt.
2972 Fixed crash when unwinding from exceptions inside eval.
2975 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
2976 current call frame's scope chain is an activation: it can be the global
2979 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2984 (main): Convert signals to exit codes, so that crashing tests are
2985 detected as regression test failures.
2987 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2989 Reviewed by Oliver Hunt and Maciej Stachowiak.
2991 Renamed "needsActivation" to "needsFullScopeChain" because lying will
2992 make hair grow on the backs of your hands.
2994 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2996 Reviewed by Maciej Stachowiak.
2998 Fixed ScopeChainNode lifetime problems:
3000 (1) In "with" and "catch" scopes, we would construct a ScopeChain
3001 object and then jump across its destructor, leaking the ScopeChainNode
3004 (2) In global and eval scopes, we would fail to initially ref
3005 "scopeChain", causing us to overrelease it later. Now that we ref
3006 "scopeChain" properly, we also need to deref it when the script
3009 SunSpider reports a .2% regression, but an earlier round of ScopeChain
3010 refactoring was a .4% speedup, so there.
3012 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3016 - use global object instead of null for "this" on unqualified calls
3018 This fixes 10 more JSC test regressions.
3021 (KJS::Machine::privateExecute):
3023 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3027 - throw proper exceptions for objects that don't implement call or construct
3029 This fixes 21 more JSC test regressions. It is also seemingly an
3032 * VM/ExceptionHelpers.cpp:
3033 (KJS::createNotAnObjectError):
3034 (KJS::createNotAConstructorError):
3035 (KJS::createNotAFunctionError):
3036 * VM/ExceptionHelpers.h:
3038 (KJS::Machine::privateExecute):
3040 2008-04-21 Oliver Hunt <oliver@apple.com>
3044 Implement emitCode for ConstDeclNode.
3046 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
3048 * VM/CodeGenerator.cpp:
3049 (KJS::CodeGenerator::registerForLocalConstInit):
3050 * VM/CodeGenerator.h:
3052 (KJS::AssignResolveNode::emitCode):
3053 (KJS::ConstDeclNode::emitCodeSingle):
3054 (KJS::ConstDeclNode::emitCode):
3055 (KJS::ConstStatementNode::emitCode):
3058 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3062 - add some support for the split window object
3064 This fixes many layout tests.
3067 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
3068 wrapper global, if one exists, as the "this" object.
3070 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
3073 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3077 - restore ScopeChain::operator= to avoid crash on many layout tests
3079 Otherwise, FunctionImp::setScope would cause a reference
3080 underflow. I implemented using the copy construct and swap idiom.
3082 * kjs/scope_chain.h:
3083 (KJS::ScopeChain::swap):
3084 (KJS::ScopeChain::operator=):
3086 2008-04-21 Oliver Hunt <oliver@apple.com>
3090 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3091 <https://bugs.webkit.org/show_bug.cgi?id=18649>
3093 Allocate a callframe for eval() and initialise with a null codeBlock to
3094 indicate native code. This prevents the unwinder from clobbering the
3098 (KJS::Machine::execute):
3100 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3102 Reviewed by Sam Weinig.
3104 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
3105 ScopeChain::print to ScopeChainNode.
3107 ScopeChain is now nothing more than a resource-handling wrapper around
3110 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3114 Bug 18671: SquirrelFish: continue inside switch fails
3115 <https://bugs.webkit.org/show_bug.cgi?id=18671>
3117 * VM/CodeGenerator.cpp:
3118 (KJS::CodeGenerator::jumpContextForLabel):
3119 * VM/CodeGenerator.h:
3121 (KJS::ContinueNode::emitCode):
3123 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3125 Reviewed by Sam Weinig.
3127 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
3128 rearranging scope_chain.h a bit.
3130 SunSpider reports no change.
3132 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3134 Reviewed by Sam Weinig.
3136 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
3137 on the knowledge that the ScopeChain is never empty.
3139 SunSpider reports no change.
3141 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3143 Reviewed by Oliver Hunt.
3145 Moved begin() and end() from ScopeChain to ScopeChainNode.
3147 Also marked a few methods "const".
3149 SunSpider reports no change.
3151 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3153 Reviewed by Maciej Stachowiak.
3155 Turned ScopeChain::depth into a stand-alone function, and simplified it
3158 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
3159 the true depth of the ScopeChain -- just the Machine's perspective of
3160 its depth within a given call frame.
3162 SunSpider reports no change.
3164 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3166 Reviewed by Maciej Stachowiak.
3168 Removed indirection in ScopeChain::ref / ScopeChain::deref.
3170 SunSpider reports no change.
3172 * kjs/scope_chain.h:
3173 (KJS::ScopeChain::ScopeChain):
3174 (KJS::ScopeChain::~ScopeChain):
3175 (KJS::ScopeChain::clear):
3177 2008-04-21 Oliver Hunt <oliver@apple.com>
3179 Reviewed by NOBODY(Build fix)
3184 (KJS::ConstDeclNode::evaluateSingle):
3186 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3190 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
3191 <https://bugs.webkit.org/show_bug.cgi?id=18664>
3193 Correctly throw a SyntaxError when parsing of eval code fails.
3198 2008-04-21 Oliver Hunt <oliver@apple.com>
3202 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3204 Make sure we correct the register state before jumping to vm_throw.
3207 (KJS::Machine::privateExecute):
3209 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3211 Reviewed by Maciej Stachowiak.
3213 Simplified ScopeChain ref/deref.
3215 SunSpider reports a .4% speedup.
3217 * kjs/scope_chain.h:
3218 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
3219 ScopeChainNodes are initialized with a refCount of 1, so the loop was
3220 guaranteed to iterate exactly once.
3222 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3224 Reviewed by Maciej Stachowiak.
3226 Removed support for empty ScopeChains.
3228 SunSpider reports no change.
3230 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3232 Reviewed by Maciej Stachowiak.
3234 Removed some completely unused ScopeChain member functions.
3236 SunSpider reports no change.
3238 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3240 Reviewed by Maciej Stachowiak.
3242 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3244 SunSpider reports no change.
3246 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3248 Rubber stamped by Alexey.
3255 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3259 - only print "End:" output when -d flag is passed.
3261 This fixes half of our failing JSC regression tests.
3266 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3270 Add support for variable declarations in eval code.
3273 (KJS::EvalCodeBlock::EvalCodeBlock):
3274 * VM/CodeGenerator.cpp:
3275 (KJS::CodeGenerator::CodeGenerator):
3276 * VM/CodeGenerator.h:
3278 (KJS::Machine::execute):
3281 (KJS::globalFuncEval):
3283 (KJS::EvalNode::generateCode):
3287 2008-04-20 Oliver Hunt <oliver@apple.com>
3291 Throw exceptions for invalid continue, break, and return statements.
3293 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3295 * VM/CodeGenerator.cpp:
3296 (KJS::CodeGenerator::CodeGenerator):
3297 (KJS::CodeGenerator::pushJumpContext):
3298 (KJS::CodeGenerator::popJumpContext):
3299 (KJS::CodeGenerator::jumpContextForLabel):
3300 * VM/CodeGenerator.h:
3302 (KJS::Node::emitThrowError):
3303 (KJS::ContinueNode::emitCode):
3304 (KJS::BreakNode::emitCode):
3305 (KJS::ReturnNode::emitCode):
3308 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3310 Reviewed by Oliver Hunt.
3312 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3313 things that used to be inlined automatically.
3315 1.9% speedup on SunSpider.
3317 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3318 that GCC is making fewer decisions. The speedup seems to confirm that.
3320 2008-04-20 Oliver Hunt <oliver@apple.com>
3324 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3325 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3327 To prevent incorrectly reusing what will become the result register for
3328 eval and global code execution, we need to request and ref the destination
3329 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3330 although in future we can probably limit this. Curiously SunSpider shows
3331 a progression in a number of tests, although it comes out as a wash overall.
3334 (KJS::EvalNode::emitCode):
3335 (KJS::ProgramNode::emitCode):
3337 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3341 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3344 (KJS::CodeBlock::dump):
3345 * VM/CodeGenerator.cpp:
3346 (KJS::CodeGenerator::emitCreateError):
3347 * VM/CodeGenerator.h:
3349 (KJS::Machine::privateExecute):
3352 (KJS::PostfixErrorNode::emitCode):
3353 (KJS::PrefixErrorNode::emitCode):
3354 (KJS::AssignErrorNode::emitCode):
3357 2008-04-20 Oliver Hunt <oliver@apple.com>
3359 Reviewed by Geoff and Mark.
3361 Provide line number information in exceptions
3363 Simple patch, adds line number information metadata to CodeBlock
3364 and a simple method to get the line number responsible for a given
3368 (KJS::CodeBlock::lineNumberForVPC):
3370 * VM/CodeGenerator.h:
3371 (KJS::CodeGenerator::emitNode):
3373 (KJS::Machine::throwException):
3375 2008-04-20 Oliver Hunt <oliver@apple.com>
3379 Provide "sourceURL" in exceptions
3383 (KJS::Machine::throwException):
3385 (KJS::EvalNode::generateCode):
3386 (KJS::ProgramNode::generateCode):
3388 2008-04-19 Oliver Hunt <oliver@apple.com>
3392 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3394 This patch just a preparation for tracking line numbers.
3397 (KJS::ObjectLiteralNode::emitCode):
3398 (KJS::PropertyListNode::emitCode):
3399 (KJS::ArgumentListNode::emitCode):
3400 (KJS::TryNode::emitCode):
3402 2008-04-19 Oliver Hunt <oliver@apple.com>
3406 Bug 18619: Support continue, break, and return in try .. finally blocks
3407 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3409 This patch replaces the current partial finally support (which uses code
3410 duplication to achieve what it does) with a subroutine based approach.
3411 This has a number of advantages over code duplication:
3413 * Simplified exception handling as the finaliser code only exists in
3414 one place, so no "magic" is needed to get the correct handler for a
3416 * When we support instruction to line number mapping we won't need to
3417 worry about the dramatic code movement caused by duplication
3419 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3420 to enter and exit the finaliser subroutines, happily SunSpider reports
3421 a performance progression (gcc amazes me) and ubench reports a wash.
3423 While jsr and sret provide a mechanism that allows us to enter and exit
3424 any arbitrary finaliser we need to, it was still necessary to increase
3425 the amount of information tracked when entering and exiting both finaliser
3426 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3427 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3428 now use a scopeContextStack to ensure that we pop scopes and execute
3429 finalisers in the correct order. This increases the cost of "with" nodes
3430 during codegen, but it should not be significant enough to effect real
3431 world performance and greatly simplifies codegen for return, break and
3432 continue when interacting with finalisers.
3435 (KJS::CodeBlock::dump):
3436 Pretty printing of jsr/sret opcodes
3438 * VM/CodeGenerator.cpp:
3439 (KJS::CodeGenerator::CodeGenerator):
3440 (KJS::CodeGenerator::emitPushScope):
3441 (KJS::CodeGenerator::emitPopScope):
3442 Dynamic scopes need to be tracked on the scopeContextStack now
3444 (KJS::CodeGenerator::pushFinallyContext):
3445 (KJS::CodeGenerator::popFinallyContext):
3446 Handle entry and exit from code regions with finalisers. This is
3447 needed solely to support return, continue and break inside finaliser
3450 (KJS::CodeGenerator::emitComplexJumpScopes):
3451 Helper function for emitJumpScopes to handle the complex codegen
3452 needed to handle return, continue and break inside a finaliser region
3454 (KJS::CodeGenerator::emitJumpScopes):
3455 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3456 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3457 we can handle the normal (trivial) case with a single instruction.
3459 (KJS::CodeGenerator::emitJumpSubroutine):
3460 (KJS::CodeGenerator::emitSubroutineReturn):
3461 Trivial opcode emitter functions.
3463 * VM/CodeGenerator.h:
3464 (KJS::CodeGenerator::scopeDepth):
3466 (KJS::Machine::privateExecute):
3467 Implement op_jsr and op_sret.
3470 Ad op_jsr and op_sret
3473 (KJS::TryNode::emitCode):
3474 Fix codegen for new finaliser model.
3476 2008-04-17 Mark Rowe <mrowe@apple.com>
3478 Rubber-stamped by Oliver Hunt.
3480 Remove unnecessary files from testkjs, testapi and minidom targets.
3482 * JavaScriptCore.xcodeproj/project.pbxproj:
3484 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3486 Reviewed by Oliver Hunt.
3488 Fixed ASSERT seen during run-sunspider of a debug build.
3490 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3491 runs all tests in one global environment, so you end up with more than
3492 128 locals. This is just a stop-gap until we code up a real
3493 solution to arbitrary symbol and label limits.
3495 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3497 Reviewed by Oliver Hunt.
3499 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3500 chain in global scope, so we would leak ScopeChainNodes when exceptions
3501 were thrown inside "with" and "catch" scopes.
3503 Also did some cleanup of the unwinding code along the way.
3505 Scope chain reference counting is still wrong in a few ways. I thought
3506 I would fix this portion of it first.
3508 run-sunspider shows no change.
3511 (KJS::Machine::unwindCallFrame):
3512 (KJS::Machine::throwException):
3513 (KJS::Machine::privateExecute):
3516 2008-04-17 Oliver Hunt <oliver@apple.com>
3520 Add more exception checking to toNumber conversions
3522 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3525 (KJS::Machine::privateExecute):
3527 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3529 Reviewed by Oliver Hunt.
3533 Introduced a new opcode: op_call_eval. In the normal case, it performs
3534 an eval. In the case where eval has been overridden in some way, it
3535 performs a function call.
3537 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3538 to optimized locals in eval code.
3540 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3542 Reviewed by Sam Weinig.
3544 Added some ASSERTs to document codegen failures in
3545 run-javascriptcore-tests.
3547 For all tests, program-level codegen now either succeeds, or fails with
3550 * VM/CodeGenerator.cpp:
3551 (KJS::CodeGenerator::addVar):
3552 (KJS::CodeGenerator::CodeGenerator):
3553 (KJS::CodeGenerator::newTemporary):
3554 (KJS::CodeGenerator::newLabel):
3556 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3558 Reviewed by Maciej Stachowiak.
3560 Fixed another case of a dst register being an unreferenced temporary
3561 (caused an ASSERT when running the full sunspider suite).
3564 (KJS::CaseBlockNode::emitCodeForBlock):
3566 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3570 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
3573 (KJS::CodeBlock::dump):
3574 * VM/CodeGenerator.cpp:
3575 (KJS::CodeGenerator::emitMul):
3576 (KJS::CodeGenerator::emitDiv):
3577 (KJS::CodeGenerator::emitMod):
3578 (KJS::CodeGenerator::emitSub):
3579 (KJS::CodeGenerator::emitLeftShift):
3580 (KJS::CodeGenerator::emitRightShift):
3581 (KJS::CodeGenerator::emitUnsignedRightShift):
3582 (KJS::CodeGenerator::emitBitAnd):
3583 (KJS::CodeGenerator::emitBitXOr):
3584 (KJS::CodeGenerator::emitBitOr):
3585 * VM/CodeGenerator.h:
3587 (KJS::Machine::privateExecute):
3590 (KJS::MultNode::emitCode):
3591 (KJS::DivNode::emitCode):
3592 (KJS::ModNode::emitCode):
3593 (KJS::SubNode::emitCode):
3594 (KJS::LeftShiftNode::emitCode):
3595 (KJS::RightShiftNode::emitCode):
3596 (KJS::UnsignedRightShiftNode::emitCode):
3597 (KJS::BitAndNode::emitCode):
3598 (KJS::BitXOrNode::emitCode):
3599 (KJS::BitOrNode::emitCode):
3600 (KJS::emitReadModifyAssignment):
3601 (KJS::ReadModifyResolveNode::emitCode):
3603 2008-04-16 Oliver Hunt <oliver@apple.com>
3607 Exception checks for toNumber in op_pre_inc
3609 This is somewhat more convoluted than the simple hadException checks
3610 we currently use. Instead we use special toNumber conversions that
3611 select between the exception and ordinary vPC. This allows us to
3612 remove any branches in the common case (incrementing a number).
3614 * API/JSCallbackObject.h:
3615 * API/JSCallbackObjectFunctions.h:
3618 * JavaScriptCore.exp:
3619 * JavaScriptCore.xcodeproj/project.pbxproj:
3620 * VM/JSPropertyNameIterator.cpp:
3621 (KJS::JSPropertyNameIterator::toNumber):
3622 * VM/JSPropertyNameIterator.h:
3624 (KJS::Machine::privateExecute):
3626 * kjs/ExecState.cpp:
3627 (KJS::ExecState::ExecState):
3629 * kjs/JSNotAnObject.cpp:
3630 (KJS::JSNotAnObject::toNumber):
3631 * kjs/JSNotAnObject.h:
3633 (KJS::StringImp::toNumber):
3634 (KJS::NumberImp::toNumber):
3635 (KJS::GetterSetterImp::toNumber):
3638 (KJS::JSObject::toNumber):
3641 (KJS::JSValue::toNumber):
3643 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3647 - ensure that activations are kept in a register to protect them from GC
3649 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
3650 that is what is now kept there, and there is no more need to keep the scope chain in
3654 (KJS::initializeCallFrame):
3655 (KJS::scopeChainForCall):
3659 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3661 Reviewed by Oliver Hunt.
3663 Made "this" work in program code / global scope.
3665 The machine can initialize "this" prior to execution because it knows
3666 that, for program code, "this" is always stored in lr1.
3669 (KJS::Machine::execute):
3672 * kjs/interpreter.cpp:
3673 (KJS::Interpreter::evaluate):
3675 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3677 Reviewed by Oliver Hunt.
3679 Fixed a codegen bug when returning from inside a dynamic scope (a with
3680 or catch block): we need to pop any dynamic scope(s) that have been
3681 added so op_ret can find the activation object at the top of the scope
3685 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
3686 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
3687 and then branching to the return instruction.
3689 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3693 - document the add and get_prop_id opcodes
3695 In addition to adding documentation in comments, I changed
3696 references to register IDs or indices relating to these opcodes to
3697 have meaningful names instead of r0 r1 r2.
3699 * VM/CodeGenerator.cpp:
3700 (KJS::CodeGenerator::emitAdd):
3701 * VM/CodeGenerator.h:
3703 (KJS::Machine::privateExecute):
3705 (KJS::DotAccessorNode::emitCode):
3706 (KJS::FunctionCallDotNode::emitCode):
3707 (KJS::PostIncDotNode::emitCode):
3708 (KJS::PostDecDotNode::emitCode):
3709 (KJS::PreIncDotNode::emitCode):
3710 (KJS::PreDecDotNode::emitCode):
3711 (KJS::AddNode::emitCode):
3712 (KJS::ReadModifyDotNode::emitCode):
3714 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3716 Reviewed by Oliver Hunt and Maciej Stachowiak.
3718 Fixed a codegen bug in with and switch, and added an ASSERT to
3719 make sure it doesn't happen again.
3721 emitCode() assumes that dst, if non-zero, is either referenced or
3722 non-temporary (i.e., it assumes that newTemporary() will return a
3723 register not equal to dst). Certain callers to emitCode() weren't
3724 guaranteeing that to be so, so temporary register values were being
3727 * VM/CodeGenerator.h:
3728 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
3731 (KJS::CommaNode::emitCode): Reference the dst we pass.
3733 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
3735 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
3736 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
3738 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
3741 2008-04-15 Oliver Hunt <oliver@apple.com>
3745 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
3746 <https://bugs.webkit.org/show_bug.cgi?id=18526>
3748 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
3751 (KJS::resolveBaseAndFunc):
3752 (KJS::Machine::privateExecute):
3754 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3758 - fix incorrect result on 3d-raytrace test
3760 Oliver found and tracked down this bug, I just typed in the fix.
3763 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
3764 account for the space for local variables.
3766 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3770 - fix codegen handling of dst registers
3772 1.006x speedup (not sure why).
3774 Most emitCode functions take an optional "dst" parameter that says
3775 where the output of the instruction should be written. I made some
3776 functions for convenient handling of the dst register:
3778 * VM/CodeGenerator.h:
3779 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
3780 it is not null and is a temporary, otherwise allocates a new temporary. This is
3781 intended for cases where an intermediate value might be written into the dst
3783 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
3784 register that was used as a temp destination. Picks the right thing for the final
3785 output. Intended to be used as the output register for the instruction that generates
3786 the final value of a particular node.
3788 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
3789 RegisterID; moves from the register to dst if dst is defined and
3790 different from the register. This is intended for cases where the
3791 result of a node is already in a specific register (likely a
3792 local), and so no code needs to be generated unless a specific
3793 destination has been requested, in which case a move is needed.
3795 I also applied these methods throughout emitCode functions. In
3796 some cases this was just cleanup, in other cases I fixed actual
3797 codegen bugs. Below I have given specific comments for the cases
3798 where I believe I fixed a codegen bug, or improved quality of codegen.
3801 (KJS::NullNode::emitCode):
3802 (KJS::FalseNode::emitCode):
3803 (KJS::TrueNode::emitCode):
3804 (KJS::NumberNode::emitCode):
3805 (KJS::StringNode::emitCode):
3806 (KJS::RegExpNode::emitCode):
3807 (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
3808 the same as the this register (the unlikely case of "this = this");
3809 (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
3810 is the same as the local regiester, in the local var case (the
3811 unlikely case of "x = x");
3812 (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
3813 literal element expressions may have observed an intermediate
3814 value of constructing the array.
3815 (KJS::ObjectLiteralNode::emitCode):
3816 (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
3817 property definition expressions may have obesrved an intermediate value of
3818 constructing the object.
3819 (KJS::BracketAccessorNode::emitCode):
3820 (KJS::DotAccessorNode::emitCode):
3821 (KJS::NewExprNode::emitCode):
3822 (KJS::FunctionCallValueNode::emitCode):
3823 (KJS::FunctionCallBracketNode::emitCode):
3824 (KJS::FunctionCallDotNode::emitCode):
3825 (KJS::PostIncResolveNode::emitCode):
3826 (KJS::PostDecResolveNode::emitCode):
3827 (KJS::PostIncBracketNode::emitCode):
3828 (KJS::PostDecBracketNode::emitCode):
3829 (KJS::PostIncDotNode::emitCode):
3830 (KJS::PostDecDotNode::emitCode):
3831 (KJS::DeleteResolveNode::emitCode):
3832 (KJS::DeleteBracketNode::emitCode):
3833 (KJS::DeleteDotNode::emitCode):
3834 (KJS::DeleteValueNode::emitCode):
3835 (KJS::VoidNode::emitCode):
3836 (KJS::TypeOfResolveNode::emitCode):
3837 (KJS::TypeOfValueNode::emitCode):
3838 (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
3839 value would not be output to the dst register in the local var case.
3840 (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
3841 value would not be output to the dst register in the local var case.
3842 (KJS::PreIncBracketNode::emitCode):
3843 (KJS::PreDecBracketNode::emitCode):
3844 (KJS::PreIncDotNode::emitCode):
3845 (KJS::PreDecDotNode::emitCode):
3846 (KJS::UnaryPlusNode::emitCode):
3847 (KJS::NegateNode::emitCode):
3848 (KJS::BitwiseNotNode::emitCode):
3849 (KJS::LogicalNotNode::emitCode):
3850 (KJS::MultNode::emitCode):
3851 (KJS::DivNode::emitCode):
3852 (KJS::ModNode::emitCode):
3853 (KJS::AddNode::emitCode):
3854 (KJS::SubNode::emitCode):
3855 (KJS::LeftShiftNode::emitCode):
3856 (KJS::RightShiftNode::emitCode):
3857 (KJS::UnsignedRightShiftNode::emitCode):
3858 (KJS::LessNode::emitCode):
3859 (KJS::GreaterNode::emitCode):
3860 (KJS::LessEqNode::emitCode):
3861 (KJS::GreaterEqNode::emitCode):
3862 (KJS::InstanceOfNode::emitCode):
3863 (KJS::InNode::emitCode):
3864 (KJS::EqualNode::emitCode):
3865 (KJS::NotEqualNode::emitCode):
3866 (KJS::StrictEqualNode::emitCode):
3867 (KJS::NotStrictEqualNode::emitCode):
3868 (KJS::BitAndNode::emitCode):
3869 (KJS::BitXOrNode::emitCode):
3870 (KJS::BitOrNode::emitCode):
3871 (KJS::LogicalAndNode::emitCode):
3872 (KJS::LogicalOrNode::emitCode):
3873 (KJS::ConditionalNode::emitCode):
3874 (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
3875 needed for fixes below.
3876 (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
3877 the expression may observe an intermediate value.
3878 (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
3879 expression may observe an intermediate value.
3880 (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
3881 expression may observe an intermediate value.
3882 (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
3883 expression may observe an intermediate value.
3884 (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
3885 (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
3886 (KJS::FuncExprNode::emitCode):
3888 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3892 - fix huge performance regression (from trunk) in string-unpack-code
3894 This restores string-unpack-code performance to parity with
3895 trunk (2.27x speedup relative to previous SquirrelFish)
3898 (KJS::Machine::execute): Shrink register file after call to avoid
3901 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3903 Reviewed by Sam Weinig.
3905 Fixed dumpCallFrame to match our new convention of passing around a
3906 ScopeChainNode* instead of a ScopeChain*.
3908 * JavaScriptCore.exp:
3910 (KJS::Machine::dumpCallFrame):
3913 2008-04-15 Oliver Hunt <oliver@apple.com>
3917 Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
3918 <https://bugs.webkit.org/show_bug.cgi?id=18436>
3920 Add op_resolve_base_and_property for read/modify/write operations,
3921 this adds a "superinstruction" to resolve the base and value of a
3922 property simultaneously. Just using resolveBase and resolve results
3923 in an 5% regression in ubench, 30% in loop-empty-resolve (which is
3924 expected). 1.3% progression in sunspider, 2.1% in ubench, with a
3925 21% gain in loop-empty-resolve. The only outlier is function-missing-args
3926 which gets a 3% regression that I could never resolve.
3929 (KJS::CodeBlock::dump):
3930 * VM/CodeGenerator.cpp:
3931 (KJS::CodeGenerator::emitResolveBaseAndProperty):
3932 * VM/CodeGenerator.h:
3934 (KJS::resolveBaseAndProperty):
3935 (KJS::Machine::privateExecute):
3938 (KJS::PostIncResolveNode::emitCode):
3939 (KJS::PostDecResolveNode::emitCode):
3940 (KJS::PreIncResolveNode::emitCode):
3941 (KJS::PreDecResolveNode::emitCode):
3942 (KJS::ReadModifyResolveNode::emitCode):
3944 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3948 - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
3949 https://bugs.webkit.org/show_bug.cgi?id=18508
3951 3d-raytrace and string-unpack-code now run.
3953 The basic approach is to pass around ScopeChainNode* instead of
3954 ScopeChain*, which in addition to not becoming suddenly an invalid
3955 pointer also saves an indirection.
3957 This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
3962 (KJS::resolveBaseAndFunc):
3963 (KJS::initializeCallFrame):
3964 (KJS::scopeChainForCall):
3965 (KJS::Machine::unwindCallFrame):
3966 (KJS::Machine::throwException):
3967 (KJS::Machine::execute):
3968 (KJS::Machine::privateExecute):
3973 (KJS::EvalNode::generateCode):
3974 (KJS::FunctionBodyNode::generateCode):
3975 (KJS::ProgramNode::generateCode):
3976 (KJS::ProgramNode::processDeclarations):
3977 (KJS::EvalNode::processDeclarations):
3978 (KJS::FuncDeclNode::makeFunction):
3979 (KJS::FuncExprNode::makeFunction):
3981 (KJS::ProgramNode::):
3983 (KJS::FunctionBodyNode::):
3985 * kjs/scope_chain.h:
3986 (KJS::ScopeChainNode::ScopeChainNode):
3987 (KJS::ScopeChainNode::deref):
3988 (KJS::ScopeChainIterator::ScopeChainIterator):
3989 (KJS::ScopeChainIterator::operator*):
3990 (KJS::ScopeChainIterator::operator->):
3991 (KJS::ScopeChain::ScopeChain):
3992 (KJS::ScopeChain::node):
3993 (KJS::ScopeChain::deref):
3994 (KJS::ScopeChain::ref):
3995 (KJS::ScopeChainNode::ref):
3996 (KJS::ScopeChainNode::release):
3997 (KJS::ScopeChainNode::begin):
3998 (KJS::ScopeChainNode::end):
4000 2008-04-14 Geoffrey Garen <ggaren@apple.com>
4002 Reviewed by Oliver Hunt.
4004 Fixed crash when accessing registers in a torn-off activation object.
4006 * kjs/JSActivation.cpp:
4007 (KJS::JSActivation::copyRegisters): Update our registerOffset after
4008 copying our registers, since our offset should now be relative to
4009 our private register array, not the shared register file.
4011 2008-04-14 Maciej Stachowiak <mjs@apple.com>
4015 - fix a codegen flaw that makes some tests run way too fast or way too slow
4017 The basic problem was that FunctionCallResolveNode results in
4018 codegen which can incorrectly write an intermediate value into the
4019 dst register even when that is a local. I added convenience
4020 functions to CodeGenerator for getting this right, but for now I
4021 only fixed FunctionCallResolve.
4023 * VM/CodeGenerator.h:
4024 (KJS::CodeGenerator::tempDestination):
4025 (KJS::CodeGenerator::):
4027 (KJS::FunctionCallResolveNode::emitCode):
4029 2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
4031 Reviewed and slightly tweaked by Geoffrey Garen.
4033 Bug 18489: Squirrelfish doesn't build on linux
4034 <https://bugs.webkit.org/show_bug.cgi?id=18489>
4036 * JavaScriptCore.pri: Add VM into include path and its files into
4038 * VM/JSPropertyNameIterator.cpp: Fix include name
4039 * VM/Machine.cpp: Add UNLIKELY macro for GCC
4040 * VM/Machine.h: Add missing includes
4041 * VM/RegisterFile.cpp: Add missing include
4042 * kjs/testkjs.pro: Add VM into include path
4044 2008-04-14 Geoffrey Garen <ggaren@apple.com>
4046 Reviewed by Sam Weinig.
4048 Restored OwnPtr in some places where I had removed it previously. We
4049 can have an OwnPtr to an undefined class in a header as long as the
4050 class's destructor isn't in the header.
4052 2008-04-14 Geoffrey Garen <ggaren@apple.com>
4054 Reviewed by Sam Weinig.
4056 Fixed access to "this" inside dynamic scopes.
4058 * VM/CodeGenerator.cpp:
4059 (KJS::CodeGenerator::registerForLocal): Always return a register for
4060 "this", even if we're not optimizing access to other locals. Because
4061 "this" is a keyword, it's always in a register and always accessible.
4063 * VM/CodeGenerator.h:
4064 (KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
4065 for determining whether we should optimize access to locals, since
4066 eval will need to make this test a little more complicated.
4068 2008-04-14 Maciej Stachowiak <mjs@apple.com>
4072 - fix crash when running SunSpider full harness
4074 When growing the register file's buffer to make space for new globals,
4075 make sure to copy accounting for the fact that the new space is logically
4076 at the beginning of the buffer in this case, instead of at the end as when
4077 growing for a new call frame.
4079 * VM/RegisterFile.cpp:
4080 (KJS::RegisterFile::newBuffer):
4081 (KJS::RegisterFile::growBuffer):
4082 (KJS::RegisterFile::addGlobalSlots):
4083 * VM/RegisterFile.h:
4085 2008-04-11 Geoffrey Garen <ggaren@apple.com>
4087 Reviewed by Sam Weinig.
4089 Mark constant pools for global and eval code (collectively known as
4090 "program code"). (Constant pools for function code are already marked by
4093 The global object is responsible for marking program code constant
4094 pools. Code blocks add themselves to the mark set at creation time, and
4095 remove themselves from the mark set at destruction time.
4097 sunspider --squirrelfish reports a 1% speedup, perhaps because
4098 generateCode() is now non-virtual.
4100 * kjs/nodes.cpp: I had to use manual init and delete in this file
4101 because putting an OwnPtr into the header would have created a circular
4104 2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4108 Bug 18231: Improve support for function call nodes in SquirrelFish
4109 <https://bugs.webkit.org/show_bug.cgi?id=18231>
4111 Use correct value of 'this' for function calls.
4114 (KJS::CodeBlock::dump):
4115 * VM/CodeGenerator.cpp:
4116 (KJS::CodeGenerator::emitResolveBaseAndFunc):
4117 * VM/CodeGenerator.h:
4119 (KJS::resolveBaseAndFunc):
4120 (KJS::Machine::privateExecute):
4123 (KJS::FunctionCallResolveNode::emitCode):
4125 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4129 * kjs/interpreter.cpp:
4130 (KJS::Interpreter::evaluate):
4132 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4134 Reviewed by Sam Weinig.
4136 Fixed Interpreter::execute to honor the new model for returning non-NULL
4137 values when an exception is thrown.
4139 * kjs/interpreter.cpp:
4140 (KJS::Interpreter::evaluate):
4142 2008-04-10 Oliver Hunt <oliver@apple.com>
4146 Fix SquirrelFish interpreter to pass internal exceptions back to
4147 native code correctly.
4149 * JavaScriptCore.xcodeproj/project.pbxproj:
4151 (KJS::Machine::privateExecute):
4153 2008-04-10 Sam Weinig <sam@webkit.org>
4155 Reviewed by Geoffrey Garen.
4157 Replace the use of getCallData in op_construct with the new
4158 getConstructData function that replaces implementsConstruct.
4160 * API/JSCallbackConstructor.cpp:
4161 (KJS::JSCallbackConstructor::getConstructData):
4162 * API/JSCallbackConstructor.h:
4163 * API/JSCallbackObject.h:
4164 * API/JSCallbackObjectFunctions.h:
4165 (KJS::::getConstructData):
4167 * API/JSObjectRef.cpp:
4168 (JSObjectIsConstructor):
4169 * JavaScriptCore.exp:
4170 * JavaScriptCore.xcodeproj/project.pbxproj:
4172 (KJS::Machine::privateExecute):
4174 * kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.