Changeset 179862 in webkit
- Timestamp:
- Feb 9, 2015, 7:27:43 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 21 edited
-
CMakeLists.txt (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (modified) (2 diffs)
-
JavaScriptCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
bytecode/CodeBlock.h (modified) (1 diff)
-
bytecode/VirtualRegister.h (modified) (1 diff)
-
interpreter/CallFrame.h (modified) (1 diff)
-
interpreter/Interpreter.cpp (modified) (11 diffs)
-
interpreter/Interpreter.h (modified) (1 diff)
-
jit/AssemblyHelpers.h (modified) (1 diff)
-
jit/JIT.h (modified) (5 diffs)
-
jit/JITCall.cpp (modified) (6 diffs)
-
jit/JITCall32_64.cpp (modified) (5 diffs)
-
jit/JITInlines.h (modified) (3 diffs)
-
jit/JITOperations.cpp (modified) (2 diffs)
-
jit/JITOperations.h (modified) (2 diffs)
-
jit/SetupVarargsFrame.cpp (added)
-
jit/SetupVarargsFrame.h (added)
-
llint/LLIntSlowPaths.cpp (modified) (3 diffs)
-
runtime/Arguments.cpp (modified) (4 diffs)
-
runtime/Arguments.h (modified) (2 diffs)
-
runtime/JSArray.cpp (modified) (4 diffs)
-
runtime/JSArray.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r179503 r179862 350 350 jit/JITThunks.cpp 351 351 jit/JITToDFGDeferredCompilationCallback.cpp 352 jit/SetupVarargsFrame.cpp 352 353 jit/PolymorphicCallStubRoutine.cpp 353 354 jit/Reg.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r179851 r179862 1 2015-02-09 Filip Pizlo <fpizlo@apple.com> 2 3 Varargs frame set-up should be factored out for use by other JITs 4 https://bugs.webkit.org/show_bug.cgi?id=141388 5 6 Reviewed by Michael Saboff. 7 8 Previously the code that dealt with varargs always assumed that we were setting up a varargs call 9 frame by literally following the execution semantics of op_call_varargs. This isn't how it'll 10 happen once the DFG and FTL do varargs calls, or when varargs calls get inlined. The DFG and FTL 11 don't literally execute bytecode; for example their stack frame layout has absolutely nothing in 12 common with what the bytecode says, and that will never change. 13 14 This patch makes two changes: 15 16 Setting up the varargs callee frame can be done in smaller steps: particularly in the case of a 17 varargs call that gets inlined, we aren't going to actually want to set up a callee frame in 18 full - we just want to put the arguments somewhere, and that place will not have much (if 19 anything) in common with the call frame format. This patch factors that out into something called 20 a loadVarargs. The thing we used to call loadVarargs is now called setupVarargsFrame. This patch 21 also separates loading varargs from setting this, since the fact that those two things are done 22 together is a detail made explicit in bytecode but it's not at all required in the higher-tier 23 engines. In the process of factoring this code out, I found a bunch of off-by-one errors in the 24 various calculations. I fixed them. The distance from the caller's frame pointer to the callee 25 frame pointer is always: 26 27 numUsedCallerSlots + argCount + 1 + CallFrameSize 28 29 where numUsedCallerSlots is toLocal(firstFreeRegister) - 1, which simplifies down to just 30 -firstFreeRegister. The code now speaks of numUsedCallerSlots rather than firstFreeRegister, 31 since the latter is a bytecode peculiarity that doesn't apply in the DFG or FTL. In the DFG, the 32 internally-computed frame size, minus the parameter slots, will be used for numUsedCallerSlots. 33 In the FTL, we will essentially compute numUsedCallerSlots dynamically by subtracting SP from FP. 34 Eventually, LLVM might give us some cleaner way of doing this, but it probably doesn't matter 35 very much. 36 37 The arguments forwarding optimization is factored out of the Baseline JIT: the DFG and FTL will 38 want to do this optimization as well, but it involves quite a bit of code. So, this code is now 39 factored out into SetupVarargsFrame.h|cpp, so that other JITs can use it. In the process of factoring 40 this code out I noticed that the 32-bit and 64-bit code is nearly identical, so I combined them. 41 42 * CMakeLists.txt: 43 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 44 * JavaScriptCore.xcodeproj/project.pbxproj: 45 * bytecode/CodeBlock.h: 46 (JSC::ExecState::r): 47 (JSC::ExecState::uncheckedR): 48 * bytecode/VirtualRegister.h: 49 (JSC::VirtualRegister::operator+): 50 (JSC::VirtualRegister::operator-): 51 (JSC::VirtualRegister::operator+=): 52 (JSC::VirtualRegister::operator-=): 53 * interpreter/CallFrame.h: 54 * interpreter/Interpreter.cpp: 55 (JSC::sizeFrameForVarargs): 56 (JSC::loadVarargs): 57 (JSC::setupVarargsFrame): 58 (JSC::setupVarargsFrameAndSetThis): 59 * interpreter/Interpreter.h: 60 * jit/AssemblyHelpers.h: 61 (JSC::AssemblyHelpers::emitGetFromCallFrameHeaderPtr): 62 (JSC::AssemblyHelpers::emitGetFromCallFrameHeader32): 63 (JSC::AssemblyHelpers::emitGetFromCallFrameHeader64): 64 * jit/JIT.h: 65 * jit/JITCall.cpp: 66 (JSC::JIT::compileSetupVarargsFrame): 67 * jit/JITCall32_64.cpp: 68 (JSC::JIT::compileSetupVarargsFrame): 69 * jit/JITInlines.h: 70 (JSC::JIT::callOperation): 71 (JSC::JIT::emitGetFromCallFrameHeaderPtr): Deleted. 72 (JSC::JIT::emitGetFromCallFrameHeader32): Deleted. 73 (JSC::JIT::emitGetFromCallFrameHeader64): Deleted. 74 * jit/JITOperations.cpp: 75 * jit/JITOperations.h: 76 * jit/SetupVarargsFrame.cpp: Added. 77 (JSC::emitSetupVarargsFrameFastCase): 78 * jit/SetupVarargsFrame.h: Added. 79 * llint/LLIntSlowPaths.cpp: 80 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 81 * runtime/Arguments.cpp: 82 (JSC::Arguments::copyToArguments): 83 * runtime/Arguments.h: 84 * runtime/JSArray.cpp: 85 (JSC::JSArray::copyToArguments): 86 * runtime/JSArray.h: 87 1 88 2015-02-09 Filip Pizlo <fpizlo@apple.com> 2 89 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r179728 r179862 621 621 <ClCompile Include="..\jit\JITThunks.cpp" /> 622 622 <ClCompile Include="..\jit\JITToDFGDeferredCompilationCallback.cpp" /> 623 <ClCompile Include="..\jit\SetupVarargsFrame.cpp" /> 623 624 <ClCompile Include="..\jit\PolymorphicCallStubRoutine.cpp" /> 624 625 <ClCompile Include="..\jit\Reg.cpp" /> … … 1354 1355 <ClInclude Include="..\jit\JITWriteBarrier.h" /> 1355 1356 <ClInclude Include="..\jit\JSInterfaceJIT.h" /> 1357 <ClInclude Include="..\jit\SetupVarargsFrame.h" /> 1356 1358 <ClInclude Include="..\jit\PolymorphicCallStubRoutine.h" /> 1357 1359 <ClInclude Include="..\jit\Reg.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r179728 r179862 633 633 0FEA0A34170D40BF00BB722C /* DFGJITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA0A30170D40BF00BB722C /* DFGJITCode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 634 634 0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */; }; 635 0FEE98411A8865B700754E93 /* SetupVarargsFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEE98401A8865B600754E93 /* SetupVarargsFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; 636 0FEE98431A89227500754E93 /* SetupVarargsFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEE98421A89227500754E93 /* SetupVarargsFrame.cpp */; }; 635 637 0FEFC9AA1681A3B300567F53 /* DFGOSRExitJumpPlaceholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */; }; 636 638 0FEFC9AB1681A3B600567F53 /* DFGOSRExitJumpPlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEFC9A81681A3B000567F53 /* DFGOSRExitJumpPlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2314 2316 0FEA0A30170D40BF00BB722C /* DFGJITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGJITCode.h; path = dfg/DFGJITCode.h; sourceTree = "<group>"; }; 2315 2317 0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssembler.cpp; sourceTree = "<group>"; }; 2318 0FEE98401A8865B600754E93 /* SetupVarargsFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetupVarargsFrame.h; sourceTree = "<group>"; }; 2319 0FEE98421A89227500754E93 /* SetupVarargsFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetupVarargsFrame.cpp; sourceTree = "<group>"; }; 2316 2320 0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitJumpPlaceholder.cpp; path = dfg/DFGOSRExitJumpPlaceholder.cpp; sourceTree = "<group>"; }; 2317 2321 0FEFC9A81681A3B000567F53 /* DFGOSRExitJumpPlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitJumpPlaceholder.h; path = dfg/DFGOSRExitJumpPlaceholder.h; sourceTree = "<group>"; }; … … 3793 3797 A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */, 3794 3798 A76C51741182748D00715B05 /* JSInterfaceJIT.h */, 3799 0FEE98421A89227500754E93 /* SetupVarargsFrame.cpp */, 3800 0FEE98401A8865B600754E93 /* SetupVarargsFrame.h */, 3795 3801 0FE834151A6EF97B00D04847 /* PolymorphicCallStubRoutine.cpp */, 3796 3802 0FE834161A6EF97B00D04847 /* PolymorphicCallStubRoutine.h */, … … 5511 5517 C2EAA3FA149A835E00FCE112 /* CopiedSpace.h in Headers */, 5512 5518 C2C8D02D14A3C6E000578E65 /* CopiedSpaceInlines.h in Headers */, 5519 0FEE98411A8865B700754E93 /* SetupVarargsFrame.h in Headers */, 5513 5520 0FC3CCFD19ADA410006AC72A /* DFGBlockMapInlines.h in Headers */, 5514 5521 0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */, … … 7138 7145 A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */, 7139 7146 1442566115EDE98D0066A49B /* JSWithScope.cpp in Sources */, 7147 0FEE98431A89227500754E93 /* SetupVarargsFrame.cpp in Sources */, 7140 7148 86E3C618167BABEE006D760A /* JSWrapperMap.mm in Sources */, 7141 7149 14280870107EC1340013E7B2 /* JSWrapperObject.cpp in Sources */, -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r179503 r179862 1237 1237 } 1238 1238 1239 inline Register& ExecState::r(VirtualRegister reg) 1240 { 1241 return r(reg.offset()); 1242 } 1243 1239 1244 inline Register& ExecState::uncheckedR(int index) 1240 1245 { 1241 1246 RELEASE_ASSERT(index < FirstConstantRegisterIndex); 1242 1247 return this[index]; 1248 } 1249 1250 inline Register& ExecState::uncheckedR(VirtualRegister reg) 1251 { 1252 return uncheckedR(reg.offset()); 1243 1253 } 1244 1254 -
trunk/Source/JavaScriptCore/bytecode/VirtualRegister.h
r179503 r179862 71 71 bool operator!=(const VirtualRegister other) const { return m_virtualRegister != other.m_virtualRegister; } 72 72 73 VirtualRegister operator+(int value) const 74 { 75 return VirtualRegister(offset() + value); 76 } 77 VirtualRegister operator-(int value) const 78 { 79 return VirtualRegister(offset() - value); 80 } 81 VirtualRegister& operator+=(int value) 82 { 83 return *this = *this + value; 84 } 85 VirtualRegister& operator-=(int value) 86 { 87 return *this = *this - value; 88 } 89 73 90 void dump(PrintStream& out) const; 74 91 -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r178143 r179862 204 204 // Read a register from the codeframe (or constant from the CodeBlock). 205 205 Register& r(int); 206 Register& r(VirtualRegister); 206 207 // Read a register for a non-constant 207 208 Register& uncheckedR(int); 209 Register& uncheckedR(VirtualRegister); 208 210 209 211 // Access to arguments as passed. (After capture, arguments may move to a different location.) -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r179429 r179862 135 135 } 136 136 137 CallFrame* sizeFrameForVarargs(CallFrame* callFrame, JSStack* stack, JSValue arguments, int firstFreeRegister, uint32_t firstVarArgOffset)137 CallFrame* sizeFrameForVarargs(CallFrame* callFrame, JSStack* stack, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset) 138 138 { 139 139 if (!arguments) { // f.apply(x, arguments), with arguments unmodified. … … 143 143 else 144 144 argumentCountIncludingThis = 1; 145 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), -firstFreeRegister + argumentCountIncludingThis + JSStack::CallFrameHeaderSize + 1);145 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numUsedStackSlots + argumentCountIncludingThis + JSStack::CallFrameHeaderSize); 146 146 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); 147 147 if (argumentCountIncludingThis > Arguments::MaxArguments + 1 || !stack->ensureCapacityFor(newCallFrame->registers())) { … … 154 154 if (arguments.isUndefinedOrNull()) { 155 155 unsigned argumentCountIncludingThis = 1; 156 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), -firstFreeRegister + argumentCountIncludingThis + JSStack::CallFrameHeaderSize + 1);156 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numUsedStackSlots + argumentCountIncludingThis + JSStack::CallFrameHeaderSize); 157 157 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); 158 158 if (!stack->ensureCapacityFor(newCallFrame->registers())) { … … 175 175 else 176 176 argCount = 0; 177 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), -firstFreeRegister + CallFrame::offsetFor(argCount + 1));177 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numUsedStackSlots + argCount + 1 + JSStack::CallFrameHeaderSize); 178 178 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); 179 179 if (argCount > Arguments::MaxArguments || !stack->ensureCapacityFor(newCallFrame->registers())) { … … 191 191 else 192 192 argCount = 0; 193 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), -firstFreeRegister + CallFrame::offsetFor(argCount + 1));193 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numUsedStackSlots + argCount + 1 + JSStack::CallFrameHeaderSize); 194 194 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); 195 195 if (argCount > Arguments::MaxArguments || !stack->ensureCapacityFor(newCallFrame->registers())) { … … 206 206 else 207 207 argCount = 0; 208 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), -firstFreeRegister + CallFrame::offsetFor(argCount + 1));208 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numUsedStackSlots + argCount + 1 + JSStack::CallFrameHeaderSize); 209 209 CallFrame* newCallFrame = CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset); 210 210 if (argCount > Arguments::MaxArguments || !stack->ensureCapacityFor(newCallFrame->registers())) { … … 215 215 } 216 216 217 void loadVarargs(CallFrame* callFrame, CallFrame* newCallFrame, JSValue thisValue, JSValue arguments, uint32_t firstVarArgOffset)217 void loadVarargs(CallFrame* callFrame, VirtualRegister firstElementDest, VirtualRegister countDest, JSValue arguments, uint32_t firstVarArgOffset) 218 218 { 219 219 if (!arguments) { // f.apply(x, arguments), with arguments unmodified. … … 223 223 else 224 224 argumentCountIncludingThis = 1; 225 newCallFrame->setArgumentCountIncludingThis(argumentCountIncludingThis); 226 newCallFrame->setThisValue(thisValue); 225 callFrame->r(countDest).payload() = argumentCountIncludingThis; 227 226 for (size_t i = firstVarArgOffset; i < callFrame->argumentCount(); ++i) 228 newCallFrame->setArgument(i - firstVarArgOffset, callFrame->argumentAfterCapture(i));227 callFrame->r(firstElementDest + i - firstVarArgOffset) = callFrame->argumentAfterCapture(i); 229 228 return; 230 229 } 231 230 232 231 if (arguments.isUndefinedOrNull()) { 233 newCallFrame->setArgumentCountIncludingThis(1); 234 newCallFrame->setThisValue(thisValue); 232 callFrame->r(countDest).payload() = 1; 235 233 return; 236 234 } … … 241 239 if (argCount >= firstVarArgOffset) { 242 240 argCount -= firstVarArgOffset; 243 newCallFrame->setArgumentCountIncludingThis(argCount + 1);244 argsObject->copyToArguments(callFrame, newCallFrame, argCount, firstVarArgOffset);241 callFrame->r(countDest).payload() = argCount + 1; 242 argsObject->copyToArguments(callFrame, firstElementDest, argCount, firstVarArgOffset); 245 243 } else 246 newCallFrame->setArgumentCountIncludingThis(1); 247 newCallFrame->setThisValue(thisValue); 244 callFrame->r(countDest).payload() = 1; 248 245 return; 249 246 } … … 254 251 if (argCount >= firstVarArgOffset) { 255 252 argCount -= firstVarArgOffset; 256 newCallFrame->setArgumentCountIncludingThis(argCount + 1);257 array->copyToArguments(callFrame, newCallFrame, argCount, firstVarArgOffset);253 callFrame->r(countDest).payload() = argCount + 1; 254 array->copyToArguments(callFrame, firstElementDest, argCount, firstVarArgOffset); 258 255 } else 259 newCallFrame->setArgumentCountIncludingThis(1); 260 newCallFrame->setThisValue(thisValue); 256 callFrame->r(countDest).payload() = 1; 261 257 return; 262 258 } … … 266 262 if (argCount >= firstVarArgOffset) { 267 263 argCount -= firstVarArgOffset; 268 newCallFrame->setArgumentCountIncludingThis(argCount + 1);264 callFrame->r(countDest).payload() = argCount + 1; 269 265 } else 270 newCallFrame->setArgumentCountIncludingThis(1); 271 272 newCallFrame->setThisValue(thisValue); 266 callFrame->r(countDest).payload() = 1; 267 273 268 for (size_t i = 0; i < argCount; ++i) { 274 newCallFrame->setArgument(i, asObject(arguments)->get(callFrame, i + firstVarArgOffset));269 callFrame->r(firstElementDest + i) = asObject(arguments)->get(callFrame, i + firstVarArgOffset); 275 270 if (UNLIKELY(callFrame->vm().exception())) 276 271 return; 277 272 } 273 } 274 275 void setupVarargsFrame(CallFrame* callFrame, CallFrame* newCallFrame, JSValue arguments, uint32_t firstVarArgOffset) 276 { 277 VirtualRegister calleeFrameOffset(newCallFrame - callFrame); 278 279 loadVarargs( 280 callFrame, 281 calleeFrameOffset + CallFrame::argumentOffset(0), 282 calleeFrameOffset + JSStack::ArgumentCount, 283 arguments, firstVarArgOffset); 284 } 285 286 void setupVarargsFrameAndSetThis(CallFrame* callFrame, CallFrame* newCallFrame, JSValue thisValue, JSValue arguments, uint32_t firstVarArgOffset) 287 { 288 setupVarargsFrame(callFrame, newCallFrame, arguments, firstVarArgOffset); 289 newCallFrame->setThisValue(thisValue); 278 290 } 279 291 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r176533 r179862 299 299 300 300 JSValue eval(CallFrame*); 301 CallFrame* sizeFrameForVarargs(CallFrame*, JSStack*, JSValue, int, uint32_t firstVarArgOffset); 302 void loadVarargs(CallFrame*, CallFrame*, JSValue, JSValue, uint32_t firstVarArgOffset); 301 CallFrame* sizeFrameForVarargs(CallFrame* exec, JSStack*, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset); 302 void loadVarargs(CallFrame* execCaller, VirtualRegister firstElementDest, VirtualRegister countDest, JSValue source, uint32_t offset); 303 void setupVarargsFrame(CallFrame* execCaller, CallFrame* execCallee, JSValue arguments, uint32_t firstVarArgOffset); 304 void setupVarargsFrameAndSetThis(CallFrame* execCaller, CallFrame* execCallee, JSValue thisValue, JSValue arguments, uint32_t firstVarArgOffset); 305 303 306 } // namespace JSC 304 307 -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h
r179538 r179862 254 254 #endif 255 255 256 void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry entry, GPRReg to) 257 { 258 loadPtr(Address(GPRInfo::callFrameRegister, entry * sizeof(Register)), to); 259 } 256 void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry entry, GPRReg to, GPRReg from = GPRInfo::callFrameRegister) 257 { 258 loadPtr(Address(from, entry * sizeof(Register)), to); 259 } 260 void emitGetFromCallFrameHeader32(JSStack::CallFrameHeaderEntry entry, GPRReg to, GPRReg from = GPRInfo::callFrameRegister) 261 { 262 load32(Address(from, entry * sizeof(Register)), to); 263 } 264 #if USE(JSVALUE64) 265 void emitGetFromCallFrameHeader64(JSStack::CallFrameHeaderEntry entry, GPRReg to, GPRReg from = GPRInfo::callFrameRegister) 266 { 267 load64(Address(from, entry * sizeof(Register)), to); 268 } 269 #endif // USE(JSVALUE64) 260 270 void emitPutToCallFrameHeader(GPRReg from, JSStack::CallFrameHeaderEntry entry) 261 271 { -
trunk/Source/JavaScriptCore/jit/JIT.h
r179372 r179862 1 1 /* 2 * Copyright (C) 2008, 2012 , 2013, 2014Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2012-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 297 297 void compileOpCall(OpcodeID, Instruction*, unsigned callLinkInfoIndex); 298 298 void compileOpCallSlowCase(OpcodeID, Instruction*, Vector<SlowCaseEntry>::iterator&, unsigned callLinkInfoIndex); 299 void compile LoadVarargs(Instruction*);299 void compileSetupVarargsFrame(Instruction*); 300 300 void compileCallEval(Instruction*); 301 301 void compileCallEvalSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&); … … 643 643 644 644 void emitPutIntToCallFrameHeader(RegisterID from, JSStack::CallFrameHeaderEntry); 645 void emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);646 void emitGetFromCallFrameHeader32(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);647 #if USE(JSVALUE64)648 void emitGetFromCallFrameHeader64(JSStack::CallFrameHeaderEntry, RegisterID to, RegisterID from = callFrameRegister);649 #endif650 645 651 646 JSValue getConstantOperand(int src); … … 736 731 MacroAssembler::Call callOperation(V_JITOperation_EJIdJJ, RegisterID, const Identifier*, RegisterID, RegisterID); 737 732 #if USE(JSVALUE64) 738 MacroAssembler::Call callOperation(F_JITOperation_EFJ JZ, RegisterID, RegisterID, RegisterID, int32_t);733 MacroAssembler::Call callOperation(F_JITOperation_EFJZ, RegisterID, RegisterID, int32_t); 739 734 MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, StringImpl*); 740 735 #else … … 751 746 MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E); 752 747 #if USE(JSVALUE32_64) 753 MacroAssembler::Call callOperation(F_JITOperation_EFJ JZ, RegisterID, RegisterID, RegisterID, RegisterID, RegisterID, int32_t);748 MacroAssembler::Call callOperation(F_JITOperation_EFJZ, RegisterID, RegisterID, RegisterID, int32_t); 754 749 MacroAssembler::Call callOperation(F_JITOperation_EJZZ, GPRReg, GPRReg, int32_t, int32_t); 755 750 MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg); -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r179478 r179862 1 1 /* 2 * Copyright (C) 2008, 2013 , 2014Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 #include "ResultType.h" 42 42 #include "SamplingTool.h" 43 #include "SetupVarargsFrame.h" 43 44 #include "StackAlignment.h" 44 45 #include "ThunkGenerators.h" … … 55 56 } 56 57 57 void JIT::compile LoadVarargs(Instruction* instruction)58 void JIT::compileSetupVarargsFrame(Instruction* instruction) 58 59 { 59 60 int thisValue = instruction[3].u.operand; … … 71 72 emitGetVirtualRegister(arguments, regT0); 72 73 slowCase.append(branch64(NotEqual, regT0, TrustedImm64(JSValue::encode(JSValue())))); 73 74 emitGetFromCallFrameHeader32(JSStack::ArgumentCount, regT0); 75 if (firstVarArgOffset) { 76 Jump sufficientArguments = branch32(GreaterThan, regT0, TrustedImm32(firstVarArgOffset + 1)); 77 move(TrustedImm32(1), regT0); 78 Jump endVarArgs = jump(); 79 sufficientArguments.link(this); 80 sub32(TrustedImm32(firstVarArgOffset), regT0); 81 endVarArgs.link(this); 82 } 83 slowCase.append(branch32(Above, regT0, TrustedImm32(Arguments::MaxArguments + 1))); 84 // regT0: argumentCountIncludingThis 85 move(regT0, regT1); 86 add64(TrustedImm32(-firstFreeRegister + JSStack::CallFrameHeaderSize), regT1); 87 // regT1 now has the required frame size in Register units 88 // Round regT1 to next multiple of stackAlignmentRegisters() 89 add64(TrustedImm32(stackAlignmentRegisters() - 1), regT1); 90 and64(TrustedImm32(~(stackAlignmentRegisters() - 1)), regT1); 91 92 neg64(regT1); 93 lshift64(TrustedImm32(3), regT1); 94 addPtr(callFrameRegister, regT1); 95 // regT1: newCallFrame 96 97 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), regT1)); 98 99 // Initialize ArgumentCount. 100 store32(regT0, Address(regT1, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload))); 101 102 // Initialize 'this'. 103 emitGetVirtualRegister(thisValue, regT2); 104 store64(regT2, Address(regT1, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register)))); 105 106 // Copy arguments. 107 signExtend32ToPtr(regT0, regT0); 108 end.append(branchSub64(Zero, TrustedImm32(1), regT0)); 109 // regT0: argumentCount 110 111 Label copyLoop = label(); 112 load64(BaseIndex(callFrameRegister, regT0, TimesEight, (CallFrame::thisArgumentOffset() + firstVarArgOffset) * static_cast<int>(sizeof(Register))), regT2); 113 store64(regT2, BaseIndex(regT1, regT0, TimesEight, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register)))); 114 branchSub64(NonZero, TrustedImm32(1), regT0).linkTo(copyLoop, this); 115 74 75 move(TrustedImm32(-firstFreeRegister), regT1); 76 emitSetupVarargsFrameFastCase(*this, regT1, regT0, regT1, regT2, 0, firstVarArgOffset, slowCase); 116 77 end.append(jump()); 78 slowCase.link(this); 117 79 } 118 80 119 if (canOptimize)120 slowCase.link(this);121 122 81 emitGetVirtualRegister(arguments, regT1); 123 callOperation(operationSizeFrameForVarargs, regT1, firstFreeRegister, firstVarArgOffset);82 callOperation(operationSizeFrameForVarargs, regT1, -firstFreeRegister, firstVarArgOffset); 124 83 move(returnValueGPR, stackPointerRegister); 125 emitGetVirtualRegister(thisValue, regT1); 126 emitGetVirtualRegister(arguments, regT2); 127 callOperation(operationLoadVarargs, returnValueGPR, regT1, regT2, firstVarArgOffset); 84 emitGetVirtualRegister(arguments, regT1); 85 callOperation(operationSetupVarargsFrame, returnValueGPR, regT1, firstVarArgOffset); 128 86 move(returnValueGPR, regT1); 129 87 … … 131 89 end.link(this); 132 90 91 // Initialize 'this'. 92 emitGetVirtualRegister(thisValue, regT0); 93 store64(regT0, Address(regT1, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register)))); 94 133 95 addPtr(TrustedImm32(sizeof(CallerFrameAndPC)), regT1, stackPointerRegister); 134 96 } … … 189 151 COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct_varargs), call_and_construct_varargs_opcodes_must_be_same_length); 190 152 if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs) 191 compile LoadVarargs(instruction);153 compileSetupVarargsFrame(instruction); 192 154 else { 193 155 int argCount = instruction[3].u.operand; -
trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp
r179478 r179862 1 1 /* 2 * Copyright (C) 2008, 2013 , 2014Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 #include "ResultType.h" 42 42 #include "SamplingTool.h" 43 #include "SetupVarargsFrame.h" 43 44 #include "StackAlignment.h" 44 45 #include <wtf/StringPrintStream.h> … … 115 116 } 116 117 117 void JIT::compile LoadVarargs(Instruction* instruction)118 void JIT::compileSetupVarargsFrame(Instruction* instruction) 118 119 { 119 120 int thisValue = instruction[3].u.operand; … … 131 132 emitLoadTag(arguments, regT1); 132 133 slowCase.append(branch32(NotEqual, regT1, TrustedImm32(JSValue::EmptyValueTag))); 133 134 load32(payloadFor(JSStack::ArgumentCount), regT2); 135 if (firstVarArgOffset) { 136 Jump sufficientArguments = branch32(GreaterThan, regT2, TrustedImm32(firstVarArgOffset + 1)); 137 move(TrustedImm32(1), regT2); 138 Jump endVarArgs = jump(); 139 sufficientArguments.link(this); 140 sub32(TrustedImm32(firstVarArgOffset), regT2); 141 endVarArgs.link(this); 142 } 143 slowCase.append(branch32(Above, regT2, TrustedImm32(Arguments::MaxArguments + 1))); 144 // regT2: argumentCountIncludingThis 145 146 move(regT2, regT3); 147 addPtr(TrustedImm32(-firstFreeRegister + JSStack::CallFrameHeaderSize), regT3); 148 // regT1 now has the required frame size in Register units 149 // Round regT1 to next multiple of stackAlignmentRegisters() 150 addPtr(TrustedImm32(stackAlignmentRegisters() - 1), regT3); 151 andPtr(TrustedImm32(~(stackAlignmentRegisters() - 1)), regT3); 152 neg32(regT3); 153 lshift32(TrustedImm32(3), regT3); 154 addPtr(callFrameRegister, regT3); 155 // regT3: newCallFrame 156 157 slowCase.append(branchPtr(Above, AbsoluteAddress(m_vm->addressOfStackLimit()), regT3)); 158 159 // Initialize ArgumentCount. 160 store32(regT2, payloadFor(JSStack::ArgumentCount, regT3)); 161 162 // Initialize 'this'. 163 emitLoad(thisValue, regT1, regT0); 164 store32(regT0, Address(regT3, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + (CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 165 store32(regT1, Address(regT3, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + (CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 166 167 // Copy arguments. 168 end.append(branchSub32(Zero, TrustedImm32(1), regT2)); 169 // regT2: argumentCount; 170 171 Label copyLoop = label(); 172 load32(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) +((CallFrame::thisArgumentOffset() + firstVarArgOffset) * static_cast<int>(sizeof(Register)))), regT0); 173 load32(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) +((CallFrame::thisArgumentOffset() + firstVarArgOffset) * static_cast<int>(sizeof(Register)))), regT1); 174 store32(regT0, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) +(CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 175 store32(regT1, BaseIndex(regT3, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) +(CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 176 branchSub32(NonZero, TrustedImm32(1), regT2).linkTo(copyLoop, this); 177 134 135 move(TrustedImm32(-firstFreeRegister), regT1); 136 emitSetupVarargsFrameFastCase(*this, regT1, regT0, regT1, regT2, 0, firstVarArgOffset, slowCase); 178 137 end.append(jump()); 138 slowCase.link(this); 179 139 } 180 140 181 if (canOptimize)182 slowCase.link(this);183 184 141 emitLoad(arguments, regT1, regT0); 185 callOperation(operationSizeFrameForVarargs, regT1, regT0, firstFreeRegister, firstVarArgOffset); 142 callOperation(operationSizeFrameForVarargs, regT1, regT0, -firstFreeRegister, firstVarArgOffset); 143 // This is spectacularly dirty. We want to pass four arguments to operationSetupVarargsFrame. On x86-32 we 144 // will pass them on the stack. We want four stack slots, or 16 bytes. Extending the stack by 8 bytes 145 // over where we planned on pointing the FP gives us enough room. The reason is that the FP gives an 146 // extra CallerFrameAndPC bytes beyond where SP should point prior to the call. So if we just did 147 // move(returnValueGPR, stackPointerRegister), we'd have enough room for passing two args, or 8 148 // bytes - except that we'd have a misaligned stack. So if we subtract *another* CallerFrameAndPC 149 // bytes, we are up to 16 bytes of spare room *and* we have an aligned stack. Gross, but correct! 186 150 addPtr(TrustedImm32(-sizeof(CallerFrameAndPC)), returnValueGPR, stackPointerRegister); 187 emitLoad(thisValue, regT1, regT4); 188 emitLoad(arguments, regT3, regT2); 189 callOperation(operationLoadVarargs, returnValueGPR, regT1, regT4, regT3, regT2, firstVarArgOffset); 190 move(returnValueGPR, regT3); 151 emitLoad(arguments, regT2, regT1); 152 callOperation(operationSetupVarargsFrame, returnValueGPR, regT2, regT1, firstVarArgOffset); 153 move(returnValueGPR, regT1); 191 154 192 155 if (canOptimize) 193 156 end.link(this); 194 157 195 addPtr(TrustedImm32(sizeof(CallerFrameAndPC)), regT3, stackPointerRegister); 158 // Initialize 'this'. 159 emitLoad(thisValue, regT2, regT0); 160 store32(regT0, Address(regT1, PayloadOffset + (CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 161 store32(regT2, Address(regT1, TagOffset + (CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))))); 162 163 addPtr(TrustedImm32(sizeof(CallerFrameAndPC)), regT1, stackPointerRegister); 196 164 } 197 165 … … 252 220 253 221 if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs) 254 compile LoadVarargs(instruction);222 compileSetupVarargsFrame(instruction); 255 223 else { 256 224 int argCount = instruction[3].u.operand; -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r178143 r179862 99 99 } 100 100 101 ALWAYS_INLINE void JIT::emitGetFromCallFrameHeaderPtr(JSStack::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)102 {103 loadPtr(Address(from, entry * sizeof(Register)), to);104 }105 106 ALWAYS_INLINE void JIT::emitGetFromCallFrameHeader32(JSStack::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)107 {108 load32(Address(from, entry * sizeof(Register)), to);109 }110 111 #if USE(JSVALUE64)112 ALWAYS_INLINE void JIT::emitGetFromCallFrameHeader64(JSStack::CallFrameHeaderEntry entry, RegisterID to, RegisterID from)113 {114 load64(Address(from, entry * sizeof(Register)), to);115 }116 #endif117 118 101 ALWAYS_INLINE void JIT::emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures) 119 102 { … … 393 376 } 394 377 395 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EFJ JZ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3, int32_t arg4)396 { 397 setupArgumentsWithExecState(arg1, arg2, arg3, TrustedImm32(arg4));378 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EFJZ operation, GPRReg arg1, GPRReg arg2, int32_t arg3) 379 { 380 setupArgumentsWithExecState(arg1, arg2, TrustedImm32(arg3)); 398 381 return appendCallWithExceptionCheck(operation); 399 382 } … … 540 523 } 541 524 542 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EFJ JZ operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload, int32_t arg4)543 { 544 setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, arg3Payload, arg3Tag, TrustedImm32(arg4));525 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EFJZ operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, int32_t arg3) 526 { 527 setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, TrustedImm32(arg3)); 545 528 return appendCallWithExceptionCheck(operation); 546 529 } -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r179478 r179862 1605 1605 } 1606 1606 1607 CallFrame* JIT_OPERATION operationSizeFrameForVarargs(ExecState* exec, EncodedJSValue encodedArguments, int32_t firstFreeRegister, int32_t firstVarArgOffset)1607 CallFrame* JIT_OPERATION operationSizeFrameForVarargs(ExecState* exec, EncodedJSValue encodedArguments, int32_t numUsedStackSlots, int32_t firstVarArgOffset) 1608 1608 { 1609 1609 VM& vm = exec->vm(); … … 1611 1611 JSStack* stack = &exec->interpreter()->stack(); 1612 1612 JSValue arguments = JSValue::decode(encodedArguments); 1613 CallFrame* newCallFrame = sizeFrameForVarargs(exec, stack, arguments, firstFreeRegister, firstVarArgOffset);1613 CallFrame* newCallFrame = sizeFrameForVarargs(exec, stack, arguments, numUsedStackSlots, firstVarArgOffset); 1614 1614 return newCallFrame; 1615 1615 } 1616 1616 1617 CallFrame* JIT_OPERATION operationLoadVarargs(ExecState* exec, CallFrame* newCallFrame, EncodedJSValue encodedThis, EncodedJSValue encodedArguments, int32_t firstVarArgOffset) 1618 { 1619 VM& vm = exec->vm(); 1620 NativeCallFrameTracer tracer(&vm, exec); 1621 JSValue thisValue = JSValue::decode(encodedThis); 1617 CallFrame* JIT_OPERATION operationSetupVarargsFrame(ExecState* exec, CallFrame* newCallFrame, EncodedJSValue encodedArguments, int32_t firstVarArgOffset) 1618 { 1619 VM& vm = exec->vm(); 1620 NativeCallFrameTracer tracer(&vm, exec); 1622 1621 JSValue arguments = JSValue::decode(encodedArguments); 1623 loadVarargs(exec, newCallFrame, thisValue, arguments, firstVarArgOffset);1622 setupVarargsFrame(exec, newCallFrame, arguments, firstVarArgOffset); 1624 1623 return newCallFrame; 1625 1624 } -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r179478 r179862 88 88 */ 89 89 90 typedef CallFrame* JIT_OPERATION (*F_JITOperation_EFJ JZ)(ExecState*, CallFrame*, EncodedJSValue, EncodedJSValue, int32_t);90 typedef CallFrame* JIT_OPERATION (*F_JITOperation_EFJZ)(ExecState*, CallFrame*, EncodedJSValue, int32_t); 91 91 typedef CallFrame* JIT_OPERATION (*F_JITOperation_EJZZ)(ExecState*, EncodedJSValue, int32_t, int32_t); 92 92 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_E)(ExecState*); … … 310 310 JSCell* JIT_OPERATION operationGetPNames(ExecState*, JSObject*) WTF_INTERNAL; 311 311 EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState*, EncodedJSValue, EncodedJSValue proto) WTF_INTERNAL; 312 CallFrame* JIT_OPERATION operationSizeFrameForVarargs(ExecState*, EncodedJSValue arguments, int32_t firstFreeRegister, int32_t firstVarArgOffset) WTF_INTERNAL;313 CallFrame* JIT_OPERATION operation LoadVarargs(ExecState*, CallFrame*, EncodedJSValue thisValue, EncodedJSValue arguments, int32_t firstVarArgOffset) WTF_INTERNAL;312 CallFrame* JIT_OPERATION operationSizeFrameForVarargs(ExecState*, EncodedJSValue arguments, int32_t numUsedStackSlots, int32_t firstVarArgOffset) WTF_INTERNAL; 313 CallFrame* JIT_OPERATION operationSetupVarargsFrame(ExecState*, CallFrame*, EncodedJSValue arguments, int32_t firstVarArgOffset) WTF_INTERNAL; 314 314 EncodedJSValue JIT_OPERATION operationToObject(ExecState*, EncodedJSValue) WTF_INTERNAL; 315 315 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r179478 r179862 1166 1166 1167 1167 ExecState* execCallee = sizeFrameForVarargs(exec, &vm.interpreter->stack(), 1168 LLINT_OP_C(4).jsValue(), pc[5].u.operand, pc[6].u.operand);1168 LLINT_OP_C(4).jsValue(), -pc[5].u.operand, pc[6].u.operand); 1169 1169 LLINT_CALL_CHECK_EXCEPTION(exec, exec); 1170 1170 … … 1185 1185 ExecState* execCallee = vm.newCallFrameReturnValue; 1186 1186 1187 loadVarargs(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand);1187 setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand); 1188 1188 LLINT_CALL_CHECK_EXCEPTION(exec, exec); 1189 1189 … … 1206 1206 ExecState* execCallee = vm.newCallFrameReturnValue; 1207 1207 1208 loadVarargs(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand);1208 setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand); 1209 1209 LLINT_CALL_CHECK_EXCEPTION(exec, exec); 1210 1210 -
trunk/Source/JavaScriptCore/runtime/Arguments.cpp
r178928 r179862 2 2 * Copyright (C) 1999-2002 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2015 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) 6 6 * Copyright (C) 2007 Maks Orlovich … … 88 88 static EncodedJSValue JSC_HOST_CALL argumentsFuncIterator(ExecState*); 89 89 90 void Arguments::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t copyLength, int32_t firstVarArgOffset)90 void Arguments::copyToArguments(ExecState* exec, VirtualRegister firstElementDest, uint32_t copyLength, int32_t firstVarArgOffset) 91 91 { 92 92 uint32_t length = copyLength + firstVarArgOffset; … … 95 95 length = min(get(exec, exec->propertyNames().length).toUInt32(exec), length); 96 96 for (unsigned i = firstVarArgOffset; i < length; i++) 97 callFrame->setArgument(i, get(exec, i));97 exec->r(firstElementDest + i - firstVarArgOffset) = get(exec, i); 98 98 return; 99 99 } … … 101 101 for (size_t i = firstVarArgOffset; i < length; ++i) { 102 102 if (JSValue value = tryGetArgument(i)) 103 callFrame->setArgument(i - firstVarArgOffset, value); 104 else 105 callFrame->setArgument(i - firstVarArgOffset, get(exec, i)); 103 exec->r(firstElementDest + i - firstVarArgOffset) = value; 104 else { 105 exec->r(firstElementDest + i - firstVarArgOffset) = get(exec, i); 106 if (UNLIKELY(exec->vm().exception())) 107 return; 108 } 106 109 } 107 110 } -
trunk/Source/JavaScriptCore/runtime/Arguments.h
r178517 r179862 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2014 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2014, 2015 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) 5 5 * Copyright (C) 2007 Maks Orlovich … … 85 85 } 86 86 87 void copyToArguments(ExecState*, CallFrame*, uint32_t copyLength, int32_t firstArgumentOffset);87 void copyToArguments(ExecState*, VirtualRegister firstElementDest, uint32_t copyLength, int32_t firstArgumentOffset); 88 88 void tearOff(CallFrame*); 89 89 void tearOff(CallFrame*, InlineCallFrame*); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r178928 r179862 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2007, 2008, 2009, 2012, 2013 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2007, 2008, 2009, 2012, 2013, 2015 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2003 Peter Kelly (pmk@post.com) 5 5 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) … … 1571 1571 } 1572 1572 1573 void JSArray::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t copyLength, int32_t firstVarArgOffset)1573 void JSArray::copyToArguments(ExecState* exec, VirtualRegister firstElementDest, uint32_t copyLength, int32_t firstVarArgOffset) 1574 1574 { 1575 1575 unsigned i = firstVarArgOffset; … … 1603 1603 if (v != v) 1604 1604 break; 1605 callFrame->setArgument(i - firstVarArgOffset, JSValue(JSValue::EncodeAsDouble, v));1605 exec->r(firstElementDest + i - firstVarArgOffset) = JSValue(JSValue::EncodeAsDouble, v); 1606 1606 } 1607 1607 break; … … 1628 1628 if (!v) 1629 1629 break; 1630 callFrame->setArgument(i - firstVarArgOffset, v.get()); 1631 } 1632 1633 for (; i < length; ++i) 1634 callFrame->setArgument(i - firstVarArgOffset, get(exec, i)); 1630 exec->r(firstElementDest + i - firstVarArgOffset) = v.get(); 1631 } 1632 1633 for (; i < length; ++i) { 1634 exec->r(firstElementDest + i - firstVarArgOffset) = get(exec, i); 1635 if (UNLIKELY(exec->vm().exception())) 1636 return; 1637 } 1635 1638 } 1636 1639 -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r175365 r179862 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2007, 2008, 2009, 2012, 2015 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 133 133 134 134 JS_EXPORT_PRIVATE void fillArgList(ExecState*, MarkedArgumentBuffer&); 135 JS_EXPORT_PRIVATE void copyToArguments(ExecState*, CallFrame*, uint32_t length, int32_t firstVarArgOffset);135 JS_EXPORT_PRIVATE void copyToArguments(ExecState*, VirtualRegister firstElementDest, uint32_t length, int32_t firstVarArgOffset); 136 136 137 137 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype, IndexingType indexingType)
Note:
See TracChangeset
for help on using the changeset viewer.