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

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

Issue 6576024: (early draft) Strict mode - throw exception on assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Assign to read only property in strict mode. Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // Perform tail call to the entry. 754 // Perform tail call to the entry.
755 ExternalReference ref = ExternalReference( 755 ExternalReference ref = ExternalReference(
756 IC_Utility(kKeyedLoadPropertyWithInterceptor)); 756 IC_Utility(kKeyedLoadPropertyWithInterceptor));
757 __ TailCallExternalReference(ref, 2, 1); 757 __ TailCallExternalReference(ref, 2, 1);
758 758
759 __ bind(&slow); 759 __ bind(&slow);
760 GenerateMiss(masm); 760 GenerateMiss(masm);
761 } 761 }
762 762
763 763
764 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 764 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
765 StrictModeFlag strict_mode) {
765 // ----------- S t a t e ------------- 766 // ----------- S t a t e -------------
766 // -- eax : value 767 // -- eax : value
767 // -- ecx : key 768 // -- ecx : key
768 // -- edx : receiver 769 // -- edx : receiver
769 // -- esp[0] : return address 770 // -- esp[0] : return address
770 // ----------------------------------- 771 // -----------------------------------
771 Label slow, fast, array, extra, check_pixel_array; 772 Label slow, fast, array, extra, check_pixel_array;
772 773
773 // Check that the object isn't a smi. 774 // Check that the object isn't a smi.
774 __ test(edx, Immediate(kSmiTagMask)); 775 __ test(edx, Immediate(kSmiTagMask));
(...skipping 19 matching lines...) Expand all
794 // edx: JSObject 795 // edx: JSObject
795 // ecx: key (a smi) 796 // ecx: key (a smi)
796 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); 797 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
797 // Check that the object is in fast mode and writable. 798 // Check that the object is in fast mode and writable.
798 __ CheckMap(edi, Factory::fixed_array_map(), &check_pixel_array, true); 799 __ CheckMap(edi, Factory::fixed_array_map(), &check_pixel_array, true);
799 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); 800 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
800 __ j(below, &fast, taken); 801 __ j(below, &fast, taken);
801 802
802 // Slow case: call runtime. 803 // Slow case: call runtime.
803 __ bind(&slow); 804 __ bind(&slow);
804 GenerateRuntimeSetProperty(masm); 805 GenerateRuntimeSetProperty(masm, strict_mode);
805 806
806 // Check whether the elements is a pixel array. 807 // Check whether the elements is a pixel array.
807 __ bind(&check_pixel_array); 808 __ bind(&check_pixel_array);
808 // eax: value 809 // eax: value
809 // ecx: key (a smi) 810 // ecx: key (a smi)
810 // edx: receiver 811 // edx: receiver
811 // edi: elements array 812 // edi: elements array
812 GenerateFastPixelArrayStore(masm, 813 GenerateFastPixelArrayStore(masm,
813 edx, 814 edx,
814 ecx, 815 ecx,
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 __ push(edx); // receiver 1482 __ push(edx); // receiver
1482 __ push(eax); // name 1483 __ push(eax); // name
1483 __ push(ebx); // return address 1484 __ push(ebx); // return address
1484 1485
1485 // Perform tail call to the entry. 1486 // Perform tail call to the entry.
1486 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 1487 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
1487 } 1488 }
1488 1489
1489 1490
1490 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1491 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1491 Code::ExtraICState extra_ic_state) { 1492 StrictModeFlag strict_mode) {
1492 // ----------- S t a t e ------------- 1493 // ----------- S t a t e -------------
1493 // -- eax : value 1494 // -- eax : value
1494 // -- ecx : name 1495 // -- ecx : name
1495 // -- edx : receiver 1496 // -- edx : receiver
1496 // -- esp[0] : return address 1497 // -- esp[0] : return address
1497 // ----------------------------------- 1498 // -----------------------------------
1498 1499
1499 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, 1500 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
1500 NOT_IN_LOOP, 1501 NOT_IN_LOOP,
1501 MONOMORPHIC, 1502 MONOMORPHIC,
1502 extra_ic_state); 1503 strict_mode);
1503 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx, no_reg); 1504 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx, no_reg);
1504 1505
1505 // Cache miss: Jump to runtime. 1506 // Cache miss: Jump to runtime.
1506 GenerateMiss(masm); 1507 GenerateMiss(masm);
1507 } 1508 }
1508 1509
1509 1510
1510 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1511 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1511 // ----------- S t a t e ------------- 1512 // ----------- S t a t e -------------
1512 // -- eax : value 1513 // -- eax : value
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 1611
1611 __ bind(&restore_miss); 1612 __ bind(&restore_miss);
1612 __ pop(edx); 1613 __ pop(edx);
1613 1614
1614 __ bind(&miss); 1615 __ bind(&miss);
1615 __ IncrementCounter(&Counters::store_normal_miss, 1); 1616 __ IncrementCounter(&Counters::store_normal_miss, 1);
1616 GenerateMiss(masm); 1617 GenerateMiss(masm);
1617 } 1618 }
1618 1619
1619 1620
1620 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm) { 1621 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm, StrictModeFlag strict) {
1621 // ----------- S t a t e ------------- 1622 // ----------- S t a t e -------------
1622 // -- eax : value 1623 // -- eax : value
1623 // -- ecx : name 1624 // -- ecx : name
1624 // -- edx : receiver 1625 // -- edx : receiver
1625 // -- esp[0] : return address 1626 // -- esp[0] : return address
1626 // ----------------------------------- 1627 // -----------------------------------
1627 __ pop(ebx); 1628 __ pop(ebx);
1628 __ push(edx); 1629 __ push(edx);
1629 __ push(ecx); 1630 __ push(ecx);
1630 __ push(eax); 1631 __ push(eax);
1631 __ push(ebx); 1632 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
1633 __ push(Immediate(Smi::FromInt(strict)));
1634 __ push(ebx); // return address
1632 1635
1633 // Do tail-call to runtime routine. 1636 // Do tail-call to runtime routine.
1634 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1637 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1635 } 1638 }
1636 1639
1637 1640
1638 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { 1641 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1642 StrictModeFlag strict_mode) {
1639 // ----------- S t a t e ------------- 1643 // ----------- S t a t e -------------
1640 // -- eax : value 1644 // -- eax : value
1641 // -- ecx : key 1645 // -- ecx : key
1642 // -- edx : receiver 1646 // -- edx : receiver
1643 // -- esp[0] : return address 1647 // -- esp[0] : return address
1644 // ----------------------------------- 1648 // -----------------------------------
1645 1649
1646 __ pop(ebx); 1650 __ pop(ebx);
1647 __ push(edx); 1651 __ push(edx);
1648 __ push(ecx); 1652 __ push(ecx);
1649 __ push(eax); 1653 __ push(eax);
1650 __ push(ebx); 1654 __ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
1655 __ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode.
1656 __ push(ebx); // return address
1651 1657
1652 // Do tail-call to runtime routine. 1658 // Do tail-call to runtime routine.
1653 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1659 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1654 } 1660 }
1655 1661
1656 1662
1657 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { 1663 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
1658 // ----------- S t a t e ------------- 1664 // ----------- S t a t e -------------
1659 // -- eax : value 1665 // -- eax : value
1660 // -- ecx : key 1666 // -- ecx : key
1661 // -- edx : receiver 1667 // -- edx : receiver
1662 // -- esp[0] : return address 1668 // -- esp[0] : return address
1663 // ----------------------------------- 1669 // -----------------------------------
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1776 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1771 ? not_zero 1777 ? not_zero
1772 : zero; 1778 : zero;
1773 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1779 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1774 } 1780 }
1775 1781
1776 1782
1777 } } // namespace v8::internal 1783 } } // namespace v8::internal
1778 1784
1779 #endif // V8_TARGET_ARCH_IA32 1785 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698