OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 3383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3394 } | 3394 } |
3395 | 3395 |
3396 | 3396 |
3397 void ToNumberStub::Generate(MacroAssembler* masm) { | 3397 void ToNumberStub::Generate(MacroAssembler* masm) { |
3398 // The ToNumber stub takes one argument in r3. | 3398 // The ToNumber stub takes one argument in r3. |
3399 Label not_smi; | 3399 Label not_smi; |
3400 __ JumpIfNotSmi(r3, ¬_smi); | 3400 __ JumpIfNotSmi(r3, ¬_smi); |
3401 __ blr(); | 3401 __ blr(); |
3402 __ bind(¬_smi); | 3402 __ bind(¬_smi); |
3403 | 3403 |
3404 Label not_heap_number; | 3404 __ CompareObjectType(r3, r4, r4, HEAP_NUMBER_TYPE); |
3405 __ LoadP(r4, FieldMemOperand(r3, HeapObject::kMapOffset)); | 3405 // r3: receiver |
3406 __ lbz(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); | 3406 // r4: receiver instance type |
3407 // r3: object | 3407 __ Ret(eq); |
3408 // r4: instance type. | |
3409 __ cmpi(r4, Operand(HEAP_NUMBER_TYPE)); | |
3410 __ bne(¬_heap_number); | |
3411 __ blr(); | |
3412 __ bind(¬_heap_number); | |
3413 | 3408 |
3414 Label not_string, slow_string; | 3409 Label not_string, slow_string; |
3415 __ cmpli(r4, Operand(FIRST_NONSTRING_TYPE)); | 3410 __ cmpli(r4, Operand(FIRST_NONSTRING_TYPE)); |
3416 __ bge(¬_string); | 3411 __ bge(¬_string); |
3417 // Check if string has a cached array index. | 3412 // Check if string has a cached array index. |
3418 __ lwz(r5, FieldMemOperand(r3, String::kHashFieldOffset)); | 3413 __ lwz(r5, FieldMemOperand(r3, String::kHashFieldOffset)); |
3419 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); | 3414 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); |
3420 __ bne(&slow_string, cr0); | 3415 __ bne(&slow_string, cr0); |
3421 __ IndexFromHash(r5, r3); | 3416 __ IndexFromHash(r5, r3); |
3422 __ blr(); | 3417 __ blr(); |
3423 __ bind(&slow_string); | 3418 __ bind(&slow_string); |
3424 __ push(r3); // Push argument. | 3419 __ push(r3); // Push argument. |
3425 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); | 3420 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
3426 __ bind(¬_string); | 3421 __ bind(¬_string); |
3427 | 3422 |
3428 Label not_oddball; | 3423 Label not_oddball; |
3429 __ cmpi(r4, Operand(ODDBALL_TYPE)); | 3424 __ cmpi(r4, Operand(ODDBALL_TYPE)); |
3430 __ bne(¬_oddball); | 3425 __ bne(¬_oddball); |
3431 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); | 3426 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); |
3432 __ blr(); | 3427 __ blr(); |
3433 __ bind(¬_oddball); | 3428 __ bind(¬_oddball); |
3434 | 3429 |
3435 __ push(r3); // Push argument. | 3430 __ push(r3); // Push argument. |
3436 __ TailCallRuntime(Runtime::kToNumber, 1, 1); | 3431 __ TailCallRuntime(Runtime::kToNumber, 1, 1); |
3437 } | 3432 } |
3438 | 3433 |
3439 | 3434 |
| 3435 void ToStringStub::Generate(MacroAssembler* masm) { |
| 3436 // The ToString stub takes one argument in r3. |
| 3437 Label is_number; |
| 3438 __ JumpIfSmi(r3, &is_number); |
| 3439 |
| 3440 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); |
| 3441 // r3: receiver |
| 3442 // r4: receiver instance type |
| 3443 __ Ret(lt); |
| 3444 |
| 3445 Label not_heap_number; |
| 3446 __ cmpi(r4, Operand(HEAP_NUMBER_TYPE)); |
| 3447 __ bne(¬_heap_number); |
| 3448 __ bind(&is_number); |
| 3449 NumberToStringStub stub(isolate()); |
| 3450 __ TailCallStub(&stub); |
| 3451 __ bind(¬_heap_number); |
| 3452 |
| 3453 Label not_oddball; |
| 3454 __ cmpi(r4, Operand(ODDBALL_TYPE)); |
| 3455 __ bne(¬_oddball); |
| 3456 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToStringOffset)); |
| 3457 __ Ret(); |
| 3458 __ bind(¬_oddball); |
| 3459 |
| 3460 __ push(r3); // Push argument. |
| 3461 __ TailCallRuntime(Runtime::kToString, 1, 1); |
| 3462 } |
| 3463 |
| 3464 |
3440 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 3465 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
3441 Register left, | 3466 Register left, |
3442 Register right, | 3467 Register right, |
3443 Register scratch1, | 3468 Register scratch1, |
3444 Register scratch2) { | 3469 Register scratch2) { |
3445 Register length = scratch1; | 3470 Register length = scratch1; |
3446 | 3471 |
3447 // Compare lengths. | 3472 // Compare lengths. |
3448 Label strings_not_equal, check_zero_length; | 3473 Label strings_not_equal, check_zero_length; |
3449 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); | 3474 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); |
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 kStackUnwindSpace, NULL, | 5752 kStackUnwindSpace, NULL, |
5728 MemOperand(fp, 6 * kPointerSize), NULL); | 5753 MemOperand(fp, 6 * kPointerSize), NULL); |
5729 } | 5754 } |
5730 | 5755 |
5731 | 5756 |
5732 #undef __ | 5757 #undef __ |
5733 } // namespace internal | 5758 } // namespace internal |
5734 } // namespace v8 | 5759 } // namespace v8 |
5735 | 5760 |
5736 #endif // V8_TARGET_ARCH_PPC | 5761 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |