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

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

Issue 965053002: Revert of Disallow subclassing Arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/arm64/builtins-arm64.cc ('k') | src/ia32/builtins-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 3064 Operand::UntagSmiAndScale(index, kPointerSizeLog2));
3065 __ Ldr(scratch, FieldMemOperand(scratch, FixedArray::kHeaderSize)); 3065 __ Ldr(scratch, FieldMemOperand(scratch, FixedArray::kHeaderSize));
3066 3066
3067 // Verify that scratch contains an AllocationSite 3067 // Verify that scratch contains an AllocationSite
3068 Register map = x5; 3068 Register map = x5;
3069 __ Ldr(map, FieldMemOperand(scratch, HeapObject::kMapOffset)); 3069 __ Ldr(map, FieldMemOperand(scratch, HeapObject::kMapOffset));
3070 __ JumpIfNotRoot(map, Heap::kAllocationSiteMapRootIndex, &miss); 3070 __ JumpIfNotRoot(map, Heap::kAllocationSiteMapRootIndex, &miss);
3071 3071
3072 Register allocation_site = feedback_vector; 3072 Register allocation_site = feedback_vector;
3073 __ Mov(allocation_site, scratch); 3073 __ Mov(allocation_site, scratch);
3074
3075 Register original_constructor = x3;
3076 __ Mov(original_constructor, function);
3077 ArrayConstructorStub stub(masm->isolate(), arg_count()); 3074 ArrayConstructorStub stub(masm->isolate(), arg_count());
3078 __ TailCallStub(&stub); 3075 __ TailCallStub(&stub);
3079 3076
3080 __ bind(&miss); 3077 __ bind(&miss);
3081 GenerateMiss(masm); 3078 GenerateMiss(masm);
3082 3079
3083 // The slow case, we need this no matter what to complete a call after a miss. 3080 // The slow case, we need this no matter what to complete a call after a miss.
3084 CallFunctionNoFeedback(masm, 3081 CallFunctionNoFeedback(masm,
3085 arg_count(), 3082 arg_count(),
3086 true, 3083 true,
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
5002 } 4999 }
5003 } 5000 }
5004 5001
5005 5002
5006 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 5003 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
5007 ASM_LOCATION("ArrayConstructorStub::Generate"); 5004 ASM_LOCATION("ArrayConstructorStub::Generate");
5008 // ----------- S t a t e ------------- 5005 // ----------- S t a t e -------------
5009 // -- x0 : argc (only if argument_count() == ANY) 5006 // -- x0 : argc (only if argument_count() == ANY)
5010 // -- x1 : constructor 5007 // -- x1 : constructor
5011 // -- x2 : AllocationSite or undefined 5008 // -- x2 : AllocationSite or undefined
5012 // -- x3 : original constructor
5013 // -- sp[0] : return address 5009 // -- sp[0] : return address
5014 // -- sp[4] : last argument 5010 // -- sp[4] : last argument
5015 // ----------------------------------- 5011 // -----------------------------------
5016 Register constructor = x1; 5012 Register constructor = x1;
5017 Register allocation_site = x2; 5013 Register allocation_site = x2;
5018 Register original_constructor = x3;
5019 5014
5020 if (FLAG_debug_code) { 5015 if (FLAG_debug_code) {
5021 // The array construct code is only set for the global and natives 5016 // The array construct code is only set for the global and natives
5022 // builtin Array functions which always have maps. 5017 // builtin Array functions which always have maps.
5023 5018
5024 Label unexpected_map, map_ok; 5019 Label unexpected_map, map_ok;
5025 // Initial map for the builtin Array function should be a map. 5020 // Initial map for the builtin Array function should be a map.
5026 __ Ldr(x10, FieldMemOperand(constructor, 5021 __ Ldr(x10, FieldMemOperand(constructor,
5027 JSFunction::kPrototypeOrInitialMapOffset)); 5022 JSFunction::kPrototypeOrInitialMapOffset));
5028 // Will both indicate a NULL and a Smi. 5023 // Will both indicate a NULL and a Smi.
5029 __ JumpIfSmi(x10, &unexpected_map); 5024 __ JumpIfSmi(x10, &unexpected_map);
5030 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok); 5025 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok);
5031 __ Bind(&unexpected_map); 5026 __ Bind(&unexpected_map);
5032 __ Abort(kUnexpectedInitialMapForArrayFunction); 5027 __ Abort(kUnexpectedInitialMapForArrayFunction);
5033 __ Bind(&map_ok); 5028 __ Bind(&map_ok);
5034 5029
5035 // We should either have undefined in the allocation_site register or a 5030 // We should either have undefined in the allocation_site register or a
5036 // valid AllocationSite. 5031 // valid AllocationSite.
5037 __ AssertUndefinedOrAllocationSite(allocation_site, x10); 5032 __ AssertUndefinedOrAllocationSite(allocation_site, x10);
5038 } 5033 }
5039 5034
5040 Label subclassing;
5041 __ Cmp(original_constructor, constructor);
5042 __ B(ne, &subclassing);
5043
5044 Register kind = x3; 5035 Register kind = x3;
5045 Label no_info; 5036 Label no_info;
5046 // Get the elements kind and case on that. 5037 // Get the elements kind and case on that.
5047 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info); 5038 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info);
5048 5039
5049 __ Ldrsw(kind, 5040 __ Ldrsw(kind,
5050 UntagSmiFieldMemOperand(allocation_site, 5041 UntagSmiFieldMemOperand(allocation_site,
5051 AllocationSite::kTransitionInfoOffset)); 5042 AllocationSite::kTransitionInfoOffset));
5052 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); 5043 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask);
5053 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5044 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5054 5045
5055 __ Bind(&no_info); 5046 __ Bind(&no_info);
5056 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5047 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5057
5058 __ Bind(&subclassing);
5059 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
5060 } 5048 }
5061 5049
5062 5050
5063 void InternalArrayConstructorStub::GenerateCase( 5051 void InternalArrayConstructorStub::GenerateCase(
5064 MacroAssembler* masm, ElementsKind kind) { 5052 MacroAssembler* masm, ElementsKind kind) {
5065 Label zero_case, n_case; 5053 Label zero_case, n_case;
5066 Register argc = x0; 5054 Register argc = x0;
5067 5055
5068 __ Cbz(argc, &zero_case); 5056 __ Cbz(argc, &zero_case);
5069 __ CompareAndBranch(argc, 1, ne, &n_case); 5057 __ CompareAndBranch(argc, 1, ne, &n_case);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
5493 kStackUnwindSpace, NULL, spill_offset, 5481 kStackUnwindSpace, NULL, spill_offset,
5494 MemOperand(fp, 6 * kPointerSize), NULL); 5482 MemOperand(fp, 6 * kPointerSize), NULL);
5495 } 5483 }
5496 5484
5497 5485
5498 #undef __ 5486 #undef __
5499 5487
5500 } } // namespace v8::internal 5488 } } // namespace v8::internal
5501 5489
5502 #endif // V8_TARGET_ARCH_ARM64 5490 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698