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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // objects work as intended. | 568 // objects work as intended. |
569 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 569 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
570 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 570 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
571 __ cmp(r2, Operand(JS_OBJECT_TYPE)); | 571 __ cmp(r2, Operand(JS_OBJECT_TYPE)); |
572 __ b(lt, &slow); | 572 __ b(lt, &slow); |
573 | 573 |
574 // Get the elements array of the object. | 574 // Get the elements array of the object. |
575 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); | 575 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
576 // Check that the object is in fast mode (not dictionary). | 576 // Check that the object is in fast mode (not dictionary). |
577 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 577 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
578 __ cmp(r3, Operand(Factory::hash_table_map())); | 578 __ cmp(r3, Operand(Factory::fixed_array_map())); |
579 __ b(eq, &slow); | 579 __ b(ne, &slow); |
580 // Check that the key (index) is within bounds. | 580 // Check that the key (index) is within bounds. |
581 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); | 581 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); |
582 __ cmp(r0, Operand(r3)); | 582 __ cmp(r0, Operand(r3)); |
583 __ b(lo, &fast); | 583 __ b(lo, &fast); |
584 | 584 |
585 // Slow case: Push extra copies of the arguments (2). | 585 // Slow case: Push extra copies of the arguments (2). |
586 __ bind(&slow); | 586 __ bind(&slow); |
587 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); | 587 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); |
588 __ ldm(ia, sp, r0.bit() | r1.bit()); | 588 __ ldm(ia, sp, r0.bit() | r1.bit()); |
589 __ stm(db_w, sp, r0.bit() | r1.bit()); | 589 __ stm(db_w, sp, r0.bit() | r1.bit()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 __ b(eq, &array); | 647 __ b(eq, &array); |
648 // Check that the object is some kind of JS object. | 648 // Check that the object is some kind of JS object. |
649 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); | 649 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); |
650 __ b(lt, &slow); | 650 __ b(lt, &slow); |
651 | 651 |
652 | 652 |
653 // Object case: Check key against length in the elements array. | 653 // Object case: Check key against length in the elements array. |
654 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); | 654 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); |
655 // Check that the object is in fast mode (not dictionary). | 655 // Check that the object is in fast mode (not dictionary). |
656 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 656 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
657 __ cmp(r2, Operand(Factory::hash_table_map())); | 657 __ cmp(r2, Operand(Factory::fixed_array_map())); |
658 __ b(eq, &slow); | 658 __ b(ne, &slow); |
659 // Untag the key (for checking against untagged length in the fixed array). | 659 // Untag the key (for checking against untagged length in the fixed array). |
660 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); | 660 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
661 // Compute address to store into and check array bounds. | 661 // Compute address to store into and check array bounds. |
662 __ add(r2, r3, Operand(Array::kHeaderSize - kHeapObjectTag)); | 662 __ add(r2, r3, Operand(Array::kHeaderSize - kHeapObjectTag)); |
663 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | 663 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
664 __ ldr(ip, FieldMemOperand(r3, Array::kLengthOffset)); | 664 __ ldr(ip, FieldMemOperand(r3, Array::kLengthOffset)); |
665 __ cmp(r1, Operand(ip)); | 665 __ cmp(r1, Operand(ip)); |
666 __ b(lo, &fast); | 666 __ b(lo, &fast); |
667 | 667 |
668 | 668 |
(...skipping 27 matching lines...) Expand all Loading... |
696 __ b(&fast); | 696 __ b(&fast); |
697 | 697 |
698 | 698 |
699 // Array case: Get the length and the elements array from the JS | 699 // Array case: Get the length and the elements array from the JS |
700 // array. Check that the array is in fast mode; if it is the | 700 // array. Check that the array is in fast mode; if it is the |
701 // length is always a smi. | 701 // length is always a smi. |
702 // r0 == value, r3 == object | 702 // r0 == value, r3 == object |
703 __ bind(&array); | 703 __ bind(&array); |
704 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); | 704 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); |
705 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); | 705 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); |
706 __ cmp(r1, Operand(Factory::hash_table_map())); | 706 __ cmp(r1, Operand(Factory::fixed_array_map())); |
707 __ b(eq, &slow); | 707 __ b(ne, &slow); |
708 | 708 |
709 // Check the key against the length in the array, compute the | 709 // Check the key against the length in the array, compute the |
710 // address to store into and fall through to fast case. | 710 // address to store into and fall through to fast case. |
711 __ ldr(r1, MemOperand(sp)); // restore key | 711 __ ldr(r1, MemOperand(sp)); // restore key |
712 // r0 == value, r1 == key, r2 == elements, r3 == object. | 712 // r0 == value, r1 == key, r2 == elements, r3 == object. |
713 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); | 713 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); |
714 __ cmp(r1, Operand(ip)); | 714 __ cmp(r1, Operand(ip)); |
715 __ b(hs, &extra); | 715 __ b(hs, &extra); |
716 __ mov(r3, Operand(r2)); | 716 __ mov(r3, Operand(r2)); |
717 __ add(r2, r2, Operand(Array::kHeaderSize - kHeapObjectTag)); | 717 __ add(r2, r2, Operand(Array::kHeaderSize - kHeapObjectTag)); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 801 |
802 // Perform tail call to the entry. | 802 // Perform tail call to the entry. |
803 __ TailCallRuntime(f, 3); | 803 __ TailCallRuntime(f, 3); |
804 } | 804 } |
805 | 805 |
806 | 806 |
807 #undef __ | 807 #undef __ |
808 | 808 |
809 | 809 |
810 } } // namespace v8::internal | 810 } } // namespace v8::internal |
OLD | NEW |