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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4639 } else if (argument_count() == MORE_THAN_ONE) { | 4639 } else if (argument_count() == MORE_THAN_ONE) { |
4640 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4640 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
4641 } else { | 4641 } else { |
4642 UNREACHABLE(); | 4642 UNREACHABLE(); |
4643 } | 4643 } |
4644 } | 4644 } |
4645 | 4645 |
4646 | 4646 |
4647 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4647 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4648 // ----------- S t a t e ------------- | 4648 // ----------- S t a t e ------------- |
4649 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 4649 // -- eax : argc (only if argument_count() == ANY) |
4650 // -- ebx : AllocationSite or undefined | 4650 // -- ebx : AllocationSite or undefined |
4651 // -- edi : constructor | 4651 // -- edi : constructor |
4652 // -- edx : Original constructor | 4652 // -- edx : Original constructor |
4653 // -- esp[0] : return address | 4653 // -- esp[0] : return address |
4654 // -- esp[4] : last argument | 4654 // -- esp[4] : last argument |
4655 // ----------------------------------- | 4655 // ----------------------------------- |
4656 if (FLAG_debug_code) { | 4656 if (FLAG_debug_code) { |
4657 // The array construct code is only set for the global and natives | 4657 // The array construct code is only set for the global and natives |
4658 // builtin Array functions which always have maps. | 4658 // builtin Array functions which always have maps. |
4659 | 4659 |
(...skipping 13 matching lines...) Expand all Loading... |
4673 | 4673 |
4674 __ cmp(edx, edi); | 4674 __ cmp(edx, edi); |
4675 __ j(not_equal, &subclassing); | 4675 __ j(not_equal, &subclassing); |
4676 | 4676 |
4677 Label no_info; | 4677 Label no_info; |
4678 // If the feedback vector is the undefined value call an array constructor | 4678 // If the feedback vector is the undefined value call an array constructor |
4679 // that doesn't use AllocationSites. | 4679 // that doesn't use AllocationSites. |
4680 __ cmp(ebx, isolate()->factory()->undefined_value()); | 4680 __ cmp(ebx, isolate()->factory()->undefined_value()); |
4681 __ j(equal, &no_info); | 4681 __ j(equal, &no_info); |
4682 | 4682 |
| 4683 __ cmp(edx, edi); |
| 4684 __ j(not_equal, &subclassing); |
| 4685 |
4683 // Only look at the lower 16 bits of the transition info. | 4686 // Only look at the lower 16 bits of the transition info. |
4684 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); | 4687 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); |
4685 __ SmiUntag(edx); | 4688 __ SmiUntag(edx); |
4686 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 4689 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
4687 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); | 4690 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
4688 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 4691 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
4689 | 4692 |
4690 __ bind(&no_info); | 4693 __ bind(&no_info); |
4691 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 4694 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
4692 | 4695 |
4693 // Subclassing. | |
4694 __ bind(&subclassing); | 4696 __ bind(&subclassing); |
4695 __ pop(ecx); // return address. | 4697 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); |
4696 __ push(edi); | |
4697 __ push(edx); | |
4698 | |
4699 // Adjust argc. | |
4700 switch (argument_count()) { | |
4701 case ANY: | |
4702 case MORE_THAN_ONE: | |
4703 __ add(eax, Immediate(2)); | |
4704 break; | |
4705 case NONE: | |
4706 __ mov(eax, Immediate(2)); | |
4707 break; | |
4708 case ONE: | |
4709 __ mov(eax, Immediate(3)); | |
4710 break; | |
4711 } | |
4712 | |
4713 __ push(ecx); | |
4714 __ JumpToExternalReference( | |
4715 ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate())); | |
4716 } | 4698 } |
4717 | 4699 |
4718 | 4700 |
4719 void InternalArrayConstructorStub::GenerateCase( | 4701 void InternalArrayConstructorStub::GenerateCase( |
4720 MacroAssembler* masm, ElementsKind kind) { | 4702 MacroAssembler* masm, ElementsKind kind) { |
4721 Label not_zero_case, not_one_case; | 4703 Label not_zero_case, not_one_case; |
4722 Label normal_sequence; | 4704 Label normal_sequence; |
4723 | 4705 |
4724 __ test(eax, eax); | 4706 __ test(eax, eax); |
4725 __ j(not_zero, ¬_zero_case); | 4707 __ j(not_zero, ¬_zero_case); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5187 ApiParameterOperand(2), kStackSpace, nullptr, | 5169 ApiParameterOperand(2), kStackSpace, nullptr, |
5188 Operand(ebp, 7 * kPointerSize), NULL); | 5170 Operand(ebp, 7 * kPointerSize), NULL); |
5189 } | 5171 } |
5190 | 5172 |
5191 | 5173 |
5192 #undef __ | 5174 #undef __ |
5193 | 5175 |
5194 } } // namespace v8::internal | 5176 } } // namespace v8::internal |
5195 | 5177 |
5196 #endif // V8_TARGET_ARCH_IA32 | 5178 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |