Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 975463002: Implement subclassing Arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm again Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() == ANY) 4649 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE)
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
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
4686 // Only look at the lower 16 bits of the transition info. 4683 // Only look at the lower 16 bits of the transition info.
4687 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset)); 4684 __ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset));
4688 __ SmiUntag(edx); 4685 __ SmiUntag(edx);
4689 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 4686 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
4690 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); 4687 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask));
4691 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 4688 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
4692 4689
4693 __ bind(&no_info); 4690 __ bind(&no_info);
4694 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 4691 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
4695 4692
4693 // Subclassing.
4696 __ bind(&subclassing); 4694 __ bind(&subclassing);
4697 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); 4695 __ pop(ecx); // return address.
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()));
4698 } 4716 }
4699 4717
4700 4718
4701 void InternalArrayConstructorStub::GenerateCase( 4719 void InternalArrayConstructorStub::GenerateCase(
4702 MacroAssembler* masm, ElementsKind kind) { 4720 MacroAssembler* masm, ElementsKind kind) {
4703 Label not_zero_case, not_one_case; 4721 Label not_zero_case, not_one_case;
4704 Label normal_sequence; 4722 Label normal_sequence;
4705 4723
4706 __ test(eax, eax); 4724 __ test(eax, eax);
4707 __ j(not_zero, &not_zero_case); 4725 __ j(not_zero, &not_zero_case);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
5169 ApiParameterOperand(2), kStackSpace, nullptr, 5187 ApiParameterOperand(2), kStackSpace, nullptr,
5170 Operand(ebp, 7 * kPointerSize), NULL); 5188 Operand(ebp, 7 * kPointerSize), NULL);
5171 } 5189 }
5172 5190
5173 5191
5174 #undef __ 5192 #undef __
5175 5193
5176 } } // namespace v8::internal 5194 } } // namespace v8::internal
5177 5195
5178 #endif // V8_TARGET_ARCH_IA32 5196 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698