OLD | NEW |
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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // objects work as intended. | 575 // objects work as intended. |
576 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 576 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
577 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 577 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
578 __ cmp(r2, Operand(JS_OBJECT_TYPE)); | 578 __ cmp(r2, Operand(JS_OBJECT_TYPE)); |
579 __ b(lt, &slow); | 579 __ b(lt, &slow); |
580 | 580 |
581 // Get the elements array of the object. | 581 // Get the elements array of the object. |
582 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); | 582 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
583 // Check that the object is in fast mode (not dictionary). | 583 // Check that the object is in fast mode (not dictionary). |
584 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 584 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
585 __ cmp(r3, Operand(Factory::hash_table_map())); | 585 __ cmp(r3, Operand(Factory::fixed_array_map())); |
586 __ b(eq, &slow); | 586 __ b(ne, &slow); |
587 // Check that the key (index) is within bounds. | 587 // Check that the key (index) is within bounds. |
588 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); | 588 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); |
589 __ cmp(r0, Operand(r3)); | 589 __ cmp(r0, Operand(r3)); |
590 __ b(lo, &fast); | 590 __ b(lo, &fast); |
591 | 591 |
592 // Slow case: Push extra copies of the arguments (2). | 592 // Slow case: Push extra copies of the arguments (2). |
593 __ bind(&slow); | 593 __ bind(&slow); |
594 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); | 594 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); |
595 __ ldm(ia, sp, r0.bit() | r1.bit()); | 595 __ ldm(ia, sp, r0.bit() | r1.bit()); |
596 __ stm(db_w, sp, r0.bit() | r1.bit()); | 596 __ stm(db_w, sp, r0.bit() | r1.bit()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 __ b(eq, &array); | 654 __ b(eq, &array); |
655 // Check that the object is some kind of JS object. | 655 // Check that the object is some kind of JS object. |
656 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); | 656 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); |
657 __ b(lt, &slow); | 657 __ b(lt, &slow); |
658 | 658 |
659 | 659 |
660 // Object case: Check key against length in the elements array. | 660 // Object case: Check key against length in the elements array. |
661 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); | 661 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); |
662 // Check that the object is in fast mode (not dictionary). | 662 // Check that the object is in fast mode (not dictionary). |
663 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 663 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
664 __ cmp(r2, Operand(Factory::hash_table_map())); | 664 __ cmp(r2, Operand(Factory::fixed_array_map())); |
665 __ b(eq, &slow); | 665 __ b(ne, &slow); |
666 // Untag the key (for checking against untagged length in the fixed array). | 666 // Untag the key (for checking against untagged length in the fixed array). |
667 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); | 667 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
668 // Compute address to store into and check array bounds. | 668 // Compute address to store into and check array bounds. |
669 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 669 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
670 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | 670 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
671 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 671 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
672 __ cmp(r1, Operand(ip)); | 672 __ cmp(r1, Operand(ip)); |
673 __ b(lo, &fast); | 673 __ b(lo, &fast); |
674 | 674 |
675 | 675 |
(...skipping 27 matching lines...) Expand all Loading... |
703 __ b(&fast); | 703 __ b(&fast); |
704 | 704 |
705 | 705 |
706 // Array case: Get the length and the elements array from the JS | 706 // Array case: Get the length and the elements array from the JS |
707 // array. Check that the array is in fast mode; if it is the | 707 // array. Check that the array is in fast mode; if it is the |
708 // length is always a smi. | 708 // length is always a smi. |
709 // r0 == value, r3 == object | 709 // r0 == value, r3 == object |
710 __ bind(&array); | 710 __ bind(&array); |
711 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); | 711 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); |
712 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); | 712 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); |
713 __ cmp(r1, Operand(Factory::hash_table_map())); | 713 __ cmp(r1, Operand(Factory::fixed_array_map())); |
714 __ b(eq, &slow); | 714 __ b(ne, &slow); |
715 | 715 |
716 // Check the key against the length in the array, compute the | 716 // Check the key against the length in the array, compute the |
717 // address to store into and fall through to fast case. | 717 // address to store into and fall through to fast case. |
718 __ ldr(r1, MemOperand(sp)); // restore key | 718 __ ldr(r1, MemOperand(sp)); // restore key |
719 // r0 == value, r1 == key, r2 == elements, r3 == object. | 719 // r0 == value, r1 == key, r2 == elements, r3 == object. |
720 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); | 720 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); |
721 __ cmp(r1, Operand(ip)); | 721 __ cmp(r1, Operand(ip)); |
722 __ b(hs, &extra); | 722 __ b(hs, &extra); |
723 __ mov(r3, Operand(r2)); | 723 __ mov(r3, Operand(r2)); |
724 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 724 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 // Perform tail call to the entry. | 809 // Perform tail call to the entry. |
810 __ TailCallRuntime(f, 3); | 810 __ TailCallRuntime(f, 3); |
811 } | 811 } |
812 | 812 |
813 | 813 |
814 #undef __ | 814 #undef __ |
815 | 815 |
816 | 816 |
817 } } // namespace v8::internal | 817 } } // namespace v8::internal |
OLD | NEW |