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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 401 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
402 Generate_JSConstructStubHelper(masm, true, true); | 402 Generate_JSConstructStubHelper(masm, true, true); |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 406 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
407 Generate_JSConstructStubHelper(masm, false, false); | 407 Generate_JSConstructStubHelper(masm, false, false); |
408 } | 408 } |
409 | 409 |
410 | 410 |
| 411 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
| 412 FrameScope scope(masm, StackFrame::INTERNAL); |
| 413 __ push(edi); |
| 414 __ CallRuntime(Runtime::kThrowConstructedNonConstructable, 1); |
| 415 } |
| 416 |
| 417 |
411 enum IsTagged { kEaxIsSmiTagged, kEaxIsUntaggedInt }; | 418 enum IsTagged { kEaxIsSmiTagged, kEaxIsUntaggedInt }; |
412 | 419 |
413 | 420 |
414 // Clobbers ecx, edx, edi; preserves all other registers. | 421 // Clobbers ecx, edx, edi; preserves all other registers. |
415 static void Generate_CheckStackOverflow(MacroAssembler* masm, | 422 static void Generate_CheckStackOverflow(MacroAssembler* masm, |
416 IsTagged eax_is_tagged) { | 423 IsTagged eax_is_tagged) { |
417 // eax : the number of items to be pushed to the stack | 424 // eax : the number of items to be pushed to the stack |
418 // | 425 // |
419 // Check the stack for overflow. We are not trying to catch | 426 // Check the stack for overflow. We are not trying to catch |
420 // interruptions (e.g. debug break and preemption) here, so the "real stack | 427 // interruptions (e.g. debug break and preemption) here, so the "real stack |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 __ SmiUntag(ebx); | 1541 __ SmiUntag(ebx); |
1535 ParameterCount actual(eax); | 1542 ParameterCount actual(eax); |
1536 ParameterCount expected(ebx); | 1543 ParameterCount expected(ebx); |
1537 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, | 1544 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, |
1538 expected, actual, JUMP_FUNCTION, NullCallWrapper()); | 1545 expected, actual, JUMP_FUNCTION, NullCallWrapper()); |
1539 | 1546 |
1540 // The function is a "classConstructor", need to raise an exception. | 1547 // The function is a "classConstructor", need to raise an exception. |
1541 __ bind(&class_constructor); | 1548 __ bind(&class_constructor); |
1542 { | 1549 { |
1543 FrameScope frame(masm, StackFrame::INTERNAL); | 1550 FrameScope frame(masm, StackFrame::INTERNAL); |
1544 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); | 1551 __ push(edi); |
| 1552 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 1); |
1545 } | 1553 } |
1546 } | 1554 } |
1547 | 1555 |
1548 | 1556 |
1549 // static | 1557 // static |
1550 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { | 1558 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { |
1551 // ----------- S t a t e ------------- | 1559 // ----------- S t a t e ------------- |
1552 // -- eax : the number of arguments (not including the receiver) | 1560 // -- eax : the number of arguments (not including the receiver) |
1553 // -- edi : the target to call (can be any Object). | 1561 // -- edi : the target to call (can be any Object). |
1554 // ----------------------------------- | 1562 // ----------------------------------- |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); | 1669 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); |
1662 // Let the "call_as_constructor_delegate" take care of the rest. | 1670 // Let the "call_as_constructor_delegate" take care of the rest. |
1663 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, edi); | 1671 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, edi); |
1664 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1672 __ Jump(masm->isolate()->builtins()->CallFunction(), |
1665 RelocInfo::CODE_TARGET); | 1673 RelocInfo::CODE_TARGET); |
1666 } | 1674 } |
1667 | 1675 |
1668 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1676 // Called Construct on an Object that doesn't have a [[Construct]] internal |
1669 // method. | 1677 // method. |
1670 __ bind(&non_constructor); | 1678 __ bind(&non_constructor); |
1671 { | 1679 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
1672 FrameScope scope(masm, StackFrame::INTERNAL); | 1680 RelocInfo::CODE_TARGET); |
1673 __ Push(edi); | |
1674 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | |
1675 } | |
1676 } | 1681 } |
1677 | 1682 |
1678 | 1683 |
1679 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1684 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1680 // ----------- S t a t e ------------- | 1685 // ----------- S t a t e ------------- |
1681 // -- eax : actual number of arguments | 1686 // -- eax : actual number of arguments |
1682 // -- ebx : expected number of arguments | 1687 // -- ebx : expected number of arguments |
1683 // -- edx : new target (passed through to callee) | 1688 // -- edx : new target (passed through to callee) |
1684 // -- edi : function (passed through to callee) | 1689 // -- edi : function (passed through to callee) |
1685 // ----------------------------------- | 1690 // ----------------------------------- |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 | 1991 |
1987 __ bind(&ok); | 1992 __ bind(&ok); |
1988 __ ret(0); | 1993 __ ret(0); |
1989 } | 1994 } |
1990 | 1995 |
1991 #undef __ | 1996 #undef __ |
1992 } // namespace internal | 1997 } // namespace internal |
1993 } // namespace v8 | 1998 } // namespace v8 |
1994 | 1999 |
1995 #endif // V8_TARGET_ARCH_IA32 | 2000 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |