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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 } | 3225 } |
3226 | 3226 |
3227 | 3227 |
3228 void ToNumberStub::Generate(MacroAssembler* masm) { | 3228 void ToNumberStub::Generate(MacroAssembler* masm) { |
3229 // The ToNumber stub takes one argument in r0. | 3229 // The ToNumber stub takes one argument in r0. |
3230 Label not_smi; | 3230 Label not_smi; |
3231 __ JumpIfNotSmi(r0, ¬_smi); | 3231 __ JumpIfNotSmi(r0, ¬_smi); |
3232 __ Ret(); | 3232 __ Ret(); |
3233 __ bind(¬_smi); | 3233 __ bind(¬_smi); |
3234 | 3234 |
3235 Label not_heap_number; | 3235 __ CompareObjectType(r0, r1, r1, HEAP_NUMBER_TYPE); |
3236 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 3236 // r0: receiver |
3237 __ ldrb(r1, FieldMemOperand(r1, Map::kInstanceTypeOffset)); | 3237 // r1: receiver instance type |
3238 // r0: object | 3238 __ Ret(eq); |
3239 // r1: instance type. | |
3240 __ cmp(r1, Operand(HEAP_NUMBER_TYPE)); | |
3241 __ b(ne, ¬_heap_number); | |
3242 __ Ret(); | |
3243 __ bind(¬_heap_number); | |
3244 | 3239 |
3245 Label not_string, slow_string; | 3240 Label not_string, slow_string; |
3246 __ cmp(r1, Operand(FIRST_NONSTRING_TYPE)); | 3241 __ cmp(r1, Operand(FIRST_NONSTRING_TYPE)); |
3247 __ b(hs, ¬_string); | 3242 __ b(hs, ¬_string); |
3248 // Check if string has a cached array index. | 3243 // Check if string has a cached array index. |
3249 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); | 3244 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); |
3250 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); | 3245 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); |
3251 __ b(ne, &slow_string); | 3246 __ b(ne, &slow_string); |
3252 __ IndexFromHash(r2, r0); | 3247 __ IndexFromHash(r2, r0); |
3253 __ Ret(); | 3248 __ Ret(); |
3254 __ bind(&slow_string); | 3249 __ bind(&slow_string); |
3255 __ push(r0); // Push argument. | 3250 __ push(r0); // Push argument. |
3256 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); | 3251 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
3257 __ bind(¬_string); | 3252 __ bind(¬_string); |
3258 | 3253 |
3259 Label not_oddball; | 3254 Label not_oddball; |
3260 __ cmp(r1, Operand(ODDBALL_TYPE)); | 3255 __ cmp(r1, Operand(ODDBALL_TYPE)); |
3261 __ b(ne, ¬_oddball); | 3256 __ b(ne, ¬_oddball); |
3262 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); | 3257 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); |
3263 __ Ret(); | 3258 __ Ret(); |
3264 __ bind(¬_oddball); | 3259 __ bind(¬_oddball); |
3265 | 3260 |
3266 __ push(r0); // Push argument. | 3261 __ push(r0); // Push argument. |
3267 __ TailCallRuntime(Runtime::kToNumber, 1, 1); | 3262 __ TailCallRuntime(Runtime::kToNumber, 1, 1); |
3268 } | 3263 } |
3269 | 3264 |
3270 | 3265 |
| 3266 void ToStringStub::Generate(MacroAssembler* masm) { |
| 3267 // The ToString stub takes one argument in r0. |
| 3268 Label is_number; |
| 3269 __ JumpIfSmi(r0, &is_number); |
| 3270 |
| 3271 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); |
| 3272 // r0: receiver |
| 3273 // r1: receiver instance type |
| 3274 __ Ret(lo); |
| 3275 |
| 3276 Label not_heap_number; |
| 3277 __ cmp(r1, Operand(HEAP_NUMBER_TYPE)); |
| 3278 __ b(ne, ¬_heap_number); |
| 3279 __ bind(&is_number); |
| 3280 NumberToStringStub stub(isolate()); |
| 3281 __ TailCallStub(&stub); |
| 3282 __ bind(¬_heap_number); |
| 3283 |
| 3284 Label not_oddball; |
| 3285 __ cmp(r1, Operand(ODDBALL_TYPE)); |
| 3286 __ b(ne, ¬_oddball); |
| 3287 __ ldr(r0, FieldMemOperand(r0, Oddball::kToStringOffset)); |
| 3288 __ Ret(); |
| 3289 __ bind(¬_oddball); |
| 3290 |
| 3291 __ push(r0); // Push argument. |
| 3292 __ TailCallRuntime(Runtime::kToString, 1, 1); |
| 3293 } |
| 3294 |
| 3295 |
3271 void StringHelper::GenerateFlatOneByteStringEquals( | 3296 void StringHelper::GenerateFlatOneByteStringEquals( |
3272 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3297 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3273 Register scratch2, Register scratch3) { | 3298 Register scratch2, Register scratch3) { |
3274 Register length = scratch1; | 3299 Register length = scratch1; |
3275 | 3300 |
3276 // Compare lengths. | 3301 // Compare lengths. |
3277 Label strings_not_equal, check_zero_length; | 3302 Label strings_not_equal, check_zero_length; |
3278 __ ldr(length, FieldMemOperand(left, String::kLengthOffset)); | 3303 __ ldr(length, FieldMemOperand(left, String::kLengthOffset)); |
3279 __ ldr(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 3304 __ ldr(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
3280 __ cmp(length, scratch2); | 3305 __ cmp(length, scratch2); |
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5430 MemOperand(fp, 6 * kPointerSize), NULL); | 5455 MemOperand(fp, 6 * kPointerSize), NULL); |
5431 } | 5456 } |
5432 | 5457 |
5433 | 5458 |
5434 #undef __ | 5459 #undef __ |
5435 | 5460 |
5436 } // namespace internal | 5461 } // namespace internal |
5437 } // namespace v8 | 5462 } // namespace v8 |
5438 | 5463 |
5439 #endif // V8_TARGET_ARCH_ARM | 5464 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |