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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 Label heap_number, return_equal; | 253 Label heap_number, return_equal; |
254 __ cmp(r3, r4); | 254 __ cmp(r3, r4); |
255 __ bne(¬_identical); | 255 __ bne(¬_identical); |
256 | 256 |
257 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), | 257 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), |
258 // so we do the second best thing - test it ourselves. | 258 // so we do the second best thing - test it ourselves. |
259 // They are both equal and they are not both Smis so both of them are not | 259 // They are both equal and they are not both Smis so both of them are not |
260 // Smis. If it's not a heap number, then return equal. | 260 // Smis. If it's not a heap number, then return equal. |
261 if (cond == lt || cond == gt) { | 261 if (cond == lt || cond == gt) { |
262 // Call runtime on identical JSObjects. | 262 // Call runtime on identical JSObjects. |
263 __ CompareObjectType(r3, r7, r7, FIRST_SPEC_OBJECT_TYPE); | 263 __ CompareObjectType(r3, r7, r7, FIRST_JS_RECEIVER_TYPE); |
264 __ bge(slow); | 264 __ bge(slow); |
265 // Call runtime on identical symbols since we need to throw a TypeError. | 265 // Call runtime on identical symbols since we need to throw a TypeError. |
266 __ cmpi(r7, Operand(SYMBOL_TYPE)); | 266 __ cmpi(r7, Operand(SYMBOL_TYPE)); |
267 __ beq(slow); | 267 __ beq(slow); |
268 // Call runtime on identical SIMD values since we must throw a TypeError. | 268 // Call runtime on identical SIMD values since we must throw a TypeError. |
269 __ cmpi(r7, Operand(SIMD128_VALUE_TYPE)); | 269 __ cmpi(r7, Operand(SIMD128_VALUE_TYPE)); |
270 __ beq(slow); | 270 __ beq(slow); |
271 if (is_strong(strength)) { | 271 if (is_strong(strength)) { |
272 // Call the runtime on anything that is converted in the semantics, since | 272 // Call the runtime on anything that is converted in the semantics, since |
273 // we need to throw a TypeError. Smis have already been ruled out. | 273 // we need to throw a TypeError. Smis have already been ruled out. |
274 __ cmpi(r7, Operand(HEAP_NUMBER_TYPE)); | 274 __ cmpi(r7, Operand(HEAP_NUMBER_TYPE)); |
275 __ beq(&return_equal); | 275 __ beq(&return_equal); |
276 __ andi(r0, r7, Operand(kIsNotStringMask)); | 276 __ andi(r0, r7, Operand(kIsNotStringMask)); |
277 __ bne(slow, cr0); | 277 __ bne(slow, cr0); |
278 } | 278 } |
279 } else { | 279 } else { |
280 __ CompareObjectType(r3, r7, r7, HEAP_NUMBER_TYPE); | 280 __ CompareObjectType(r3, r7, r7, HEAP_NUMBER_TYPE); |
281 __ beq(&heap_number); | 281 __ beq(&heap_number); |
282 // Comparing JS objects with <=, >= is complicated. | 282 // Comparing JS objects with <=, >= is complicated. |
283 if (cond != eq) { | 283 if (cond != eq) { |
284 __ cmpi(r7, Operand(FIRST_SPEC_OBJECT_TYPE)); | 284 __ cmpi(r7, Operand(FIRST_JS_RECEIVER_TYPE)); |
285 __ bge(slow); | 285 __ bge(slow); |
286 // Call runtime on identical symbols since we need to throw a TypeError. | 286 // Call runtime on identical symbols since we need to throw a TypeError. |
287 __ cmpi(r7, Operand(SYMBOL_TYPE)); | 287 __ cmpi(r7, Operand(SYMBOL_TYPE)); |
288 __ beq(slow); | 288 __ beq(slow); |
289 // Call runtime on identical SIMD values since we must throw a TypeError. | 289 // Call runtime on identical SIMD values since we must throw a TypeError. |
290 __ cmpi(r7, Operand(SIMD128_VALUE_TYPE)); | 290 __ cmpi(r7, Operand(SIMD128_VALUE_TYPE)); |
291 __ beq(slow); | 291 __ beq(slow); |
292 if (is_strong(strength)) { | 292 if (is_strong(strength)) { |
293 // Call the runtime on anything that is converted in the semantics, | 293 // Call the runtime on anything that is converted in the semantics, |
294 // since we need to throw a TypeError. Smis and heap numbers have | 294 // since we need to throw a TypeError. Smis and heap numbers have |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 | 450 |
451 // See comment at call site. | 451 // See comment at call site. |
452 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, Register lhs, | 452 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, Register lhs, |
453 Register rhs) { | 453 Register rhs) { |
454 DCHECK((lhs.is(r3) && rhs.is(r4)) || (lhs.is(r4) && rhs.is(r3))); | 454 DCHECK((lhs.is(r3) && rhs.is(r4)) || (lhs.is(r4) && rhs.is(r3))); |
455 | 455 |
456 // If either operand is a JS object or an oddball value, then they are | 456 // If either operand is a JS object or an oddball value, then they are |
457 // not equal since their pointers are different. | 457 // not equal since their pointers are different. |
458 // There is no test for undetectability in strict equality. | 458 // There is no test for undetectability in strict equality. |
459 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); | 459 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
460 Label first_non_object; | 460 Label first_non_object; |
461 // Get the type of the first operand into r5 and compare it with | 461 // Get the type of the first operand into r5 and compare it with |
462 // FIRST_SPEC_OBJECT_TYPE. | 462 // FIRST_JS_RECEIVER_TYPE. |
463 __ CompareObjectType(rhs, r5, r5, FIRST_SPEC_OBJECT_TYPE); | 463 __ CompareObjectType(rhs, r5, r5, FIRST_JS_RECEIVER_TYPE); |
464 __ blt(&first_non_object); | 464 __ blt(&first_non_object); |
465 | 465 |
466 // Return non-zero (r3 is not zero) | 466 // Return non-zero (r3 is not zero) |
467 Label return_not_equal; | 467 Label return_not_equal; |
468 __ bind(&return_not_equal); | 468 __ bind(&return_not_equal); |
469 __ Ret(); | 469 __ Ret(); |
470 | 470 |
471 __ bind(&first_non_object); | 471 __ bind(&first_non_object); |
472 // Check for oddballs: true, false, null, undefined. | 472 // Check for oddballs: true, false, null, undefined. |
473 __ cmpi(r5, Operand(ODDBALL_TYPE)); | 473 __ cmpi(r5, Operand(ODDBALL_TYPE)); |
474 __ beq(&return_not_equal); | 474 __ beq(&return_not_equal); |
475 | 475 |
476 __ CompareObjectType(lhs, r6, r6, FIRST_SPEC_OBJECT_TYPE); | 476 __ CompareObjectType(lhs, r6, r6, FIRST_JS_RECEIVER_TYPE); |
477 __ bge(&return_not_equal); | 477 __ bge(&return_not_equal); |
478 | 478 |
479 // Check for oddballs: true, false, null, undefined. | 479 // Check for oddballs: true, false, null, undefined. |
480 __ cmpi(r6, Operand(ODDBALL_TYPE)); | 480 __ cmpi(r6, Operand(ODDBALL_TYPE)); |
481 __ beq(&return_not_equal); | 481 __ beq(&return_not_equal); |
482 | 482 |
483 // Now that we have the types we might as well check for | 483 // Now that we have the types we might as well check for |
484 // internalized-internalized. | 484 // internalized-internalized. |
485 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 485 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
486 __ orx(r5, r5, r6); | 486 __ orx(r5, r5, r6); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 __ bge(not_both_strings); | 529 __ bge(not_both_strings); |
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 |
534 // so they are not equal. | 534 // so they are not equal. |
535 __ li(r3, Operand(NOT_EQUAL)); | 535 __ li(r3, Operand(NOT_EQUAL)); |
536 __ Ret(); | 536 __ Ret(); |
537 | 537 |
538 __ bind(&object_test); | 538 __ bind(&object_test); |
539 __ cmpi(r5, Operand(FIRST_SPEC_OBJECT_TYPE)); | 539 __ cmpi(r5, Operand(FIRST_JS_RECEIVER_TYPE)); |
540 __ blt(not_both_strings); | 540 __ blt(not_both_strings); |
541 __ CompareObjectType(lhs, r5, r6, FIRST_SPEC_OBJECT_TYPE); | 541 __ CompareObjectType(lhs, r5, r6, FIRST_JS_RECEIVER_TYPE); |
542 __ blt(not_both_strings); | 542 __ blt(not_both_strings); |
543 // If both objects are undetectable, they are equal. Otherwise, they | 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 | 544 // are not equal, since they are different objects and an object is not |
545 // equal to undefined. | 545 // equal to undefined. |
546 __ LoadP(r6, FieldMemOperand(rhs, HeapObject::kMapOffset)); | 546 __ LoadP(r6, FieldMemOperand(rhs, HeapObject::kMapOffset)); |
547 __ lbz(r5, FieldMemOperand(r5, Map::kBitFieldOffset)); | 547 __ lbz(r5, FieldMemOperand(r5, Map::kBitFieldOffset)); |
548 __ lbz(r6, FieldMemOperand(r6, Map::kBitFieldOffset)); | 548 __ lbz(r6, FieldMemOperand(r6, Map::kBitFieldOffset)); |
549 __ and_(r3, r5, r6); | 549 __ and_(r3, r5, r6); |
550 __ andi(r3, r3, Operand(1 << Map::kIsUndetectable)); | 550 __ andi(r3, r3, Operand(1 << Map::kIsUndetectable)); |
551 __ xori(r3, r3, Operand(1 << Map::kIsUndetectable)); | 551 __ xori(r3, r3, Operand(1 << Map::kIsUndetectable)); |
(...skipping 5097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5649 kStackUnwindSpace, NULL, | 5649 kStackUnwindSpace, NULL, |
5650 MemOperand(fp, 6 * kPointerSize), NULL); | 5650 MemOperand(fp, 6 * kPointerSize), NULL); |
5651 } | 5651 } |
5652 | 5652 |
5653 | 5653 |
5654 #undef __ | 5654 #undef __ |
5655 } // namespace internal | 5655 } // namespace internal |
5656 } // namespace v8 | 5656 } // namespace v8 |
5657 | 5657 |
5658 #endif // V8_TARGET_ARCH_PPC | 5658 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |