| 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 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5009 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 5009 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
| 5010 } else { | 5010 } else { |
| 5011 UNREACHABLE(); | 5011 UNREACHABLE(); |
| 5012 } | 5012 } |
| 5013 } | 5013 } |
| 5014 | 5014 |
| 5015 | 5015 |
| 5016 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5016 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| 5017 ASM_LOCATION("ArrayConstructorStub::Generate"); | 5017 ASM_LOCATION("ArrayConstructorStub::Generate"); |
| 5018 // ----------- S t a t e ------------- | 5018 // ----------- S t a t e ------------- |
| 5019 // -- x0 : argc (only if argument_count() == ANY) | 5019 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
| 5020 // -- x1 : constructor | 5020 // -- x1 : constructor |
| 5021 // -- x2 : AllocationSite or undefined | 5021 // -- x2 : AllocationSite or undefined |
| 5022 // -- x3 : original constructor | 5022 // -- x3 : original constructor |
| 5023 // -- sp[0] : return address | 5023 // -- sp[0] : last argument |
| 5024 // -- sp[4] : last argument | |
| 5025 // ----------------------------------- | 5024 // ----------------------------------- |
| 5026 Register constructor = x1; | 5025 Register constructor = x1; |
| 5027 Register allocation_site = x2; | 5026 Register allocation_site = x2; |
| 5028 Register original_constructor = x3; | 5027 Register original_constructor = x3; |
| 5029 | 5028 |
| 5030 if (FLAG_debug_code) { | 5029 if (FLAG_debug_code) { |
| 5031 // The array construct code is only set for the global and natives | 5030 // The array construct code is only set for the global and natives |
| 5032 // builtin Array functions which always have maps. | 5031 // builtin Array functions which always have maps. |
| 5033 | 5032 |
| 5034 Label unexpected_map, map_ok; | 5033 Label unexpected_map, map_ok; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5058 | 5057 |
| 5059 __ Ldrsw(kind, | 5058 __ Ldrsw(kind, |
| 5060 UntagSmiFieldMemOperand(allocation_site, | 5059 UntagSmiFieldMemOperand(allocation_site, |
| 5061 AllocationSite::kTransitionInfoOffset)); | 5060 AllocationSite::kTransitionInfoOffset)); |
| 5062 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); | 5061 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); |
| 5063 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5062 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 5064 | 5063 |
| 5065 __ Bind(&no_info); | 5064 __ Bind(&no_info); |
| 5066 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5065 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5067 | 5066 |
| 5067 // Subclassing support. |
| 5068 __ Bind(&subclassing); | 5068 __ Bind(&subclassing); |
| 5069 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); | 5069 __ Push(constructor, original_constructor); |
| 5070 // Adjust argc. |
| 5071 switch (argument_count()) { |
| 5072 case ANY: |
| 5073 case MORE_THAN_ONE: |
| 5074 __ add(x0, x0, Operand(2)); |
| 5075 break; |
| 5076 case NONE: |
| 5077 __ Mov(x0, Operand(2)); |
| 5078 break; |
| 5079 case ONE: |
| 5080 __ Mov(x0, Operand(3)); |
| 5081 break; |
| 5082 } |
| 5083 __ JumpToExternalReference( |
| 5084 ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate())); |
| 5070 } | 5085 } |
| 5071 | 5086 |
| 5072 | 5087 |
| 5073 void InternalArrayConstructorStub::GenerateCase( | 5088 void InternalArrayConstructorStub::GenerateCase( |
| 5074 MacroAssembler* masm, ElementsKind kind) { | 5089 MacroAssembler* masm, ElementsKind kind) { |
| 5075 Label zero_case, n_case; | 5090 Label zero_case, n_case; |
| 5076 Register argc = x0; | 5091 Register argc = x0; |
| 5077 | 5092 |
| 5078 __ Cbz(argc, &zero_case); | 5093 __ Cbz(argc, &zero_case); |
| 5079 __ CompareAndBranch(argc, 1, ne, &n_case); | 5094 __ CompareAndBranch(argc, 1, ne, &n_case); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 kStackUnwindSpace, NULL, spill_offset, | 5518 kStackUnwindSpace, NULL, spill_offset, |
| 5504 MemOperand(fp, 6 * kPointerSize), NULL); | 5519 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5505 } | 5520 } |
| 5506 | 5521 |
| 5507 | 5522 |
| 5508 #undef __ | 5523 #undef __ |
| 5509 | 5524 |
| 5510 } } // namespace v8::internal | 5525 } } // namespace v8::internal |
| 5511 | 5526 |
| 5512 #endif // V8_TARGET_ARCH_ARM64 | 5527 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |