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

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

Issue 962263002: Disallow subclassing Arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes for debug-code issues 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
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); 2801 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
2802 __ Addu(at, a2, Operand(at)); 2802 __ Addu(at, a2, Operand(at));
2803 __ lw(t0, FieldMemOperand(at, FixedArray::kHeaderSize)); 2803 __ lw(t0, FieldMemOperand(at, FixedArray::kHeaderSize));
2804 2804
2805 // Verify that t0 contains an AllocationSite 2805 // Verify that t0 contains an AllocationSite
2806 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset)); 2806 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset));
2807 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2807 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
2808 __ Branch(&miss, ne, t1, Operand(at)); 2808 __ Branch(&miss, ne, t1, Operand(at));
2809 2809
2810 __ mov(a2, t0); 2810 __ mov(a2, t0);
2811 __ mov(a3, a1);
2811 ArrayConstructorStub stub(masm->isolate(), arg_count()); 2812 ArrayConstructorStub stub(masm->isolate(), arg_count());
2812 __ TailCallStub(&stub); 2813 __ TailCallStub(&stub);
2813 2814
2814 __ bind(&miss); 2815 __ bind(&miss);
2815 GenerateMiss(masm); 2816 GenerateMiss(masm);
2816 2817
2817 // The slow case, we need this no matter what to complete a call after a miss. 2818 // The slow case, we need this no matter what to complete a call after a miss.
2818 CallFunctionNoFeedback(masm, 2819 CallFunctionNoFeedback(masm,
2819 arg_count(), 2820 arg_count(),
2820 true, 2821 true,
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 UNREACHABLE(); 4793 UNREACHABLE();
4793 } 4794 }
4794 } 4795 }
4795 4796
4796 4797
4797 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4798 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4798 // ----------- S t a t e ------------- 4799 // ----------- S t a t e -------------
4799 // -- a0 : argc (only if argument_count() == ANY) 4800 // -- a0 : argc (only if argument_count() == ANY)
4800 // -- a1 : constructor 4801 // -- a1 : constructor
4801 // -- a2 : AllocationSite or undefined 4802 // -- a2 : AllocationSite or undefined
4803 // -- a3 : Original constructor
4802 // -- sp[0] : return address 4804 // -- sp[0] : return address
4803 // -- sp[4] : last argument 4805 // -- sp[4] : last argument
4804 // ----------------------------------- 4806 // -----------------------------------
4805 4807
4806 if (FLAG_debug_code) { 4808 if (FLAG_debug_code) {
4807 // The array construct code is only set for the global and natives 4809 // The array construct code is only set for the global and natives
4808 // builtin Array functions which always have maps. 4810 // builtin Array functions which always have maps.
4809 4811
4810 // Initial map for the builtin Array function should be a map. 4812 // Initial map for the builtin Array function should be a map.
4811 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 4813 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
4812 // Will both indicate a NULL and a Smi. 4814 // Will both indicate a NULL and a Smi.
4813 __ SmiTst(t0, at); 4815 __ SmiTst(t0, at);
4814 __ Assert(ne, kUnexpectedInitialMapForArrayFunction, 4816 __ Assert(ne, kUnexpectedInitialMapForArrayFunction,
4815 at, Operand(zero_reg)); 4817 at, Operand(zero_reg));
4816 __ GetObjectType(t0, t0, t1); 4818 __ GetObjectType(t0, t0, t1);
4817 __ Assert(eq, kUnexpectedInitialMapForArrayFunction, 4819 __ Assert(eq, kUnexpectedInitialMapForArrayFunction,
4818 t1, Operand(MAP_TYPE)); 4820 t1, Operand(MAP_TYPE));
4819 4821
4820 // We should either have undefined in a2 or a valid AllocationSite 4822 // We should either have undefined in a2 or a valid AllocationSite
4821 __ AssertUndefinedOrAllocationSite(a2, t0); 4823 __ AssertUndefinedOrAllocationSite(a2, t0);
4822 } 4824 }
4823 4825
4826 Label subclassing;
4827 __ Branch(&subclassing, ne, a1, Operand(a3));
4828
4824 Label no_info; 4829 Label no_info;
4825 // Get the elements kind and case on that. 4830 // Get the elements kind and case on that.
4826 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 4831 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
4827 __ Branch(&no_info, eq, a2, Operand(at)); 4832 __ Branch(&no_info, eq, a2, Operand(at));
4828 4833
4829 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); 4834 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
4830 __ SmiUntag(a3); 4835 __ SmiUntag(a3);
4831 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 4836 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
4832 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); 4837 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask));
4833 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 4838 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
4834 4839
4835 __ bind(&no_info); 4840 __ bind(&no_info);
4836 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 4841 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
4842
4843 __ bind(&subclassing);
4844 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
4837 } 4845 }
4838 4846
4839 4847
4840 void InternalArrayConstructorStub::GenerateCase( 4848 void InternalArrayConstructorStub::GenerateCase(
4841 MacroAssembler* masm, ElementsKind kind) { 4849 MacroAssembler* masm, ElementsKind kind) {
4842 4850
4843 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); 4851 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
4844 __ TailCallStub(&stub0, lo, a0, Operand(1)); 4852 __ TailCallStub(&stub0, lo, a0, Operand(1));
4845 4853
4846 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); 4854 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
5214 kStackUnwindSpace, kInvalidStackOffset, 5222 kStackUnwindSpace, kInvalidStackOffset,
5215 MemOperand(fp, 6 * kPointerSize), NULL); 5223 MemOperand(fp, 6 * kPointerSize), NULL);
5216 } 5224 }
5217 5225
5218 5226
5219 #undef __ 5227 #undef __
5220 5228
5221 } } // namespace v8::internal 5229 } } // namespace v8::internal
5222 5230
5223 #endif // V8_TARGET_ARCH_MIPS 5231 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698