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

Side by Side Diff: src/arm/ic-arm.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, 10 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/arm/full-codegen-arm.cc ('k') | src/arm/lithium-codegen-arm.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 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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 // ----------------------------------- 1393 // -----------------------------------
1394 1394
1395 // Push receiver, key and value for runtime call. 1395 // Push receiver, key and value for runtime call.
1396 __ Push(r2, r1, r0); 1396 __ Push(r2, r1, r0);
1397 1397
1398 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); 1398 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss));
1399 __ TailCallExternalReference(ref, 3, 1); 1399 __ TailCallExternalReference(ref, 3, 1);
1400 } 1400 }
1401 1401
1402 1402
1403 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { 1403 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1404 StrictModeFlag strict_mode) {
1404 // ---------- S t a t e -------------- 1405 // ---------- S t a t e --------------
1405 // -- r0 : value 1406 // -- r0 : value
1406 // -- r1 : key 1407 // -- r1 : key
1407 // -- r2 : receiver 1408 // -- r2 : receiver
1408 // -- lr : return address 1409 // -- lr : return address
1409 // ----------------------------------- 1410 // -----------------------------------
1410 1411
1411 // Push receiver, key and value for runtime call. 1412 // Push receiver, key and value for runtime call.
1412 __ Push(r2, r1, r0); 1413 __ Push(r2, r1, r0);
1413 1414
1414 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1415 __ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes
1416 __ mov(r0, Operand(Smi::FromInt(strict_mode))); // Strict mode.
1417 __ Push(r1, r0);
1418
1419 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1415 } 1420 }
1416 1421
1417 1422
1418 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 1423 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
1424 StrictModeFlag strict_mode) {
1419 // ---------- S t a t e -------------- 1425 // ---------- S t a t e --------------
1420 // -- r0 : value 1426 // -- r0 : value
1421 // -- r1 : key 1427 // -- r1 : key
1422 // -- r2 : receiver 1428 // -- r2 : receiver
1423 // -- lr : return address 1429 // -- lr : return address
1424 // ----------------------------------- 1430 // -----------------------------------
1425 Label slow, fast, array, extra, check_pixel_array; 1431 Label slow, fast, array, extra, check_pixel_array;
1426 1432
1427 // Register usage. 1433 // Register usage.
1428 Register value = r0; 1434 Register value = r0;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1469 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1464 __ cmp(key, Operand(ip)); 1470 __ cmp(key, Operand(ip));
1465 __ b(lo, &fast); 1471 __ b(lo, &fast);
1466 1472
1467 // Slow case, handle jump to runtime. 1473 // Slow case, handle jump to runtime.
1468 __ bind(&slow); 1474 __ bind(&slow);
1469 // Entry registers are intact. 1475 // Entry registers are intact.
1470 // r0: value. 1476 // r0: value.
1471 // r1: key. 1477 // r1: key.
1472 // r2: receiver. 1478 // r2: receiver.
1473 GenerateRuntimeSetProperty(masm); 1479 GenerateRuntimeSetProperty(masm, strict_mode);
1474 1480
1475 // Check whether the elements is a pixel array. 1481 // Check whether the elements is a pixel array.
1476 // r4: elements map. 1482 // r4: elements map.
1477 __ bind(&check_pixel_array); 1483 __ bind(&check_pixel_array);
1478 GenerateFastPixelArrayStore(masm, 1484 GenerateFastPixelArrayStore(masm,
1479 r2, 1485 r2,
1480 r1, 1486 r1,
1481 r0, 1487 r0,
1482 elements, 1488 elements,
1483 r4, 1489 r4,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 __ Ret(eq); 1539 __ Ret(eq);
1534 // Update write barrier for the elements array address. 1540 // Update write barrier for the elements array address.
1535 __ sub(r4, r5, Operand(elements)); 1541 __ sub(r4, r5, Operand(elements));
1536 __ RecordWrite(elements, Operand(r4), r5, r6); 1542 __ RecordWrite(elements, Operand(r4), r5, r6);
1537 1543
1538 __ Ret(); 1544 __ Ret();
1539 } 1545 }
1540 1546
1541 1547
1542 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1548 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1543 Code::ExtraICState extra_ic_state) { 1549 StrictModeFlag strict_mode) {
1544 // ----------- S t a t e ------------- 1550 // ----------- S t a t e -------------
1545 // -- r0 : value 1551 // -- r0 : value
1546 // -- r1 : receiver 1552 // -- r1 : receiver
1547 // -- r2 : name 1553 // -- r2 : name
1548 // -- lr : return address 1554 // -- lr : return address
1549 // ----------------------------------- 1555 // -----------------------------------
1550 1556
1551 // Get the receiver from the stack and probe the stub cache. 1557 // Get the receiver from the stack and probe the stub cache.
1552 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, 1558 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
1553 NOT_IN_LOOP, 1559 NOT_IN_LOOP,
1554 MONOMORPHIC, 1560 MONOMORPHIC,
1555 extra_ic_state); 1561 strict_mode);
1556 StubCache::GenerateProbe(masm, flags, r1, r2, r3, r4, r5); 1562 StubCache::GenerateProbe(masm, flags, r1, r2, r3, r4, r5);
1557 1563
1558 // Cache miss: Jump to runtime. 1564 // Cache miss: Jump to runtime.
1559 GenerateMiss(masm); 1565 GenerateMiss(masm);
1560 } 1566 }
1561 1567
1562 1568
1563 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1569 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1564 // ----------- S t a t e ------------- 1570 // ----------- S t a t e -------------
1565 // -- r0 : value 1571 // -- r0 : value
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 GenerateDictionaryStore(masm, &miss, r3, r2, r0, r4, r5); 1645 GenerateDictionaryStore(masm, &miss, r3, r2, r0, r4, r5);
1640 __ IncrementCounter(&Counters::store_normal_hit, 1, r4, r5); 1646 __ IncrementCounter(&Counters::store_normal_hit, 1, r4, r5);
1641 __ Ret(); 1647 __ Ret();
1642 1648
1643 __ bind(&miss); 1649 __ bind(&miss);
1644 __ IncrementCounter(&Counters::store_normal_miss, 1, r4, r5); 1650 __ IncrementCounter(&Counters::store_normal_miss, 1, r4, r5);
1645 GenerateMiss(masm); 1651 GenerateMiss(masm);
1646 } 1652 }
1647 1653
1648 1654
1649 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm) { 1655 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm, StrictModeFlag strict) {
1650 // ----------- S t a t e ------------- 1656 // ----------- S t a t e -------------
1651 // -- r0 : value 1657 // -- r0 : value
1652 // -- r1 : receiver 1658 // -- r1 : receiver
1653 // -- r2 : name 1659 // -- r2 : name
1654 // -- lr : return address 1660 // -- lr : return address
1655 // ----------------------------------- 1661 // -----------------------------------
1656 1662
1657 __ Push(r1, r2, r0); 1663 __ Push(r1, r2, r0);
1658 1664
1665 __ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes
1666 __ mov(r0, Operand(Smi::FromInt(strict)));
1667 __ Push(r1, r0);
1668
1659 // Do tail-call to runtime routine. 1669 // Do tail-call to runtime routine.
1660 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1670 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1661 } 1671 }
1662 1672
1663 1673
1664 #undef __ 1674 #undef __
1665 1675
1666 1676
1667 Condition CompareIC::ComputeCondition(Token::Value op) { 1677 Condition CompareIC::ComputeCondition(Token::Value op) {
1668 switch (op) { 1678 switch (op) {
1669 case Token::EQ_STRICT: 1679 case Token::EQ_STRICT:
1670 case Token::EQ: 1680 case Token::EQ:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 Register reg = Assembler::GetRn(instr_at_patch); 1789 Register reg = Assembler::GetRn(instr_at_patch);
1780 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1790 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1781 patcher.EmitCondition(eq); 1791 patcher.EmitCondition(eq);
1782 } 1792 }
1783 } 1793 }
1784 1794
1785 1795
1786 } } // namespace v8::internal 1796 } } // namespace v8::internal
1787 1797
1788 #endif // V8_TARGET_ARCH_ARM 1798 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698