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

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

Issue 11896091: Replace store array length builtin with codestub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Only inform of updating IC after actually updating it. Created 7 years, 11 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/code-stubs-x64.cc ('k') | src/x64/stub-cache-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 __ push(rax); // value 1448 __ push(rax); // value
1449 __ push(rbx); // return address 1449 __ push(rbx); // return address
1450 1450
1451 // Perform tail call to the entry. 1451 // Perform tail call to the entry.
1452 ExternalReference ref = 1452 ExternalReference ref =
1453 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); 1453 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
1454 __ TailCallExternalReference(ref, 3, 1); 1454 __ TailCallExternalReference(ref, 3, 1);
1455 } 1455 }
1456 1456
1457 1457
1458 void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
1459 // ----------- S t a t e -------------
1460 // -- rax : value
1461 // -- rcx : name
1462 // -- rdx : receiver
1463 // -- rsp[0] : return address
1464 // -----------------------------------
1465 //
1466 // This accepts as a receiver anything JSArray::SetElementsLength accepts
1467 // (currently anything except for external arrays which means anything with
1468 // elements of FixedArray type). Value must be a number, but only smis are
1469 // accepted as the most common case.
1470
1471 Label miss;
1472
1473 Register receiver = rdx;
1474 Register value = rax;
1475 Register scratch = rbx;
1476
1477 // Check that the receiver isn't a smi.
1478 __ JumpIfSmi(receiver, &miss);
1479
1480 // Check that the object is a JS array.
1481 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
1482 __ j(not_equal, &miss);
1483
1484 // Check that elements are FixedArray.
1485 // We rely on StoreIC_ArrayLength below to deal with all types of
1486 // fast elements (including COW).
1487 __ movq(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
1488 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
1489 __ j(not_equal, &miss);
1490
1491 // Check that the array has fast properties, otherwise the length
1492 // property might have been redefined.
1493 __ movq(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
1494 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
1495 Heap::kHashTableMapRootIndex);
1496 __ j(equal, &miss);
1497
1498 // Check that value is a smi.
1499 __ JumpIfNotSmi(value, &miss);
1500
1501 // Prepare tail call to StoreIC_ArrayLength.
1502 __ pop(scratch);
1503 __ push(receiver);
1504 __ push(value);
1505 __ push(scratch); // return address
1506
1507 ExternalReference ref =
1508 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate());
1509 __ TailCallExternalReference(ref, 2, 1);
1510
1511 __ bind(&miss);
1512
1513 GenerateMiss(masm);
1514 }
1515
1516
1517 void StoreIC::GenerateNormal(MacroAssembler* masm) { 1458 void StoreIC::GenerateNormal(MacroAssembler* masm) {
1518 // ----------- S t a t e ------------- 1459 // ----------- S t a t e -------------
1519 // -- rax : value 1460 // -- rax : value
1520 // -- rcx : name 1461 // -- rcx : name
1521 // -- rdx : receiver 1462 // -- rdx : receiver
1522 // -- rsp[0] : return address 1463 // -- rsp[0] : return address
1523 // ----------------------------------- 1464 // -----------------------------------
1524 1465
1525 Label miss; 1466 Label miss;
1526 1467
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1680 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1740 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1681 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1741 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1682 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1742 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1683 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1743 } 1684 }
1744 1685
1745 1686
1746 } } // namespace v8::internal 1687 } } // namespace v8::internal
1747 1688
1748 #endif // V8_TARGET_ARCH_X64 1689 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698