OLD | NEW |
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 Loading... |
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); |
3074 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 3077 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
3075 __ TailCallStub(&stub); | 3078 __ TailCallStub(&stub); |
3076 | 3079 |
3077 __ bind(&miss); | 3080 __ bind(&miss); |
3078 GenerateMiss(masm); | 3081 GenerateMiss(masm); |
3079 | 3082 |
3080 // The slow case, we need this no matter what to complete a call after a miss. | 3083 // The slow case, we need this no matter what to complete a call after a miss. |
3081 CallFunctionNoFeedback(masm, | 3084 CallFunctionNoFeedback(masm, |
3082 arg_count(), | 3085 arg_count(), |
3083 true, | 3086 true, |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4999 } | 5002 } |
5000 } | 5003 } |
5001 | 5004 |
5002 | 5005 |
5003 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5006 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
5004 ASM_LOCATION("ArrayConstructorStub::Generate"); | 5007 ASM_LOCATION("ArrayConstructorStub::Generate"); |
5005 // ----------- S t a t e ------------- | 5008 // ----------- S t a t e ------------- |
5006 // -- x0 : argc (only if argument_count() == ANY) | 5009 // -- x0 : argc (only if argument_count() == ANY) |
5007 // -- x1 : constructor | 5010 // -- x1 : constructor |
5008 // -- x2 : AllocationSite or undefined | 5011 // -- x2 : AllocationSite or undefined |
| 5012 // -- x3 : original constructor |
5009 // -- sp[0] : return address | 5013 // -- sp[0] : return address |
5010 // -- sp[4] : last argument | 5014 // -- sp[4] : last argument |
5011 // ----------------------------------- | 5015 // ----------------------------------- |
5012 Register constructor = x1; | 5016 Register constructor = x1; |
5013 Register allocation_site = x2; | 5017 Register allocation_site = x2; |
| 5018 Register original_constructor = x3; |
5014 | 5019 |
5015 if (FLAG_debug_code) { | 5020 if (FLAG_debug_code) { |
5016 // The array construct code is only set for the global and natives | 5021 // The array construct code is only set for the global and natives |
5017 // builtin Array functions which always have maps. | 5022 // builtin Array functions which always have maps. |
5018 | 5023 |
5019 Label unexpected_map, map_ok; | 5024 Label unexpected_map, map_ok; |
5020 // Initial map for the builtin Array function should be a map. | 5025 // Initial map for the builtin Array function should be a map. |
5021 __ Ldr(x10, FieldMemOperand(constructor, | 5026 __ Ldr(x10, FieldMemOperand(constructor, |
5022 JSFunction::kPrototypeOrInitialMapOffset)); | 5027 JSFunction::kPrototypeOrInitialMapOffset)); |
5023 // Will both indicate a NULL and a Smi. | 5028 // Will both indicate a NULL and a Smi. |
5024 __ JumpIfSmi(x10, &unexpected_map); | 5029 __ JumpIfSmi(x10, &unexpected_map); |
5025 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok); | 5030 __ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok); |
5026 __ Bind(&unexpected_map); | 5031 __ Bind(&unexpected_map); |
5027 __ Abort(kUnexpectedInitialMapForArrayFunction); | 5032 __ Abort(kUnexpectedInitialMapForArrayFunction); |
5028 __ Bind(&map_ok); | 5033 __ Bind(&map_ok); |
5029 | 5034 |
5030 // We should either have undefined in the allocation_site register or a | 5035 // We should either have undefined in the allocation_site register or a |
5031 // valid AllocationSite. | 5036 // valid AllocationSite. |
5032 __ AssertUndefinedOrAllocationSite(allocation_site, x10); | 5037 __ AssertUndefinedOrAllocationSite(allocation_site, x10); |
5033 } | 5038 } |
5034 | 5039 |
| 5040 Label subclassing; |
| 5041 __ Cmp(original_constructor, constructor); |
| 5042 __ B(ne, &subclassing); |
| 5043 |
5035 Register kind = x3; | 5044 Register kind = x3; |
5036 Label no_info; | 5045 Label no_info; |
5037 // Get the elements kind and case on that. | 5046 // Get the elements kind and case on that. |
5038 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info); | 5047 __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info); |
5039 | 5048 |
5040 __ Ldrsw(kind, | 5049 __ Ldrsw(kind, |
5041 UntagSmiFieldMemOperand(allocation_site, | 5050 UntagSmiFieldMemOperand(allocation_site, |
5042 AllocationSite::kTransitionInfoOffset)); | 5051 AllocationSite::kTransitionInfoOffset)); |
5043 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); | 5052 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); |
5044 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5053 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
5045 | 5054 |
5046 __ Bind(&no_info); | 5055 __ Bind(&no_info); |
5047 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5056 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5057 |
| 5058 __ Bind(&subclassing); |
| 5059 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); |
5048 } | 5060 } |
5049 | 5061 |
5050 | 5062 |
5051 void InternalArrayConstructorStub::GenerateCase( | 5063 void InternalArrayConstructorStub::GenerateCase( |
5052 MacroAssembler* masm, ElementsKind kind) { | 5064 MacroAssembler* masm, ElementsKind kind) { |
5053 Label zero_case, n_case; | 5065 Label zero_case, n_case; |
5054 Register argc = x0; | 5066 Register argc = x0; |
5055 | 5067 |
5056 __ Cbz(argc, &zero_case); | 5068 __ Cbz(argc, &zero_case); |
5057 __ CompareAndBranch(argc, 1, ne, &n_case); | 5069 __ CompareAndBranch(argc, 1, ne, &n_case); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 kStackUnwindSpace, NULL, spill_offset, | 5493 kStackUnwindSpace, NULL, spill_offset, |
5482 MemOperand(fp, 6 * kPointerSize), NULL); | 5494 MemOperand(fp, 6 * kPointerSize), NULL); |
5483 } | 5495 } |
5484 | 5496 |
5485 | 5497 |
5486 #undef __ | 5498 #undef __ |
5487 | 5499 |
5488 } } // namespace v8::internal | 5500 } } // namespace v8::internal |
5489 | 5501 |
5490 #endif // V8_TARGET_ARCH_ARM64 | 5502 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |