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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 __ lfd(d7, FieldMemOperand(lhs, HeapNumber::kValueOffset)); | 508 __ lfd(d7, FieldMemOperand(lhs, HeapNumber::kValueOffset)); |
509 | 509 |
510 __ b(both_loaded_as_doubles); | 510 __ b(both_loaded_as_doubles); |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 // Fast negative check for internalized-to-internalized equality. | 514 // Fast negative check for internalized-to-internalized equality. |
515 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, | 515 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
516 Register lhs, Register rhs, | 516 Register lhs, Register rhs, |
517 Label* possible_strings, | 517 Label* possible_strings, |
518 Label* not_both_strings) { | 518 Label* runtime_call) { |
519 DCHECK((lhs.is(r3) && rhs.is(r4)) || (lhs.is(r4) && rhs.is(r3))); | 519 DCHECK((lhs.is(r3) && rhs.is(r4)) || (lhs.is(r4) && rhs.is(r3))); |
520 | 520 |
521 // r5 is object type of rhs. | 521 // r5 is object type of rhs. |
522 Label object_test; | 522 Label object_test, return_unequal, undetectable; |
523 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 523 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
524 __ andi(r0, r5, Operand(kIsNotStringMask)); | 524 __ andi(r0, r5, Operand(kIsNotStringMask)); |
525 __ bne(&object_test, cr0); | 525 __ bne(&object_test, cr0); |
526 __ andi(r0, r5, Operand(kIsNotInternalizedMask)); | 526 __ andi(r0, r5, Operand(kIsNotInternalizedMask)); |
527 __ bne(possible_strings, cr0); | 527 __ bne(possible_strings, cr0); |
528 __ CompareObjectType(lhs, r6, r6, FIRST_NONSTRING_TYPE); | 528 __ CompareObjectType(lhs, r6, r6, FIRST_NONSTRING_TYPE); |
529 __ bge(not_both_strings); | 529 __ bge(runtime_call); |
530 __ andi(r0, r6, Operand(kIsNotInternalizedMask)); | 530 __ andi(r0, r6, Operand(kIsNotInternalizedMask)); |
531 __ bne(possible_strings, cr0); | 531 __ bne(possible_strings, cr0); |
532 | 532 |
533 // Both are internalized. We already checked they weren't the same pointer | 533 // Both are internalized. We already checked they weren't the same pointer so |
534 // so they are not equal. | 534 // they are not equal. Return non-equal by returning the non-zero object |
535 __ li(r3, Operand(NOT_EQUAL)); | 535 // pointer in r3. |
536 __ Ret(); | 536 __ Ret(); |
537 | 537 |
538 __ bind(&object_test); | 538 __ bind(&object_test); |
539 __ cmpi(r5, Operand(FIRST_JS_RECEIVER_TYPE)); | 539 __ LoadP(r5, FieldMemOperand(lhs, HeapObject::kMapOffset)); |
540 __ blt(not_both_strings); | |
541 __ CompareObjectType(lhs, r5, r6, FIRST_JS_RECEIVER_TYPE); | |
542 __ blt(not_both_strings); | |
543 // If both objects are undetectable, they are equal. Otherwise, they | |
544 // are not equal, since they are different objects and an object is not | |
545 // equal to undefined. | |
546 __ LoadP(r6, FieldMemOperand(rhs, HeapObject::kMapOffset)); | 540 __ LoadP(r6, FieldMemOperand(rhs, HeapObject::kMapOffset)); |
547 __ lbz(r5, FieldMemOperand(r5, Map::kBitFieldOffset)); | 541 __ lbz(r7, FieldMemOperand(r5, Map::kBitFieldOffset)); |
548 __ lbz(r6, FieldMemOperand(r6, Map::kBitFieldOffset)); | 542 __ lbz(r8, FieldMemOperand(r6, Map::kBitFieldOffset)); |
549 __ and_(r3, r5, r6); | 543 __ andi(r0, r7, Operand(1 << Map::kIsUndetectable)); |
550 __ andi(r3, r3, Operand(1 << Map::kIsUndetectable)); | 544 __ bne(&undetectable, cr0); |
551 __ xori(r3, r3, Operand(1 << Map::kIsUndetectable)); | 545 __ andi(r0, r8, Operand(1 << Map::kIsUndetectable)); |
| 546 __ bne(&return_unequal, cr0); |
| 547 |
| 548 __ CompareInstanceType(r5, r5, FIRST_JS_RECEIVER_TYPE); |
| 549 __ blt(runtime_call); |
| 550 __ CompareInstanceType(r6, r6, FIRST_JS_RECEIVER_TYPE); |
| 551 __ blt(runtime_call); |
| 552 |
| 553 __ bind(&return_unequal); |
| 554 // Return non-equal by returning the non-zero object pointer in r3. |
| 555 __ Ret(); |
| 556 |
| 557 __ bind(&undetectable); |
| 558 __ andi(r0, r8, Operand(1 << Map::kIsUndetectable)); |
| 559 __ beq(&return_unequal, cr0); |
| 560 __ li(r3, Operand(EQUAL)); |
552 __ Ret(); | 561 __ Ret(); |
553 } | 562 } |
554 | 563 |
555 | 564 |
556 static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input, | 565 static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input, |
557 Register scratch, | 566 Register scratch, |
558 CompareICState::State expected, | 567 CompareICState::State expected, |
559 Label* fail) { | 568 Label* fail) { |
560 Label ok; | 569 Label ok; |
561 if (expected == CompareICState::SMI) { | 570 if (expected == CompareICState::SMI) { |
(...skipping 5237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5799 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5808 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5800 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5809 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5801 } | 5810 } |
5802 | 5811 |
5803 | 5812 |
5804 #undef __ | 5813 #undef __ |
5805 } // namespace internal | 5814 } // namespace internal |
5806 } // namespace v8 | 5815 } // namespace v8 |
5807 | 5816 |
5808 #endif // V8_TARGET_ARCH_PPC | 5817 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |