Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1683643002: Mark null and undefined as undetectable, and use it to handle abstract equality comparison in the g… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // Both are heap numbers. Load them up then jump to the code we have 488 // Both are heap numbers. Load them up then jump to the code we have
489 // for that. 489 // for that.
490 __ vldr(d6, rhs, HeapNumber::kValueOffset - kHeapObjectTag); 490 __ vldr(d6, rhs, HeapNumber::kValueOffset - kHeapObjectTag);
491 __ vldr(d7, lhs, HeapNumber::kValueOffset - kHeapObjectTag); 491 __ vldr(d7, lhs, HeapNumber::kValueOffset - kHeapObjectTag);
492 __ jmp(both_loaded_as_doubles); 492 __ jmp(both_loaded_as_doubles);
493 } 493 }
494 494
495 495
496 // Fast negative check for internalized-to-internalized equality. 496 // Fast negative check for internalized-to-internalized equality.
497 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, 497 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm,
498 Register lhs, 498 Register lhs, Register rhs,
499 Register rhs,
500 Label* possible_strings, 499 Label* possible_strings,
501 Label* not_both_strings) { 500 Label* runtime_call) {
502 DCHECK((lhs.is(r0) && rhs.is(r1)) || 501 DCHECK((lhs.is(r0) && rhs.is(r1)) ||
503 (lhs.is(r1) && rhs.is(r0))); 502 (lhs.is(r1) && rhs.is(r0)));
504 503
505 // r2 is object type of rhs. 504 // r2 is object type of rhs.
506 Label object_test; 505 Label object_test, return_unequal, undetectable;
507 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); 506 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0);
508 __ tst(r2, Operand(kIsNotStringMask)); 507 __ tst(r2, Operand(kIsNotStringMask));
509 __ b(ne, &object_test); 508 __ b(ne, &object_test);
510 __ tst(r2, Operand(kIsNotInternalizedMask)); 509 __ tst(r2, Operand(kIsNotInternalizedMask));
511 __ b(ne, possible_strings); 510 __ b(ne, possible_strings);
512 __ CompareObjectType(lhs, r3, r3, FIRST_NONSTRING_TYPE); 511 __ CompareObjectType(lhs, r3, r3, FIRST_NONSTRING_TYPE);
513 __ b(ge, not_both_strings); 512 __ b(ge, runtime_call);
514 __ tst(r3, Operand(kIsNotInternalizedMask)); 513 __ tst(r3, Operand(kIsNotInternalizedMask));
515 __ b(ne, possible_strings); 514 __ b(ne, possible_strings);
516 515
517 // Both are internalized. We already checked they weren't the same pointer 516 // Both are internalized. We already checked they weren't the same pointer so
518 // so they are not equal. 517 // they are not equal. Return non-equal by returning the non-zero object
519 __ mov(r0, Operand(NOT_EQUAL)); 518 // pointer in r0.
520 __ Ret(); 519 __ Ret();
521 520
522 __ bind(&object_test); 521 __ bind(&object_test);
523 __ cmp(r2, Operand(FIRST_JS_RECEIVER_TYPE)); 522 __ ldr(r2, FieldMemOperand(lhs, HeapObject::kMapOffset));
524 __ b(lt, not_both_strings);
525 __ CompareObjectType(lhs, r2, r3, FIRST_JS_RECEIVER_TYPE);
526 __ b(lt, not_both_strings);
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
529 // equal to undefined.
530 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset)); 523 __ ldr(r3, FieldMemOperand(rhs, HeapObject::kMapOffset));
531 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset)); 524 __ ldrb(r4, FieldMemOperand(r2, Map::kBitFieldOffset));
532 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); 525 __ ldrb(r5, FieldMemOperand(r3, Map::kBitFieldOffset));
533 __ and_(r0, r2, Operand(r3)); 526 __ tst(r4, Operand(1 << Map::kIsUndetectable));
534 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable)); 527 __ b(ne, &undetectable);
535 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable)); 528 __ tst(r5, Operand(1 << Map::kIsUndetectable));
529 __ b(ne, &return_unequal);
530
531 __ CompareInstanceType(r2, r2, FIRST_JS_RECEIVER_TYPE);
532 __ b(lt, runtime_call);
533 __ CompareInstanceType(r3, r3, FIRST_JS_RECEIVER_TYPE);
534 __ b(lt, runtime_call);
535
536 __ bind(&return_unequal);
537 // Return non-equal by returning the non-zero object pointer in r0.
538 __ Ret();
539
540 __ bind(&undetectable);
541 __ tst(r5, Operand(1 << Map::kIsUndetectable));
542 __ b(eq, &return_unequal);
543 __ mov(r0, Operand(EQUAL));
536 __ Ret(); 544 __ Ret();
537 } 545 }
538 546
539 547
540 static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input, 548 static void CompareICStub_CheckInputType(MacroAssembler* masm, Register input,
541 Register scratch, 549 Register scratch,
542 CompareICState::State expected, 550 CompareICState::State expected,
543 Label* fail) { 551 Label* fail) {
544 Label ok; 552 Label ok;
545 if (expected == CompareICState::SMI) { 553 if (expected == CompareICState::SMI) {
(...skipping 5012 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 kStackUnwindSpace, NULL, return_value_operand, NULL); 5566 kStackUnwindSpace, NULL, return_value_operand, NULL);
5559 } 5567 }
5560 5568
5561 5569
5562 #undef __ 5570 #undef __
5563 5571
5564 } // namespace internal 5572 } // namespace internal
5565 } // namespace v8 5573 } // namespace v8
5566 5574
5567 #endif // V8_TARGET_ARCH_ARM 5575 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698