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