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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 Label heap_number, return_equal; | 243 Label heap_number, return_equal; |
244 __ cmp(r0, r1); | 244 __ cmp(r0, r1); |
245 __ b(ne, ¬_identical); | 245 __ b(ne, ¬_identical); |
246 | 246 |
247 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), | 247 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), |
248 // so we do the second best thing - test it ourselves. | 248 // so we do the second best thing - test it ourselves. |
249 // They are both equal and they are not both Smis so both of them are not | 249 // They are both equal and they are not both Smis so both of them are not |
250 // Smis. If it's not a heap number, then return equal. | 250 // Smis. If it's not a heap number, then return equal. |
251 if (cond == lt || cond == gt) { | 251 if (cond == lt || cond == gt) { |
252 // Call runtime on identical JSObjects. | 252 // Call runtime on identical JSObjects. |
253 __ CompareObjectType(r0, r4, r4, FIRST_SPEC_OBJECT_TYPE); | 253 __ CompareObjectType(r0, r4, r4, FIRST_JS_RECEIVER_TYPE); |
254 __ b(ge, slow); | 254 __ b(ge, slow); |
255 // Call runtime on identical symbols since we need to throw a TypeError. | 255 // Call runtime on identical symbols since we need to throw a TypeError. |
256 __ cmp(r4, Operand(SYMBOL_TYPE)); | 256 __ cmp(r4, Operand(SYMBOL_TYPE)); |
257 __ b(eq, slow); | 257 __ b(eq, slow); |
258 // Call runtime on identical SIMD values since we must throw a TypeError. | 258 // Call runtime on identical SIMD values since we must throw a TypeError. |
259 __ cmp(r4, Operand(SIMD128_VALUE_TYPE)); | 259 __ cmp(r4, Operand(SIMD128_VALUE_TYPE)); |
260 __ b(eq, slow); | 260 __ b(eq, slow); |
261 if (is_strong(strength)) { | 261 if (is_strong(strength)) { |
262 // Call the runtime on anything that is converted in the semantics, since | 262 // Call the runtime on anything that is converted in the semantics, since |
263 // we need to throw a TypeError. Smis have already been ruled out. | 263 // we need to throw a TypeError. Smis have already been ruled out. |
264 __ cmp(r4, Operand(HEAP_NUMBER_TYPE)); | 264 __ cmp(r4, Operand(HEAP_NUMBER_TYPE)); |
265 __ b(eq, &return_equal); | 265 __ b(eq, &return_equal); |
266 __ tst(r4, Operand(kIsNotStringMask)); | 266 __ tst(r4, Operand(kIsNotStringMask)); |
267 __ b(ne, slow); | 267 __ b(ne, slow); |
268 } | 268 } |
269 } else { | 269 } else { |
270 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE); | 270 __ CompareObjectType(r0, r4, r4, HEAP_NUMBER_TYPE); |
271 __ b(eq, &heap_number); | 271 __ b(eq, &heap_number); |
272 // Comparing JS objects with <=, >= is complicated. | 272 // Comparing JS objects with <=, >= is complicated. |
273 if (cond != eq) { | 273 if (cond != eq) { |
274 __ cmp(r4, Operand(FIRST_SPEC_OBJECT_TYPE)); | 274 __ cmp(r4, Operand(FIRST_JS_RECEIVER_TYPE)); |
275 __ b(ge, slow); | 275 __ b(ge, slow); |
276 // Call runtime on identical symbols since we need to throw a TypeError. | 276 // Call runtime on identical symbols since we need to throw a TypeError. |
277 __ cmp(r4, Operand(SYMBOL_TYPE)); | 277 __ cmp(r4, Operand(SYMBOL_TYPE)); |
278 __ b(eq, slow); | 278 __ b(eq, slow); |
279 // Call runtime on identical SIMD values since we must throw a TypeError. | 279 // Call runtime on identical SIMD values since we must throw a TypeError. |
280 __ cmp(r4, Operand(SIMD128_VALUE_TYPE)); | 280 __ cmp(r4, Operand(SIMD128_VALUE_TYPE)); |
281 __ b(eq, slow); | 281 __ b(eq, slow); |
282 if (is_strong(strength)) { | 282 if (is_strong(strength)) { |
283 // Call the runtime on anything that is converted in the semantics, | 283 // Call the runtime on anything that is converted in the semantics, |
284 // since we need to throw a TypeError. Smis and heap numbers have | 284 // since we need to throw a TypeError. Smis and heap numbers have |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // See comment at call site. | 429 // See comment at call site. |
430 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 430 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
431 Register lhs, | 431 Register lhs, |
432 Register rhs) { | 432 Register rhs) { |
433 DCHECK((lhs.is(r0) && rhs.is(r1)) || | 433 DCHECK((lhs.is(r0) && rhs.is(r1)) || |
434 (lhs.is(r1) && rhs.is(r0))); | 434 (lhs.is(r1) && rhs.is(r0))); |
435 | 435 |
436 // If either operand is a JS object or an oddball value, then they are | 436 // If either operand is a JS object or an oddball value, then they are |
437 // not equal since their pointers are different. | 437 // not equal since their pointers are different. |
438 // There is no test for undetectability in strict equality. | 438 // There is no test for undetectability in strict equality. |
439 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); | 439 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
440 Label first_non_object; | 440 Label first_non_object; |
441 // Get the type of the first operand into r2 and compare it with | 441 // Get the type of the first operand into r2 and compare it with |
442 // FIRST_SPEC_OBJECT_TYPE. | 442 // FIRST_JS_RECEIVER_TYPE. |
443 __ CompareObjectType(rhs, r2, r2, FIRST_SPEC_OBJECT_TYPE); | 443 __ CompareObjectType(rhs, r2, r2, FIRST_JS_RECEIVER_TYPE); |
444 __ b(lt, &first_non_object); | 444 __ b(lt, &first_non_object); |
445 | 445 |
446 // Return non-zero (r0 is not zero) | 446 // Return non-zero (r0 is not zero) |
447 Label return_not_equal; | 447 Label return_not_equal; |
448 __ bind(&return_not_equal); | 448 __ bind(&return_not_equal); |
449 __ Ret(); | 449 __ Ret(); |
450 | 450 |
451 __ bind(&first_non_object); | 451 __ bind(&first_non_object); |
452 // Check for oddballs: true, false, null, undefined. | 452 // Check for oddballs: true, false, null, undefined. |
453 __ cmp(r2, Operand(ODDBALL_TYPE)); | 453 __ cmp(r2, Operand(ODDBALL_TYPE)); |
454 __ b(eq, &return_not_equal); | 454 __ b(eq, &return_not_equal); |
455 | 455 |
456 __ CompareObjectType(lhs, r3, r3, FIRST_SPEC_OBJECT_TYPE); | 456 __ CompareObjectType(lhs, r3, r3, FIRST_JS_RECEIVER_TYPE); |
457 __ b(ge, &return_not_equal); | 457 __ b(ge, &return_not_equal); |
458 | 458 |
459 // Check for oddballs: true, false, null, undefined. | 459 // Check for oddballs: true, false, null, undefined. |
460 __ cmp(r3, Operand(ODDBALL_TYPE)); | 460 __ cmp(r3, Operand(ODDBALL_TYPE)); |
461 __ b(eq, &return_not_equal); | 461 __ b(eq, &return_not_equal); |
462 | 462 |
463 // Now that we have the types we might as well check for | 463 // Now that we have the types we might as well check for |
464 // internalized-internalized. | 464 // internalized-internalized. |
465 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 465 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
466 __ orr(r2, r2, Operand(r3)); | 466 __ orr(r2, r2, Operand(r3)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 __ b(ge, not_both_strings); | 513 __ b(ge, not_both_strings); |
514 __ tst(r3, Operand(kIsNotInternalizedMask)); | 514 __ tst(r3, Operand(kIsNotInternalizedMask)); |
515 __ b(ne, possible_strings); | 515 __ b(ne, possible_strings); |
516 | 516 |
517 // Both are internalized. We already checked they weren't the same pointer | 517 // Both are internalized. We already checked they weren't the same pointer |
518 // so they are not equal. | 518 // so they are not equal. |
519 __ mov(r0, Operand(NOT_EQUAL)); | 519 __ mov(r0, Operand(NOT_EQUAL)); |
520 __ Ret(); | 520 __ Ret(); |
521 | 521 |
522 __ bind(&object_test); | 522 __ bind(&object_test); |
523 __ cmp(r2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 523 __ cmp(r2, Operand(FIRST_JS_RECEIVER_TYPE)); |
524 __ b(lt, not_both_strings); | 524 __ b(lt, not_both_strings); |
525 __ CompareObjectType(lhs, r2, r3, FIRST_SPEC_OBJECT_TYPE); | 525 __ CompareObjectType(lhs, r2, r3, FIRST_JS_RECEIVER_TYPE); |
526 __ b(lt, not_both_strings); | 526 __ b(lt, not_both_strings); |
527 // If both objects are undetectable, they are equal. Otherwise, they | 527 // If both objects are undetectable, they are equal. Otherwise, they |
528 // are not equal, since they are different objects and an object is not | 528 // are not equal, since they are different objects and an object is not |
529 // equal to undefined. | 529 // equal to undefined. |
530 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); | 530 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); |
531 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); | 531 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); |
532 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 532 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
533 __ and_(r0, r2, Operand(r3)); | 533 __ and_(r0, r2, Operand(r3)); |
534 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); | 534 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); |
535 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); | 535 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); |
(...skipping 4831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5367 MemOperand(fp, 6 * kPointerSize), NULL); | 5367 MemOperand(fp, 6 * kPointerSize), NULL); |
5368 } | 5368 } |
5369 | 5369 |
5370 | 5370 |
5371 #undef __ | 5371 #undef __ |
5372 | 5372 |
5373 } // namespace internal | 5373 } // namespace internal |
5374 } // namespace v8 | 5374 } // namespace v8 |
5375 | 5375 |
5376 #endif // V8_TARGET_ARCH_ARM | 5376 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |