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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 // Compute the entry point of the rewritten stub. | 2666 // Compute the entry point of the rewritten stub. |
2667 __ Add(stub_entry, x0, Code::kHeaderSize - kHeapObjectTag); | 2667 __ Add(stub_entry, x0, Code::kHeaderSize - kHeapObjectTag); |
2668 // Restore caller-saved registers. | 2668 // Restore caller-saved registers. |
2669 __ Pop(lr, x0, x1); | 2669 __ Pop(lr, x0, x1); |
2670 } | 2670 } |
2671 | 2671 |
2672 // Tail-call to the new stub. | 2672 // Tail-call to the new stub. |
2673 __ Jump(stub_entry); | 2673 __ Jump(stub_entry); |
2674 } | 2674 } |
2675 | 2675 |
2676 void ToStringStub::Generate(MacroAssembler* masm) { | |
2677 // The ToString stub takes one argument in x0. | |
2678 Label is_number; | |
2679 __ JumpIfSmi(x0, &is_number); | |
2680 | |
2681 Label not_string; | |
2682 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, ¬_string, hs); | |
2683 // x0: receiver | |
2684 // x1: receiver instance type | |
2685 __ Ret(); | |
2686 __ Bind(¬_string); | |
2687 | |
2688 Label not_heap_number; | |
2689 __ Cmp(x1, HEAP_NUMBER_TYPE); | |
2690 __ B(ne, ¬_heap_number); | |
2691 __ Bind(&is_number); | |
2692 NumberToStringStub stub(isolate()); | |
2693 __ TailCallStub(&stub); | |
2694 __ Bind(¬_heap_number); | |
2695 | |
2696 Label not_oddball; | |
2697 __ Cmp(x1, ODDBALL_TYPE); | |
2698 __ B(ne, ¬_oddball); | |
2699 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToStringOffset)); | |
2700 __ Ret(); | |
2701 __ Bind(¬_oddball); | |
2702 | |
2703 __ Push(x0); // Push argument. | |
2704 __ TailCallRuntime(Runtime::kToString); | |
2705 } | |
2706 | |
2707 | 2676 |
2708 void StringHelper::GenerateFlatOneByteStringEquals( | 2677 void StringHelper::GenerateFlatOneByteStringEquals( |
2709 MacroAssembler* masm, Register left, Register right, Register scratch1, | 2678 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2710 Register scratch2, Register scratch3) { | 2679 Register scratch2, Register scratch3) { |
2711 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); | 2680 DCHECK(!AreAliased(left, right, scratch1, scratch2, scratch3)); |
2712 Register result = x0; | 2681 Register result = x0; |
2713 Register left_length = scratch1; | 2682 Register left_length = scratch1; |
2714 Register right_length = scratch2; | 2683 Register right_length = scratch2; |
2715 | 2684 |
2716 // Compare lengths. If lengths differ, strings can't be equal. Lengths are | 2685 // Compare lengths. If lengths differ, strings can't be equal. Lengths are |
(...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5274 kStackUnwindSpace, NULL, spill_offset, | 5243 kStackUnwindSpace, NULL, spill_offset, |
5275 return_value_operand, NULL); | 5244 return_value_operand, NULL); |
5276 } | 5245 } |
5277 | 5246 |
5278 #undef __ | 5247 #undef __ |
5279 | 5248 |
5280 } // namespace internal | 5249 } // namespace internal |
5281 } // namespace v8 | 5250 } // namespace v8 |
5282 | 5251 |
5283 #endif // V8_TARGET_ARCH_ARM64 | 5252 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |