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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1165 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); |
1166 | 1166 |
1167 Generate_CheckStackOverflow(masm, kFunctionOffset, kEaxIsSmiTagged); | 1167 Generate_CheckStackOverflow(masm, kFunctionOffset, kEaxIsSmiTagged); |
1168 | 1168 |
1169 // Push current index and limit. | 1169 // Push current index and limit. |
1170 const int kLimitOffset = | 1170 const int kLimitOffset = |
1171 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; | 1171 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; |
1172 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; | 1172 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; |
1173 __ Push(eax); // limit | 1173 __ Push(eax); // limit |
1174 __ push(Immediate(0)); // index | 1174 __ push(Immediate(0)); // index |
1175 // Push newTarget and callee functions | 1175 // Push the constructor function as callee. |
1176 __ push(Operand(ebp, kNewTargetOffset)); | |
1177 __ push(Operand(ebp, kFunctionOffset)); | 1176 __ push(Operand(ebp, kFunctionOffset)); |
1178 | 1177 |
1179 // Loop over the arguments array, pushing each value to the stack | 1178 // Loop over the arguments array, pushing each value to the stack |
1180 Generate_PushAppliedArguments( | 1179 Generate_PushAppliedArguments( |
1181 masm, kArgumentsOffset, kIndexOffset, kLimitOffset); | 1180 masm, kArgumentsOffset, kIndexOffset, kLimitOffset); |
1182 | 1181 |
1183 // Use undefined feedback vector | 1182 // Use undefined feedback vector |
1184 __ LoadRoot(ebx, Heap::kUndefinedValueRootIndex); | 1183 __ LoadRoot(ebx, Heap::kUndefinedValueRootIndex); |
1185 __ mov(edi, Operand(ebp, kFunctionOffset)); | 1184 __ mov(edi, Operand(ebp, kFunctionOffset)); |
| 1185 __ mov(ecx, Operand(ebp, kNewTargetOffset)); |
1186 | 1186 |
1187 // Call the function. | 1187 // Call the function. |
1188 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1188 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); |
1189 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1189 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
1190 | 1190 |
1191 __ Drop(1); | |
1192 | |
1193 // Leave internal frame. | 1191 // Leave internal frame. |
1194 } | 1192 } |
1195 // remove this, target, arguments, and newTarget | 1193 // remove this, target, arguments, and newTarget |
1196 __ ret(kStackSize * kPointerSize); | 1194 __ ret(kStackSize * kPointerSize); |
1197 } | 1195 } |
1198 | 1196 |
1199 | 1197 |
1200 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1198 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1201 Generate_ApplyHelper(masm, false); | 1199 Generate_ApplyHelper(masm, false); |
1202 } | 1200 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 | 1627 |
1630 __ bind(&ok); | 1628 __ bind(&ok); |
1631 __ ret(0); | 1629 __ ret(0); |
1632 } | 1630 } |
1633 | 1631 |
1634 #undef __ | 1632 #undef __ |
1635 } // namespace internal | 1633 } // namespace internal |
1636 } // namespace v8 | 1634 } // namespace v8 |
1637 | 1635 |
1638 #endif // V8_TARGET_ARCH_IA32 | 1636 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |