OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 3174 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
3175 generator.GenerateFast(masm); | 3175 generator.GenerateFast(masm); |
3176 __ Drop(3); | 3176 __ Drop(3); |
3177 __ Ret(); | 3177 __ Ret(); |
3178 generator.SkipSlow(masm, &runtime); | 3178 generator.SkipSlow(masm, &runtime); |
3179 } | 3179 } |
3180 | 3180 |
3181 | 3181 |
3182 void ToNumberStub::Generate(MacroAssembler* masm) { | 3182 void ToNumberStub::Generate(MacroAssembler* masm) { |
3183 // The ToNumber stub takes one argument in r0. | 3183 // The ToNumber stub takes one argument in r0. |
3184 Label check_heap_number, call_builtin; | 3184 Label not_smi; |
3185 __ JumpIfNotSmi(r0, &check_heap_number); | 3185 __ JumpIfNotSmi(r0, ¬_smi); |
3186 __ Ret(); | 3186 __ Ret(); |
| 3187 __ bind(¬_smi); |
3187 | 3188 |
3188 __ bind(&check_heap_number); | 3189 Label not_heap_number; |
3189 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 3190 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
3190 __ CompareRoot(r1, Heap::kHeapNumberMapRootIndex); | 3191 __ ldrb(r1, FieldMemOperand(r1, Map::kInstanceTypeOffset)); |
3191 __ b(ne, &call_builtin); | 3192 // r0: object |
| 3193 // r1: instance type. |
| 3194 __ cmp(r1, Operand(HEAP_NUMBER_TYPE)); |
| 3195 __ b(ne, ¬_heap_number); |
3192 __ Ret(); | 3196 __ Ret(); |
| 3197 __ bind(¬_heap_number); |
3193 | 3198 |
3194 __ bind(&call_builtin); | 3199 Label not_string, slow_string; |
3195 __ push(r0); | 3200 __ cmp(r1, Operand(FIRST_NONSTRING_TYPE)); |
| 3201 __ b(hs, ¬_string); |
| 3202 // Check if string has a cached array index. |
| 3203 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); |
| 3204 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); |
| 3205 __ b(ne, &slow_string); |
| 3206 __ IndexFromHash(r2, r0); |
| 3207 __ Ret(); |
| 3208 __ bind(&slow_string); |
| 3209 __ push(r0); // Push argument. |
| 3210 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
| 3211 __ bind(¬_string); |
| 3212 |
| 3213 Label not_oddball; |
| 3214 __ cmp(r1, Operand(ODDBALL_TYPE)); |
| 3215 __ b(ne, ¬_oddball); |
| 3216 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); |
| 3217 __ Ret(); |
| 3218 __ bind(¬_oddball); |
| 3219 |
| 3220 __ push(r0); // Push argument. |
3196 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3221 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
3197 } | 3222 } |
3198 | 3223 |
3199 | 3224 |
3200 void StringHelper::GenerateFlatOneByteStringEquals( | 3225 void StringHelper::GenerateFlatOneByteStringEquals( |
3201 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3226 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3202 Register scratch2, Register scratch3) { | 3227 Register scratch2, Register scratch3) { |
3203 Register length = scratch1; | 3228 Register length = scratch1; |
3204 | 3229 |
3205 // Compare lengths. | 3230 // Compare lengths. |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4729 MemOperand(fp, 6 * kPointerSize), | 4754 MemOperand(fp, 6 * kPointerSize), |
4730 NULL); | 4755 NULL); |
4731 } | 4756 } |
4732 | 4757 |
4733 | 4758 |
4734 #undef __ | 4759 #undef __ |
4735 | 4760 |
4736 } } // namespace v8::internal | 4761 } } // namespace v8::internal |
4737 | 4762 |
4738 #endif // V8_TARGET_ARCH_ARM | 4763 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |