Changeset 179862 in webkit for trunk/Source/JavaScriptCore/jit/JITCall.cpp
- Timestamp:
- Feb 9, 2015, 7:27:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.