OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 __ mov(scratch, FieldOperand(scratch, key, times_2, FixedArray::kHeaderSize)); | 484 __ mov(scratch, FieldOperand(scratch, key, times_2, FixedArray::kHeaderSize)); |
485 __ cmp(Operand(scratch), Immediate(Factory::the_hole_value())); | 485 __ cmp(Operand(scratch), Immediate(Factory::the_hole_value())); |
486 // In case the loaded value is the_hole we have to consult GetProperty | 486 // In case the loaded value is the_hole we have to consult GetProperty |
487 // to ensure the prototype chain is searched. | 487 // to ensure the prototype chain is searched. |
488 __ j(equal, out_of_range); | 488 __ j(equal, out_of_range); |
489 if (!result.is(scratch)) { | 489 if (!result.is(scratch)) { |
490 __ mov(result, scratch); | 490 __ mov(result, scratch); |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 // Loads a indexed element from a pixel array. | |
495 static void GenerateFastPixelArrayLoad(MacroAssembler* masm, | |
496 Register receiver, | |
497 Register key, | |
498 Register elements, | |
499 Register untagged_key, | |
500 Register result, | |
501 Label* not_pixel_array, | |
502 Label* key_not_smi, | |
503 Label* out_of_range) { | |
504 // Register use: | |
505 // receiver - holds the receiver and is unchanged. | |
506 // key - holds the key and is unchanged (must be a smi). | |
507 // elements - is set to the the receiver's element if | |
508 // the receiver doesn't have a pixel array or the | |
509 // key is not a smi, otherwise it's the elements' | |
510 // external pointer. | |
511 // untagged_key - is set to the untagged key | |
512 | |
513 // Key must be a smi.. | |
Mads Ager (chromium)
2011/01/28 10:39:16
.. -> .
| |
514 if (key_not_smi != NULL) { | |
515 __ test(key, Immediate(kSmiTagMask)); | |
516 __ j(not_zero, key_not_smi, not_taken); | |
517 } | |
518 __ mov(untagged_key, key); | |
519 __ SmiUntag(untagged_key); | |
520 | |
521 // Verify that the receiver has pixel array elements. | |
522 __ mov(elements, FieldOperand(receiver, JSObject::kElementsOffset)); | |
523 __ CheckMap(elements, Factory::pixel_array_map(), not_pixel_array, true); | |
524 | |
525 // Key must be in range. | |
526 Label oor; | |
Mads Ager (chromium)
2011/01/28 10:39:16
Unused label?
| |
527 __ cmp(untagged_key, FieldOperand(elements, PixelArray::kLengthOffset)); | |
528 __ j(above_equal, out_of_range); | |
529 | |
530 // Perform the indexed load and tag the result as a smi. | |
531 __ mov(elements, FieldOperand(elements, PixelArray::kExternalPointerOffset)); | |
532 __ movzx_b(result, Operand(elements, untagged_key, times_1, 0)); | |
533 __ SmiTag(result); | |
534 __ ret(0); | |
535 } | |
536 | |
494 | 537 |
495 // Checks whether a key is an array index string or a symbol string. | 538 // Checks whether a key is an array index string or a symbol string. |
496 // Falls through if the key is a symbol. | 539 // Falls through if the key is a symbol. |
497 static void GenerateKeyStringCheck(MacroAssembler* masm, | 540 static void GenerateKeyStringCheck(MacroAssembler* masm, |
498 Register key, | 541 Register key, |
499 Register map, | 542 Register map, |
500 Register hash, | 543 Register hash, |
501 Label* index_string, | 544 Label* index_string, |
502 Label* not_symbol) { | 545 Label* not_symbol) { |
503 // Register use: | 546 // Register use: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 edx, | 592 edx, |
550 eax, | 593 eax, |
551 ecx, | 594 ecx, |
552 eax, | 595 eax, |
553 NULL, | 596 NULL, |
554 &slow); | 597 &slow); |
555 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); | 598 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); |
556 __ ret(0); | 599 __ ret(0); |
557 | 600 |
558 __ bind(&check_pixel_array); | 601 __ bind(&check_pixel_array); |
559 // Check whether the elements is a pixel array. | 602 GenerateFastPixelArrayLoad(masm, |
560 // edx: receiver | 603 edx, |
561 // eax: key | 604 eax, |
562 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); | 605 ecx, |
563 __ mov(ebx, eax); | 606 ebx, |
564 __ SmiUntag(ebx); | 607 eax, |
565 __ CheckMap(ecx, Factory::pixel_array_map(), &check_number_dictionary, true); | 608 &check_number_dictionary, |
566 __ cmp(ebx, FieldOperand(ecx, PixelArray::kLengthOffset)); | 609 NULL, |
567 __ j(above_equal, &slow); | 610 &slow); |
568 __ mov(eax, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); | |
569 __ movzx_b(eax, Operand(eax, ebx, times_1, 0)); | |
570 __ SmiTag(eax); | |
571 __ ret(0); | |
572 | 611 |
573 __ bind(&check_number_dictionary); | 612 __ bind(&check_number_dictionary); |
574 // Check whether the elements is a number dictionary. | 613 // Check whether the elements is a number dictionary. |
575 // edx: receiver | 614 // edx: receiver |
576 // ebx: untagged index | 615 // ebx: untagged index |
577 // eax: key | 616 // eax: key |
578 // ecx: elements | 617 // ecx: elements |
579 __ CheckMap(ecx, Factory::hash_table_map(), &slow, true); | 618 __ CheckMap(ecx, Factory::hash_table_map(), &slow, true); |
580 Label slow_pop_receiver; | 619 Label slow_pop_receiver; |
581 // Push receiver on the stack to free up a register for the dictionary | 620 // Push receiver on the stack to free up a register for the dictionary |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 // Perform tail call to the entry. | 794 // Perform tail call to the entry. |
756 ExternalReference ref = ExternalReference( | 795 ExternalReference ref = ExternalReference( |
757 IC_Utility(kKeyedLoadPropertyWithInterceptor)); | 796 IC_Utility(kKeyedLoadPropertyWithInterceptor)); |
758 __ TailCallExternalReference(ref, 2, 1); | 797 __ TailCallExternalReference(ref, 2, 1); |
759 | 798 |
760 __ bind(&slow); | 799 __ bind(&slow); |
761 GenerateMiss(masm); | 800 GenerateMiss(masm); |
762 } | 801 } |
763 | 802 |
764 | 803 |
804 void KeyedLoadIC::GeneratePixelArray(MacroAssembler* masm) { | |
805 // ----------- S t a t e ------------- | |
806 // -- eax : key | |
807 // -- edx : receiver | |
808 // -- esp[0] : return address | |
809 // ----------------------------------- | |
810 Label slow; | |
811 | |
812 // Verify that it's safe to access the receiver's elements. | |
813 GenerateKeyedLoadReceiverCheck( | |
814 masm, edx, ecx, Map::kHasNamedInterceptor, &slow); | |
815 | |
816 GenerateFastPixelArrayLoad(masm, | |
817 edx, | |
818 eax, | |
819 ecx, | |
820 ebx, | |
821 eax, | |
822 &slow, | |
823 &slow, | |
824 &slow); | |
825 | |
826 __ bind(&slow); | |
827 GenerateMiss(masm); | |
828 } | |
829 | |
830 | |
765 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 831 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
766 // ----------- S t a t e ------------- | 832 // ----------- S t a t e ------------- |
767 // -- eax : value | 833 // -- eax : value |
768 // -- ecx : key | 834 // -- ecx : key |
769 // -- edx : receiver | 835 // -- edx : receiver |
770 // -- esp[0] : return address | 836 // -- esp[0] : return address |
771 // ----------------------------------- | 837 // ----------------------------------- |
772 Label slow, fast, array, extra, check_pixel_array; | 838 Label slow, fast, array, extra, check_pixel_array; |
773 | 839 |
774 // Check that the object isn't a smi. | 840 // Check that the object isn't a smi. |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1773 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1839 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1774 ? not_zero | 1840 ? not_zero |
1775 : zero; | 1841 : zero; |
1776 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1842 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1777 } | 1843 } |
1778 | 1844 |
1779 | 1845 |
1780 } } // namespace v8::internal | 1846 } } // namespace v8::internal |
1781 | 1847 |
1782 #endif // V8_TARGET_ARCH_IA32 | 1848 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |