OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1229 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); |
1230 | 1230 |
1231 Generate_CheckStackOverflow(masm, kFunctionOffset, kRaxIsSmiTagged); | 1231 Generate_CheckStackOverflow(masm, kFunctionOffset, kRaxIsSmiTagged); |
1232 | 1232 |
1233 // Push current index and limit. | 1233 // Push current index and limit. |
1234 const int kLimitOffset = | 1234 const int kLimitOffset = |
1235 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; | 1235 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; |
1236 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; | 1236 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; |
1237 __ Push(rax); // limit | 1237 __ Push(rax); // limit |
1238 __ Push(Immediate(0)); // index | 1238 __ Push(Immediate(0)); // index |
1239 // Push newTarget and callee functions | 1239 // Push the constructor function as callee. |
1240 __ Push(Operand(rbp, kNewTargetOffset)); | |
1241 __ Push(Operand(rbp, kFunctionOffset)); | 1240 __ Push(Operand(rbp, kFunctionOffset)); |
1242 | 1241 |
1243 // Loop over the arguments array, pushing each value to the stack | 1242 // Loop over the arguments array, pushing each value to the stack |
1244 Generate_PushAppliedArguments( | 1243 Generate_PushAppliedArguments( |
1245 masm, kArgumentsOffset, kIndexOffset, kLimitOffset); | 1244 masm, kArgumentsOffset, kIndexOffset, kLimitOffset); |
1246 | 1245 |
1247 // Use undefined feedback vector | 1246 // Use undefined feedback vector |
1248 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); | 1247 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); |
1249 __ movp(rdi, Operand(rbp, kFunctionOffset)); | 1248 __ movp(rdi, Operand(rbp, kFunctionOffset)); |
| 1249 __ movp(rcx, Operand(rbp, kNewTargetOffset)); |
1250 | 1250 |
1251 // Call the function. | 1251 // Call the function. |
1252 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1252 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); |
1253 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1253 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
1254 | 1254 |
1255 __ Drop(1); | |
1256 | |
1257 // Leave internal frame. | 1255 // Leave internal frame. |
1258 } | 1256 } |
1259 // remove this, target, arguments and newTarget | 1257 // remove this, target, arguments and newTarget |
1260 __ ret(kStackSize * kPointerSize); | 1258 __ ret(kStackSize * kPointerSize); |
1261 } | 1259 } |
1262 | 1260 |
1263 | 1261 |
1264 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1262 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1265 Generate_ApplyHelper(masm, false); | 1263 Generate_ApplyHelper(masm, false); |
1266 } | 1264 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 __ ret(0); | 1705 __ ret(0); |
1708 } | 1706 } |
1709 | 1707 |
1710 | 1708 |
1711 #undef __ | 1709 #undef __ |
1712 | 1710 |
1713 } // namespace internal | 1711 } // namespace internal |
1714 } // namespace v8 | 1712 } // namespace v8 |
1715 | 1713 |
1716 #endif // V8_TARGET_ARCH_X64 | 1714 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |