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 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 __ SmiTag(from); | 3094 __ SmiTag(from); |
3095 StringCharAtGenerator generator(input_string, from, result_length, x0, | 3095 StringCharAtGenerator generator(input_string, from, result_length, x0, |
3096 &runtime, &runtime, &runtime, | 3096 &runtime, &runtime, &runtime, |
3097 RECEIVER_IS_STRING); | 3097 RECEIVER_IS_STRING); |
3098 generator.GenerateFast(masm); | 3098 generator.GenerateFast(masm); |
3099 __ Drop(3); | 3099 __ Drop(3); |
3100 __ Ret(); | 3100 __ Ret(); |
3101 generator.SkipSlow(masm, &runtime); | 3101 generator.SkipSlow(masm, &runtime); |
3102 } | 3102 } |
3103 | 3103 |
3104 | |
3105 void ToNumberStub::Generate(MacroAssembler* masm) { | |
3106 // The ToNumber stub takes one argument in x0. | |
3107 Label not_smi; | |
3108 __ JumpIfNotSmi(x0, ¬_smi); | |
3109 __ Ret(); | |
3110 __ Bind(¬_smi); | |
3111 | |
3112 Label not_heap_number; | |
3113 __ CompareObjectType(x0, x1, x1, HEAP_NUMBER_TYPE); | |
3114 // x0: receiver | |
3115 // x1: receiver instance type | |
3116 __ B(ne, ¬_heap_number); | |
3117 __ Ret(); | |
3118 __ Bind(¬_heap_number); | |
3119 | |
3120 NonNumberToNumberStub stub(masm->isolate()); | |
3121 __ TailCallStub(&stub); | |
3122 } | |
3123 | |
3124 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { | |
3125 // The NonNumberToNumber stub takes one argument in x0. | |
3126 __ AssertNotNumber(x0); | |
3127 | |
3128 Label not_string; | |
3129 __ CompareObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE); | |
3130 // x0: receiver | |
3131 // x1: receiver instance type | |
3132 __ B(hs, ¬_string); | |
3133 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET); | |
3134 __ Bind(¬_string); | |
3135 | |
3136 Label not_oddball; | |
3137 __ Cmp(x1, ODDBALL_TYPE); | |
3138 __ B(ne, ¬_oddball); | |
3139 __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); | |
3140 __ Ret(); | |
3141 __ Bind(¬_oddball); | |
3142 | |
3143 __ Push(x0); // Push argument. | |
3144 __ TailCallRuntime(Runtime::kToNumber); | |
3145 } | |
3146 | |
3147 void ToStringStub::Generate(MacroAssembler* masm) { | 3104 void ToStringStub::Generate(MacroAssembler* masm) { |
3148 // The ToString stub takes one argument in x0. | 3105 // The ToString stub takes one argument in x0. |
3149 Label is_number; | 3106 Label is_number; |
3150 __ JumpIfSmi(x0, &is_number); | 3107 __ JumpIfSmi(x0, &is_number); |
3151 | 3108 |
3152 Label not_string; | 3109 Label not_string; |
3153 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, ¬_string, hs); | 3110 __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, ¬_string, hs); |
3154 // x0: receiver | 3111 // x0: receiver |
3155 // x1: receiver instance type | 3112 // x1: receiver instance type |
3156 __ Ret(); | 3113 __ Ret(); |
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5822 kStackUnwindSpace, NULL, spill_offset, | 5779 kStackUnwindSpace, NULL, spill_offset, |
5823 return_value_operand, NULL); | 5780 return_value_operand, NULL); |
5824 } | 5781 } |
5825 | 5782 |
5826 #undef __ | 5783 #undef __ |
5827 | 5784 |
5828 } // namespace internal | 5785 } // namespace internal |
5829 } // namespace v8 | 5786 } // namespace v8 |
5830 | 5787 |
5831 #endif // V8_TARGET_ARCH_ARM64 | 5788 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |