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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 __ JumpIfSmi(x0, &done); | 2802 __ JumpIfSmi(x0, &done); |
2803 // If the object is not a value type, return the object. | 2803 // If the object is not a value type, return the object. |
2804 __ JumpIfNotObjectType(x0, x10, x11, JS_VALUE_TYPE, &done); | 2804 __ JumpIfNotObjectType(x0, x10, x11, JS_VALUE_TYPE, &done); |
2805 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset)); | 2805 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset)); |
2806 | 2806 |
2807 __ Bind(&done); | 2807 __ Bind(&done); |
2808 context()->Plug(x0); | 2808 context()->Plug(x0); |
2809 } | 2809 } |
2810 | 2810 |
2811 | 2811 |
2812 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | |
2813 ZoneList<Expression*>* args = expr->arguments(); | |
2814 DCHECK_EQ(3, args->length()); | |
2815 | |
2816 Register string = x0; | |
2817 Register index = x1; | |
2818 Register value = x2; | |
2819 Register scratch = x10; | |
2820 | |
2821 VisitForStackValue(args->at(0)); // index | |
2822 VisitForStackValue(args->at(1)); // value | |
2823 VisitForAccumulatorValue(args->at(2)); // string | |
2824 PopOperands(value, index); | |
2825 | |
2826 if (FLAG_debug_code) { | |
2827 __ AssertSmi(value, kNonSmiValue); | |
2828 __ AssertSmi(index, kNonSmiIndex); | |
2829 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
2830 __ EmitSeqStringSetCharCheck(string, index, kIndexIsSmi, scratch, | |
2831 one_byte_seq_type); | |
2832 } | |
2833 | |
2834 __ Add(scratch, string, SeqOneByteString::kHeaderSize - kHeapObjectTag); | |
2835 __ SmiUntag(value); | |
2836 __ SmiUntag(index); | |
2837 __ Strb(value, MemOperand(scratch, index)); | |
2838 context()->Plug(string); | |
2839 } | |
2840 | |
2841 | |
2842 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | |
2843 ZoneList<Expression*>* args = expr->arguments(); | |
2844 DCHECK_EQ(3, args->length()); | |
2845 | |
2846 Register string = x0; | |
2847 Register index = x1; | |
2848 Register value = x2; | |
2849 Register scratch = x10; | |
2850 | |
2851 VisitForStackValue(args->at(0)); // index | |
2852 VisitForStackValue(args->at(1)); // value | |
2853 VisitForAccumulatorValue(args->at(2)); // string | |
2854 PopOperands(value, index); | |
2855 | |
2856 if (FLAG_debug_code) { | |
2857 __ AssertSmi(value, kNonSmiValue); | |
2858 __ AssertSmi(index, kNonSmiIndex); | |
2859 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
2860 __ EmitSeqStringSetCharCheck(string, index, kIndexIsSmi, scratch, | |
2861 two_byte_seq_type); | |
2862 } | |
2863 | |
2864 __ Add(scratch, string, SeqTwoByteString::kHeaderSize - kHeapObjectTag); | |
2865 __ SmiUntag(value); | |
2866 __ SmiUntag(index); | |
2867 __ Strh(value, MemOperand(scratch, index, LSL, 1)); | |
2868 context()->Plug(string); | |
2869 } | |
2870 | |
2871 | |
2872 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { | 2812 void FullCodeGenerator::EmitStringCharFromCode(CallRuntime* expr) { |
2873 ZoneList<Expression*>* args = expr->arguments(); | 2813 ZoneList<Expression*>* args = expr->arguments(); |
2874 DCHECK(args->length() == 1); | 2814 DCHECK(args->length() == 1); |
2875 | 2815 |
2876 VisitForAccumulatorValue(args->at(0)); | 2816 VisitForAccumulatorValue(args->at(0)); |
2877 | 2817 |
2878 Label done; | 2818 Label done; |
2879 Register code = x0; | 2819 Register code = x0; |
2880 Register result = x1; | 2820 Register result = x1; |
2881 | 2821 |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3956 } | 3896 } |
3957 | 3897 |
3958 return INTERRUPT; | 3898 return INTERRUPT; |
3959 } | 3899 } |
3960 | 3900 |
3961 | 3901 |
3962 } // namespace internal | 3902 } // namespace internal |
3963 } // namespace v8 | 3903 } // namespace v8 |
3964 | 3904 |
3965 #endif // V8_TARGET_ARCH_ARM64 | 3905 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |