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 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4999 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4999 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
5000 } else { | 5000 } else { |
5001 UNREACHABLE(); | 5001 UNREACHABLE(); |
5002 } | 5002 } |
5003 } | 5003 } |
5004 | 5004 |
5005 | 5005 |
5006 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5006 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
5007 ASM_LOCATION("ArrayConstructorStub::Generate"); | 5007 ASM_LOCATION("ArrayConstructorStub::Generate"); |
5008 // ----------- S t a t e ------------- | 5008 // ----------- S t a t e ------------- |
5009 // -- x0 : argc (only if argument_count() == ANY) | 5009 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
5010 // -- x1 : constructor | 5010 // -- x1 : constructor |
5011 // -- x2 : AllocationSite or undefined | 5011 // -- x2 : AllocationSite or undefined |
5012 // -- x3 : original constructor | 5012 // -- x3 : original constructor |
5013 // -- sp[0] : return address | 5013 // -- sp[0] : last argument |
5014 // -- sp[4] : last argument | |
5015 // ----------------------------------- | 5014 // ----------------------------------- |
5016 Register constructor = x1; | 5015 Register constructor = x1; |
5017 Register allocation_site = x2; | 5016 Register allocation_site = x2; |
5018 Register original_constructor = x3; | 5017 Register original_constructor = x3; |
5019 | 5018 |
5020 if (FLAG_debug_code) { | 5019 if (FLAG_debug_code) { |
5021 // The array construct code is only set for the global and natives | 5020 // The array construct code is only set for the global and natives |
5022 // builtin Array functions which always have maps. | 5021 // builtin Array functions which always have maps. |
5023 | 5022 |
5024 Label unexpected_map, map_ok; | 5023 Label unexpected_map, map_ok; |
(...skipping 23 matching lines...) Expand all Loading... |
5048 | 5047 |
5049 __ Ldrsw(kind, | 5048 __ Ldrsw(kind, |
5050 UntagSmiFieldMemOperand(allocation_site, | 5049 UntagSmiFieldMemOperand(allocation_site, |
5051 AllocationSite::kTransitionInfoOffset)); | 5050 AllocationSite::kTransitionInfoOffset)); |
5052 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); | 5051 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); |
5053 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5052 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
5054 | 5053 |
5055 __ Bind(&no_info); | 5054 __ Bind(&no_info); |
5056 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5055 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
5057 | 5056 |
| 5057 // Subclassing support. |
5058 __ Bind(&subclassing); | 5058 __ Bind(&subclassing); |
5059 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); | 5059 __ Push(constructor, original_constructor); |
| 5060 // Adjust argc. |
| 5061 switch (argument_count()) { |
| 5062 case ANY: |
| 5063 case MORE_THAN_ONE: |
| 5064 __ add(x0, x0, Operand(2)); |
| 5065 break; |
| 5066 case NONE: |
| 5067 __ Mov(x0, Operand(2)); |
| 5068 break; |
| 5069 case ONE: |
| 5070 __ Mov(x0, Operand(3)); |
| 5071 break; |
| 5072 } |
| 5073 __ JumpToExternalReference( |
| 5074 ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate())); |
5060 } | 5075 } |
5061 | 5076 |
5062 | 5077 |
5063 void InternalArrayConstructorStub::GenerateCase( | 5078 void InternalArrayConstructorStub::GenerateCase( |
5064 MacroAssembler* masm, ElementsKind kind) { | 5079 MacroAssembler* masm, ElementsKind kind) { |
5065 Label zero_case, n_case; | 5080 Label zero_case, n_case; |
5066 Register argc = x0; | 5081 Register argc = x0; |
5067 | 5082 |
5068 __ Cbz(argc, &zero_case); | 5083 __ Cbz(argc, &zero_case); |
5069 __ CompareAndBranch(argc, 1, ne, &n_case); | 5084 __ CompareAndBranch(argc, 1, ne, &n_case); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5493 kStackUnwindSpace, NULL, spill_offset, | 5508 kStackUnwindSpace, NULL, spill_offset, |
5494 MemOperand(fp, 6 * kPointerSize), NULL); | 5509 MemOperand(fp, 6 * kPointerSize), NULL); |
5495 } | 5510 } |
5496 | 5511 |
5497 | 5512 |
5498 #undef __ | 5513 #undef __ |
5499 | 5514 |
5500 } } // namespace v8::internal | 5515 } } // namespace v8::internal |
5501 | 5516 |
5502 #endif // V8_TARGET_ARCH_ARM64 | 5517 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |