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

Side by Side Diff: src/x64/ic-x64.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/x64/full-codegen-x64.cc ('k') | src/x64/lithium-codegen-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 759
760 // Perform tail call to the entry. 760 // Perform tail call to the entry.
761 __ TailCallExternalReference(ExternalReference( 761 __ TailCallExternalReference(ExternalReference(
762 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1); 762 IC_Utility(kKeyedLoadPropertyWithInterceptor)), 2, 1);
763 763
764 __ bind(&slow); 764 __ bind(&slow);
765 GenerateMiss(masm); 765 GenerateMiss(masm);
766 } 766 }
767 767
768 768
769 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 769 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
770 StrictModeFlag strict_mode) {
770 // ----------- S t a t e ------------- 771 // ----------- S t a t e -------------
771 // -- rax : value 772 // -- rax : value
772 // -- rcx : key 773 // -- rcx : key
773 // -- rdx : receiver 774 // -- rdx : receiver
774 // -- rsp[0] : return address 775 // -- rsp[0] : return address
775 // ----------------------------------- 776 // -----------------------------------
776 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array; 777 Label slow, slow_with_tagged_index, fast, array, extra, check_pixel_array;
777 778
778 // Check that the object isn't a smi. 779 // Check that the object isn't a smi.
779 __ JumpIfSmi(rdx, &slow_with_tagged_index); 780 __ JumpIfSmi(rdx, &slow_with_tagged_index);
(...skipping 26 matching lines...) Expand all
806 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx); 807 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), rcx);
807 // rax: value 808 // rax: value
808 // rbx: FixedArray 809 // rbx: FixedArray
809 // rcx: index 810 // rcx: index
810 __ j(above, &fast); 811 __ j(above, &fast);
811 812
812 // Slow case: call runtime. 813 // Slow case: call runtime.
813 __ bind(&slow); 814 __ bind(&slow);
814 __ Integer32ToSmi(rcx, rcx); 815 __ Integer32ToSmi(rcx, rcx);
815 __ bind(&slow_with_tagged_index); 816 __ bind(&slow_with_tagged_index);
816 GenerateRuntimeSetProperty(masm); 817 GenerateRuntimeSetProperty(masm, strict_mode);
817 // Never returns to here. 818 // Never returns to here.
818 819
819 // Check whether the elements is a pixel array. 820 // Check whether the elements is a pixel array.
820 // rax: value 821 // rax: value
821 // rdx: receiver 822 // rdx: receiver
822 // rbx: receiver's elements array 823 // rbx: receiver's elements array
823 // rcx: index, zero-extended. 824 // rcx: index, zero-extended.
824 __ bind(&check_pixel_array); 825 __ bind(&check_pixel_array);
825 GenerateFastPixelArrayStore(masm, 826 GenerateFastPixelArrayStore(masm,
826 rdx, 827 rdx,
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 __ push(rdx); // receiver 1468 __ push(rdx); // receiver
1468 __ push(rax); // name 1469 __ push(rax); // name
1469 __ push(rbx); // return address 1470 __ push(rbx); // return address
1470 1471
1471 // Perform tail call to the entry. 1472 // Perform tail call to the entry.
1472 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 1473 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
1473 } 1474 }
1474 1475
1475 1476
1476 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1477 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1477 Code::ExtraICState extra_ic_state) { 1478 StrictModeFlag strict_mode) {
1478 // ----------- S t a t e ------------- 1479 // ----------- S t a t e -------------
1479 // -- rax : value 1480 // -- rax : value
1480 // -- rcx : name 1481 // -- rcx : name
1481 // -- rdx : receiver 1482 // -- rdx : receiver
1482 // -- rsp[0] : return address 1483 // -- rsp[0] : return address
1483 // ----------------------------------- 1484 // -----------------------------------
1484 1485
1485 // Get the receiver from the stack and probe the stub cache. 1486 // Get the receiver from the stack and probe the stub cache.
1486 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, 1487 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
1487 NOT_IN_LOOP, 1488 NOT_IN_LOOP,
1488 MONOMORPHIC, 1489 MONOMORPHIC,
1489 extra_ic_state); 1490 strict_mode);
1490 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); 1491 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg);
1491 1492
1492 // Cache miss: Jump to runtime. 1493 // Cache miss: Jump to runtime.
1493 GenerateMiss(masm); 1494 GenerateMiss(masm);
1494 } 1495 }
1495 1496
1496 1497
1497 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1498 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1498 // ----------- S t a t e ------------- 1499 // ----------- S t a t e -------------
1499 // -- rax : value 1500 // -- rax : value
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 GenerateDictionaryStore(masm, &miss, rbx, rcx, rax, r8, r9); 1587 GenerateDictionaryStore(masm, &miss, rbx, rcx, rax, r8, r9);
1587 __ IncrementCounter(&Counters::store_normal_hit, 1); 1588 __ IncrementCounter(&Counters::store_normal_hit, 1);
1588 __ ret(0); 1589 __ ret(0);
1589 1590
1590 __ bind(&miss); 1591 __ bind(&miss);
1591 __ IncrementCounter(&Counters::store_normal_miss, 1); 1592 __ IncrementCounter(&Counters::store_normal_miss, 1);
1592 GenerateMiss(masm); 1593 GenerateMiss(masm);
1593 } 1594 }
1594 1595
1595 1596
1596 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm) { 1597 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm, StrictModeFlag strict) {
1597 // ----------- S t a t e ------------- 1598 // ----------- S t a t e -------------
1598 // -- rax : value 1599 // -- rax : value
1599 // -- rcx : name 1600 // -- rcx : name
1600 // -- rdx : receiver 1601 // -- rdx : receiver
1601 // -- rsp[0] : return address 1602 // -- rsp[0] : return address
1602 // ----------------------------------- 1603 // -----------------------------------
1603 __ pop(rbx); 1604 __ pop(rbx);
1604 __ push(rdx); 1605 __ push(rdx);
1605 __ push(rcx); 1606 __ push(rcx);
1606 __ push(rax); 1607 __ push(rax);
1607 __ push(rbx); 1608 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1609 __ Push(Smi::FromInt(strict));
1610 __ push(rbx); // return address
1608 1611
1609 // Do tail-call to runtime routine. 1612 // Do tail-call to runtime routine.
1610 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1613 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1611 } 1614 }
1612 1615
1613 1616
1614 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { 1617 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1618 StrictModeFlag strict_mode) {
1615 // ----------- S t a t e ------------- 1619 // ----------- S t a t e -------------
1616 // -- rax : value 1620 // -- rax : value
1617 // -- rcx : key 1621 // -- rcx : key
1618 // -- rdx : receiver 1622 // -- rdx : receiver
1619 // -- rsp[0] : return address 1623 // -- rsp[0] : return address
1620 // ----------------------------------- 1624 // -----------------------------------
1621 1625
1622 __ pop(rbx); 1626 __ pop(rbx);
1623 __ push(rdx); // receiver 1627 __ push(rdx); // receiver
1624 __ push(rcx); // key 1628 __ push(rcx); // key
1625 __ push(rax); // value 1629 __ push(rax); // value
1630 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1631 __ Push(Smi::FromInt(strict_mode)); // Strict mode.
1626 __ push(rbx); // return address 1632 __ push(rbx); // return address
1627 1633
1628 // Do tail-call to runtime routine. 1634 // Do tail-call to runtime routine.
1629 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1635 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1630 } 1636 }
1631 1637
1632 1638
1633 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { 1639 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
1634 // ----------- S t a t e ------------- 1640 // ----------- S t a t e -------------
1635 // -- rax : value 1641 // -- rax : value
1636 // -- rcx : key 1642 // -- rcx : key
1637 // -- rdx : receiver 1643 // -- rdx : receiver
1638 // -- rsp[0] : return address 1644 // -- rsp[0] : return address
1639 // ----------------------------------- 1645 // -----------------------------------
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1751 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1746 ? not_zero 1752 ? not_zero
1747 : zero; 1753 : zero;
1748 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1754 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1749 } 1755 }
1750 1756
1751 1757
1752 } } // namespace v8::internal 1758 } } // namespace v8::internal
1753 1759
1754 #endif // V8_TARGET_ARCH_X64 1760 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698