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

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

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: 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/arm/full-codegen-arm.cc ('k') | src/arm/lithium-arm.h » ('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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 } 1167 }
1168 1168
1169 1169
1170 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 1170 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
1171 // ---------- S t a t e -------------- 1171 // ---------- S t a t e --------------
1172 // -- lr : return address 1172 // -- lr : return address
1173 // -- r0 : key 1173 // -- r0 : key
1174 // -- r1 : receiver 1174 // -- r1 : receiver
1175 // ----------------------------------- 1175 // -----------------------------------
1176 Label slow, check_string, index_smi, index_string, property_array_property; 1176 Label slow, check_string, index_smi, index_string, property_array_property;
1177 Label check_pixel_array, probe_dictionary, check_number_dictionary; 1177 Label probe_dictionary, check_number_dictionary;
1178 1178
1179 Register key = r0; 1179 Register key = r0;
1180 Register receiver = r1; 1180 Register receiver = r1;
1181 1181
1182 // Check that the key is a smi. 1182 // Check that the key is a smi.
1183 __ JumpIfNotSmi(key, &check_string); 1183 __ JumpIfNotSmi(key, &check_string);
1184 __ bind(&index_smi); 1184 __ bind(&index_smi);
1185 // Now the key is known to be a smi. This place is also jumped to from below 1185 // Now the key is known to be a smi. This place is also jumped to from below
1186 // where a numeric string is converted to a smi. 1186 // where a numeric string is converted to a smi.
1187 1187
1188 GenerateKeyedLoadReceiverCheck( 1188 GenerateKeyedLoadReceiverCheck(
1189 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); 1189 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow);
1190 1190
1191 // Check the "has fast elements" bit in the receiver's map which is 1191 // Check the "has fast elements" bit in the receiver's map which is
1192 // now in r2. 1192 // now in r2.
1193 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); 1193 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset));
1194 __ tst(r3, Operand(1 << Map::kHasFastElements)); 1194 __ tst(r3, Operand(1 << Map::kHasFastElements));
1195 __ b(eq, &check_pixel_array); 1195 __ b(eq, &check_number_dictionary);
1196 1196
1197 GenerateFastArrayLoad( 1197 GenerateFastArrayLoad(
1198 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); 1198 masm, receiver, key, r4, r3, r2, r0, NULL, &slow);
1199 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3); 1199 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3);
1200 __ Ret(); 1200 __ Ret();
1201 1201
1202 // Check whether the elements is a pixel array. 1202 __ bind(&check_number_dictionary);
1203 // r0: key 1203 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset));
1204 // r1: receiver 1204 __ ldr(r3, FieldMemOperand(r4, JSObject::kMapOffset));
1205 __ bind(&check_pixel_array);
1206 1205
1207 GenerateFastPixelArrayLoad(masm,
1208 r1,
1209 r0,
1210 r3,
1211 r4,
1212 r2,
1213 r5,
1214 r0,
1215 &check_number_dictionary,
1216 NULL,
1217 &slow);
1218
1219 __ bind(&check_number_dictionary);
1220 // Check whether the elements is a number dictionary. 1206 // Check whether the elements is a number dictionary.
1221 // r0: key 1207 // r0: key
1222 // r3: elements map 1208 // r3: elements map
1223 // r4: elements 1209 // r4: elements
1224 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); 1210 __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
1225 __ cmp(r3, ip); 1211 __ cmp(r3, ip);
1226 __ b(ne, &slow); 1212 __ b(ne, &slow);
1227 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); 1213 __ mov(r2, Operand(r0, ASR, kSmiTagSize));
1228 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5); 1214 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5);
1229 __ Ret(); 1215 __ Ret();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 // ----------------------------------- 1383 // -----------------------------------
1398 1384
1399 // Push receiver, key and value for runtime call. 1385 // Push receiver, key and value for runtime call.
1400 __ Push(r2, r1, r0); 1386 __ Push(r2, r1, r0);
1401 1387
1402 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); 1388 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss));
1403 __ TailCallExternalReference(ref, 3, 1); 1389 __ TailCallExternalReference(ref, 3, 1);
1404 } 1390 }
1405 1391
1406 1392
1407 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { 1393 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1394 StrictModeFlag strict_mode) {
1408 // ---------- S t a t e -------------- 1395 // ---------- S t a t e --------------
1409 // -- r0 : value 1396 // -- r0 : value
1410 // -- r1 : key 1397 // -- r1 : key
1411 // -- r2 : receiver 1398 // -- r2 : receiver
1412 // -- lr : return address 1399 // -- lr : return address
1413 // ----------------------------------- 1400 // -----------------------------------
1414 1401
1415 // Push receiver, key and value for runtime call. 1402 // Push receiver, key and value for runtime call.
1416 __ Push(r2, r1, r0); 1403 __ Push(r2, r1, r0);
1417 1404
1418 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1405 __ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes
1406 __ mov(r0, Operand(Smi::FromInt(strict_mode))); // Strict mode.
1407 __ Push(r1, r0);
1408
1409 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1419 } 1410 }
1420 1411
1421 1412
1422 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 1413 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
1414 StrictModeFlag strict_mode) {
1423 // ---------- S t a t e -------------- 1415 // ---------- S t a t e --------------
1424 // -- r0 : value 1416 // -- r0 : value
1425 // -- r1 : key 1417 // -- r1 : key
1426 // -- r2 : receiver 1418 // -- r2 : receiver
1427 // -- lr : return address 1419 // -- lr : return address
1428 // ----------------------------------- 1420 // -----------------------------------
1429 Label slow, fast, array, extra, check_pixel_array; 1421 Label slow, fast, array, extra;
1430 1422
1431 // Register usage. 1423 // Register usage.
1432 Register value = r0; 1424 Register value = r0;
1433 Register key = r1; 1425 Register key = r1;
1434 Register receiver = r2; 1426 Register receiver = r2;
1435 Register elements = r3; // Elements array of the receiver. 1427 Register elements = r3; // Elements array of the receiver.
1436 // r4 and r5 are used as general scratch registers. 1428 // r4 and r5 are used as general scratch registers.
1437 1429
1438 // Check that the key is a smi. 1430 // Check that the key is a smi.
1439 __ tst(key, Operand(kSmiTagMask)); 1431 __ tst(key, Operand(kSmiTagMask));
(...skipping 15 matching lines...) Expand all
1455 // Check that the object is some kind of JS object. 1447 // Check that the object is some kind of JS object.
1456 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); 1448 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE));
1457 __ b(lt, &slow); 1449 __ b(lt, &slow);
1458 1450
1459 // Object case: Check key against length in the elements array. 1451 // Object case: Check key against length in the elements array.
1460 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1452 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1461 // Check that the object is in fast mode and writable. 1453 // Check that the object is in fast mode and writable.
1462 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); 1454 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset));
1463 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 1455 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
1464 __ cmp(r4, ip); 1456 __ cmp(r4, ip);
1465 __ b(ne, &check_pixel_array); 1457 __ b(ne, &slow);
1466 // Check array bounds. Both the key and the length of FixedArray are smis. 1458 // Check array bounds. Both the key and the length of FixedArray are smis.
1467 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1459 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1468 __ cmp(key, Operand(ip)); 1460 __ cmp(key, Operand(ip));
1469 __ b(lo, &fast); 1461 __ b(lo, &fast);
1470 1462
1471 // Slow case, handle jump to runtime. 1463 // Slow case, handle jump to runtime.
1472 __ bind(&slow); 1464 __ bind(&slow);
1473 // Entry registers are intact. 1465 // Entry registers are intact.
1474 // r0: value. 1466 // r0: value.
1475 // r1: key. 1467 // r1: key.
1476 // r2: receiver. 1468 // r2: receiver.
1477 GenerateRuntimeSetProperty(masm); 1469 GenerateRuntimeSetProperty(masm, strict_mode);
1478
1479 // Check whether the elements is a pixel array.
1480 // r4: elements map.
1481 __ bind(&check_pixel_array);
1482 GenerateFastPixelArrayStore(masm,
1483 r2,
1484 r1,
1485 r0,
1486 elements,
1487 r4,
1488 r5,
1489 r6,
1490 false,
1491 false,
1492 NULL,
1493 &slow,
1494 &slow,
1495 &slow);
1496 1470
1497 // Extra capacity case: Check if there is extra capacity to 1471 // Extra capacity case: Check if there is extra capacity to
1498 // perform the store and update the length. Used for adding one 1472 // perform the store and update the length. Used for adding one
1499 // element to the array by writing to array[array.length]. 1473 // element to the array by writing to array[array.length].
1500 __ bind(&extra); 1474 __ bind(&extra);
1501 // Condition code from comparing key and array length is still available. 1475 // Condition code from comparing key and array length is still available.
1502 __ b(ne, &slow); // Only support writing to writing to array[array.length]. 1476 __ b(ne, &slow); // Only support writing to writing to array[array.length].
1503 // Check for room in the elements backing store. 1477 // Check for room in the elements backing store.
1504 // Both the key and the length of FixedArray are smis. 1478 // Both the key and the length of FixedArray are smis.
1505 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1479 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 // Update write barrier for the elements array address. 1514 // Update write barrier for the elements array address.
1541 __ sub(r4, r5, Operand(elements)); 1515 __ sub(r4, r5, Operand(elements));
1542 __ RecordWrite(elements, Operand(r4), r5, r6); 1516 __ RecordWrite(elements, Operand(r4), r5, r6);
1543 #endif 1517 #endif
1544 1518
1545 __ Ret(); 1519 __ Ret();
1546 } 1520 }
1547 1521
1548 1522
1549 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1523 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1550 Code::ExtraICState extra_ic_state) { 1524 StrictModeFlag strict_mode) {
1551 // ----------- S t a t e ------------- 1525 // ----------- S t a t e -------------
1552 // -- r0 : value 1526 // -- r0 : value
1553 // -- r1 : receiver 1527 // -- r1 : receiver
1554 // -- r2 : name 1528 // -- r2 : name
1555 // -- lr : return address 1529 // -- lr : return address
1556 // ----------------------------------- 1530 // -----------------------------------
1557 1531
1558 // Get the receiver from the stack and probe the stub cache. 1532 // Get the receiver from the stack and probe the stub cache.
1559 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, 1533 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
1560 NOT_IN_LOOP, 1534 NOT_IN_LOOP,
1561 MONOMORPHIC, 1535 MONOMORPHIC,
1562 extra_ic_state); 1536 strict_mode);
1563 StubCache::GenerateProbe(masm, flags, r1, r2, r3, r4, r5); 1537 StubCache::GenerateProbe(masm, flags, r1, r2, r3, r4, r5);
1564 1538
1565 // Cache miss: Jump to runtime. 1539 // Cache miss: Jump to runtime.
1566 GenerateMiss(masm); 1540 GenerateMiss(masm);
1567 } 1541 }
1568 1542
1569 1543
1570 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1544 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1571 // ----------- S t a t e ------------- 1545 // ----------- S t a t e -------------
1572 // -- r0 : value 1546 // -- r0 : value
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 GenerateDictionaryStore(masm, &miss, r3, r2, r0, r4, r5); 1620 GenerateDictionaryStore(masm, &miss, r3, r2, r0, r4, r5);
1647 __ IncrementCounter(&Counters::store_normal_hit, 1, r4, r5); 1621 __ IncrementCounter(&Counters::store_normal_hit, 1, r4, r5);
1648 __ Ret(); 1622 __ Ret();
1649 1623
1650 __ bind(&miss); 1624 __ bind(&miss);
1651 __ IncrementCounter(&Counters::store_normal_miss, 1, r4, r5); 1625 __ IncrementCounter(&Counters::store_normal_miss, 1, r4, r5);
1652 GenerateMiss(masm); 1626 GenerateMiss(masm);
1653 } 1627 }
1654 1628
1655 1629
1656 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm) { 1630 void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
1631 StrictModeFlag strict_mode) {
1657 // ----------- S t a t e ------------- 1632 // ----------- S t a t e -------------
1658 // -- r0 : value 1633 // -- r0 : value
1659 // -- r1 : receiver 1634 // -- r1 : receiver
1660 // -- r2 : name 1635 // -- r2 : name
1661 // -- lr : return address 1636 // -- lr : return address
1662 // ----------------------------------- 1637 // -----------------------------------
1663 1638
1664 __ Push(r1, r2, r0); 1639 __ Push(r1, r2, r0);
1665 1640
1641 __ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes
1642 __ mov(r0, Operand(Smi::FromInt(strict_mode)));
1643 __ Push(r1, r0);
1644
1666 // Do tail-call to runtime routine. 1645 // Do tail-call to runtime routine.
1667 __ TailCallRuntime(Runtime::kSetProperty, 3, 1); 1646 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1668 } 1647 }
1669 1648
1670 1649
1671 #undef __ 1650 #undef __
1672 1651
1673 1652
1674 Condition CompareIC::ComputeCondition(Token::Value op) { 1653 Condition CompareIC::ComputeCondition(Token::Value op) {
1675 switch (op) { 1654 switch (op) {
1676 case Token::EQ_STRICT: 1655 case Token::EQ_STRICT:
1677 case Token::EQ: 1656 case Token::EQ:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 Register reg = Assembler::GetRn(instr_at_patch); 1765 Register reg = Assembler::GetRn(instr_at_patch);
1787 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1766 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1788 patcher.EmitCondition(eq); 1767 patcher.EmitCondition(eq);
1789 } 1768 }
1790 } 1769 }
1791 1770
1792 1771
1793 } } // namespace v8::internal 1772 } } // namespace v8::internal
1794 1773
1795 #endif // V8_TARGET_ARCH_ARM 1774 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698