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

Side by Side Diff: src/arm/ic-arm.cc

Issue 600123: Port keyed interceptor stubs to ARM and x64. (Closed)
Patch Set: Changing receiver/key checks order Created 10 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/x64/ic-x64.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 555 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
556 // ---------- S t a t e -------------- 556 // ---------- S t a t e --------------
557 // -- lr : return address 557 // -- lr : return address
558 // -- sp[0] : key 558 // -- sp[0] : key
559 // -- sp[4] : receiver 559 // -- sp[4] : receiver
560 // ----------------------------------- 560 // -----------------------------------
561 Label slow, fast; 561 Label slow, fast;
562 562
563 // Get the key and receiver object from the stack. 563 // Get the key and receiver object from the stack.
564 __ ldm(ia, sp, r0.bit() | r1.bit()); 564 __ ldm(ia, sp, r0.bit() | r1.bit());
565 // Check that the key is a smi. 565
566 __ tst(r0, Operand(kSmiTagMask));
567 __ b(ne, &slow);
568 __ mov(r0, Operand(r0, ASR, kSmiTagSize));
569 // Check that the object isn't a smi. 566 // Check that the object isn't a smi.
570 __ tst(r1, Operand(kSmiTagMask)); 567 __ BranchOnSmi(r1, &slow);
571 __ b(eq, &slow);
572
573 // Get the map of the receiver. 568 // Get the map of the receiver.
574 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); 569 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
575
576 // Check bit field. 570 // Check bit field.
577 __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset)); 571 __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset));
578 __ tst(r3, Operand(kSlowCaseBitFieldMask)); 572 __ tst(r3, Operand(kSlowCaseBitFieldMask));
579 __ b(ne, &slow); 573 __ b(ne, &slow);
580 // Check that the object is some kind of JS object EXCEPT JS Value type. 574 // Check that the object is some kind of JS object EXCEPT JS Value type.
581 // In the case that the object is a value-wrapper object, 575 // In the case that the object is a value-wrapper object,
582 // we enter the runtime system to make sure that indexing into string 576 // we enter the runtime system to make sure that indexing into string
583 // objects work as intended. 577 // objects work as intended.
584 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); 578 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
585 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); 579 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
586 __ cmp(r2, Operand(JS_OBJECT_TYPE)); 580 __ cmp(r2, Operand(JS_OBJECT_TYPE));
587 __ b(lt, &slow); 581 __ b(lt, &slow);
588 582
583 // Check that the key is a smi.
584 __ BranchOnNotSmi(r0, &slow);
585 __ mov(r0, Operand(r0, ASR, kSmiTagSize));
586
589 // Get the elements array of the object. 587 // Get the elements array of the object.
590 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); 588 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset));
591 // Check that the object is in fast mode (not dictionary). 589 // Check that the object is in fast mode (not dictionary).
592 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); 590 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
593 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 591 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
594 __ cmp(r3, ip); 592 __ cmp(r3, ip);
595 __ b(ne, &slow); 593 __ b(ne, &slow);
596 // Check that the key (index) is within bounds. 594 // Check that the key (index) is within bounds.
597 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); 595 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset));
598 __ cmp(r0, Operand(r3)); 596 __ cmp(r0, Operand(r3));
(...skipping 30 matching lines...) Expand all
629 627
630 628
631 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, 629 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
632 ExternalArrayType array_type) { 630 ExternalArrayType array_type) {
633 // TODO(476): port specialized code. 631 // TODO(476): port specialized code.
634 GenerateGeneric(masm); 632 GenerateGeneric(masm);
635 } 633 }
636 634
637 635
638 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 636 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
639 GenerateGeneric(masm); 637 // ---------- S t a t e --------------
638 // -- lr : return address
639 // -- sp[0] : key
640 // -- sp[4] : receiver
641 // -----------------------------------
642 Label slow;
643
644 // Get the key and receiver object from the stack.
645 __ ldm(ia, sp, r0.bit() | r1.bit());
646
647 // Check that the receiver isn't a smi.
648 __ BranchOnSmi(r1, &slow);
649
650 // Check that the key is a smi.
651 __ BranchOnNotSmi(r0, &slow);
652
653 // Get the map of the receiver.
654 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
655
656 // Check that it has indexed interceptor and access checks
657 // are not enabled for this object.
658 __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset));
659 __ and_(r3, r3, Operand(kSlowCaseBitFieldMask));
660 __ cmp(r3, Operand(1 << Map::kHasIndexedInterceptor));
661 __ b(ne, &slow);
662
663 // Everything is fine, call runtime.
664 __ push(r1); // receiver
665 __ push(r0); // key
666
667 // Perform tail call to the entry.
668 __ TailCallRuntime(ExternalReference(
669 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1);
670
671 __ bind(&slow);
672 GenerateMiss(masm);
640 } 673 }
641 674
642 675
643 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { 676 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
644 // ---------- S t a t e -------------- 677 // ---------- S t a t e --------------
645 // -- r0 : value 678 // -- r0 : value
646 // -- lr : return address 679 // -- lr : return address
647 // -- sp[0] : key 680 // -- sp[0] : key
648 // -- sp[1] : receiver 681 // -- sp[1] : receiver
649 // ----------------------------------- 682 // -----------------------------------
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 858
826 // Perform tail call to the entry. 859 // Perform tail call to the entry.
827 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); 860 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1);
828 } 861 }
829 862
830 863
831 #undef __ 864 #undef __
832 865
833 866
834 } } // namespace v8::internal 867 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698