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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Possible work-around for http://crbug.com/16276. | 80 // Possible work-around for http://crbug.com/16276. |
81 // See also: http://codereview.chromium.org/155418. | 81 // See also: http://codereview.chromium.org/155418. |
82 __ cmp(r3, Operand(JS_GLOBAL_OBJECT_TYPE)); | 82 __ cmp(r3, Operand(JS_GLOBAL_OBJECT_TYPE)); |
83 __ b(eq, miss); | 83 __ b(eq, miss); |
84 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); | 84 __ cmp(r3, Operand(JS_BUILTINS_OBJECT_TYPE)); |
85 __ b(eq, miss); | 85 __ b(eq, miss); |
86 | 86 |
87 // Check that the properties array is a dictionary. | 87 // Check that the properties array is a dictionary. |
88 __ ldr(t0, FieldMemOperand(t1, JSObject::kPropertiesOffset)); | 88 __ ldr(t0, FieldMemOperand(t1, JSObject::kPropertiesOffset)); |
89 __ ldr(r3, FieldMemOperand(t0, HeapObject::kMapOffset)); | 89 __ ldr(r3, FieldMemOperand(t0, HeapObject::kMapOffset)); |
90 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 90 __ cmp(r3, Operand(Factory::hash_table_map())); |
91 __ cmp(r3, ip); | |
92 __ b(ne, miss); | 91 __ b(ne, miss); |
93 | 92 |
94 // Compute the capacity mask. | 93 // Compute the capacity mask. |
95 const int kCapacityOffset = StringDictionary::kHeaderSize + | 94 const int kCapacityOffset = StringDictionary::kHeaderSize + |
96 StringDictionary::kCapacityIndex * kPointerSize; | 95 StringDictionary::kCapacityIndex * kPointerSize; |
97 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset)); | 96 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset)); |
98 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int | 97 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int |
99 __ sub(r3, r3, Operand(1)); | 98 __ sub(r3, r3, Operand(1)); |
100 | 99 |
101 const int kElementsStartOffset = StringDictionary::kHeaderSize + | 100 const int kElementsStartOffset = StringDictionary::kHeaderSize + |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // Check for string. | 247 // Check for string. |
249 __ bind(&non_number); | 248 __ bind(&non_number); |
250 __ cmp(r3, Operand(FIRST_NONSTRING_TYPE)); | 249 __ cmp(r3, Operand(FIRST_NONSTRING_TYPE)); |
251 __ b(hs, &non_string); | 250 __ b(hs, &non_string); |
252 StubCompiler::GenerateLoadGlobalFunctionPrototype( | 251 StubCompiler::GenerateLoadGlobalFunctionPrototype( |
253 masm, Context::STRING_FUNCTION_INDEX, r1); | 252 masm, Context::STRING_FUNCTION_INDEX, r1); |
254 __ b(&probe); | 253 __ b(&probe); |
255 | 254 |
256 // Check for boolean. | 255 // Check for boolean. |
257 __ bind(&non_string); | 256 __ bind(&non_string); |
258 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 257 __ cmp(r1, Operand(Factory::true_value())); |
259 __ cmp(r1, ip); | |
260 __ b(eq, &boolean); | 258 __ b(eq, &boolean); |
261 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 259 __ cmp(r1, Operand(Factory::false_value())); |
262 __ cmp(r1, ip); | |
263 __ b(ne, &miss); | 260 __ b(ne, &miss); |
264 __ bind(&boolean); | 261 __ bind(&boolean); |
265 StubCompiler::GenerateLoadGlobalFunctionPrototype( | 262 StubCompiler::GenerateLoadGlobalFunctionPrototype( |
266 masm, Context::BOOLEAN_FUNCTION_INDEX, r1); | 263 masm, Context::BOOLEAN_FUNCTION_INDEX, r1); |
267 | 264 |
268 // Probe the stub cache for the value object. | 265 // Probe the stub cache for the value object. |
269 __ bind(&probe); | 266 __ bind(&probe); |
270 StubCache::GenerateProbe(masm, flags, r1, r2, r3, no_reg); | 267 StubCache::GenerateProbe(masm, flags, r1, r2, r3, no_reg); |
271 | 268 |
272 // Cache miss: Jump to runtime. | 269 // Cache miss: Jump to runtime. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // objects work as intended. | 575 // objects work as intended. |
579 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 576 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
580 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 577 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
581 __ cmp(r2, Operand(JS_OBJECT_TYPE)); | 578 __ cmp(r2, Operand(JS_OBJECT_TYPE)); |
582 __ b(lt, &slow); | 579 __ b(lt, &slow); |
583 | 580 |
584 // Get the elements array of the object. | 581 // Get the elements array of the object. |
585 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); | 582 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
586 // Check that the object is in fast mode (not dictionary). | 583 // Check that the object is in fast mode (not dictionary). |
587 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 584 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
588 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 585 __ cmp(r3, Operand(Factory::fixed_array_map())); |
589 __ cmp(r3, ip); | |
590 __ b(ne, &slow); | 586 __ b(ne, &slow); |
591 // Check that the key (index) is within bounds. | 587 // Check that the key (index) is within bounds. |
592 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); | 588 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); |
593 __ cmp(r0, Operand(r3)); | 589 __ cmp(r0, Operand(r3)); |
594 __ b(lo, &fast); | 590 __ b(lo, &fast); |
595 | 591 |
596 // Slow case: Push extra copies of the arguments (2). | 592 // Slow case: Push extra copies of the arguments (2). |
597 __ bind(&slow); | 593 __ bind(&slow); |
598 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); | 594 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); |
599 __ ldm(ia, sp, r0.bit() | r1.bit()); | 595 __ ldm(ia, sp, r0.bit() | r1.bit()); |
600 __ stm(db_w, sp, r0.bit() | r1.bit()); | 596 __ stm(db_w, sp, r0.bit() | r1.bit()); |
601 // Do tail-call to runtime routine. | 597 // Do tail-call to runtime routine. |
602 __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2); | 598 __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2); |
603 | 599 |
604 // Fast case: Do the load. | 600 // Fast case: Do the load. |
605 __ bind(&fast); | 601 __ bind(&fast); |
606 __ add(r3, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 602 __ add(r3, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
607 __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2)); | 603 __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2)); |
608 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 604 __ cmp(r0, Operand(Factory::the_hole_value())); |
609 __ cmp(r0, ip); | |
610 // In case the loaded value is the_hole we have to consult GetProperty | 605 // In case the loaded value is the_hole we have to consult GetProperty |
611 // to ensure the prototype chain is searched. | 606 // to ensure the prototype chain is searched. |
612 __ b(eq, &slow); | 607 __ b(eq, &slow); |
613 | 608 |
614 __ Ret(); | 609 __ Ret(); |
615 } | 610 } |
616 | 611 |
617 | 612 |
618 void KeyedStoreIC::Generate(MacroAssembler* masm, | 613 void KeyedStoreIC::Generate(MacroAssembler* masm, |
619 const ExternalReference& f) { | 614 const ExternalReference& f) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 __ b(eq, &array); | 654 __ b(eq, &array); |
660 // Check that the object is some kind of JS object. | 655 // Check that the object is some kind of JS object. |
661 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); | 656 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); |
662 __ b(lt, &slow); | 657 __ b(lt, &slow); |
663 | 658 |
664 | 659 |
665 // Object case: Check key against length in the elements array. | 660 // Object case: Check key against length in the elements array. |
666 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); | 661 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); |
667 // Check that the object is in fast mode (not dictionary). | 662 // Check that the object is in fast mode (not dictionary). |
668 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 663 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
669 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 664 __ cmp(r2, Operand(Factory::fixed_array_map())); |
670 __ cmp(r2, ip); | |
671 __ b(ne, &slow); | 665 __ b(ne, &slow); |
672 // 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). |
673 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); | 667 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
674 // Compute address to store into and check array bounds. | 668 // Compute address to store into and check array bounds. |
675 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 669 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
676 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | 670 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
677 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 671 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
678 __ cmp(r1, Operand(ip)); | 672 __ cmp(r1, Operand(ip)); |
679 __ b(lo, &fast); | 673 __ b(lo, &fast); |
680 | 674 |
(...skipping 28 matching lines...) Expand all Loading... |
709 __ b(&fast); | 703 __ b(&fast); |
710 | 704 |
711 | 705 |
712 // 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 |
713 // 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 |
714 // length is always a smi. | 708 // length is always a smi. |
715 // r0 == value, r3 == object | 709 // r0 == value, r3 == object |
716 __ bind(&array); | 710 __ bind(&array); |
717 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); | 711 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); |
718 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); | 712 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); |
719 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 713 __ cmp(r1, Operand(Factory::fixed_array_map())); |
720 __ cmp(r1, ip); | |
721 __ b(ne, &slow); | 714 __ b(ne, &slow); |
722 | 715 |
723 // Check the key against the length in the array, compute the | 716 // Check the key against the length in the array, compute the |
724 // address to store into and fall through to fast case. | 717 // address to store into and fall through to fast case. |
725 __ ldr(r1, MemOperand(sp)); // restore key | 718 __ ldr(r1, MemOperand(sp)); // restore key |
726 // r0 == value, r1 == key, r2 == elements, r3 == object. | 719 // r0 == value, r1 == key, r2 == elements, r3 == object. |
727 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); | 720 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); |
728 __ cmp(r1, Operand(ip)); | 721 __ cmp(r1, Operand(ip)); |
729 __ b(hs, &extra); | 722 __ b(hs, &extra); |
730 __ mov(r3, Operand(r2)); | 723 __ mov(r3, Operand(r2)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 808 |
816 // Perform tail call to the entry. | 809 // Perform tail call to the entry. |
817 __ TailCallRuntime(f, 3); | 810 __ TailCallRuntime(f, 3); |
818 } | 811 } |
819 | 812 |
820 | 813 |
821 #undef __ | 814 #undef __ |
822 | 815 |
823 | 816 |
824 } } // namespace v8::internal | 817 } } // namespace v8::internal |
OLD | NEW |