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

Side by Side Diff: src/ia32/ic-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/ia32/stub-cache-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 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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 __ push(eax); 1419 __ push(eax);
1420 __ push(ebx); 1420 __ push(ebx);
1421 1421
1422 // Perform tail call to the entry. 1422 // Perform tail call to the entry.
1423 ExternalReference ref = 1423 ExternalReference ref =
1424 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); 1424 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
1425 __ TailCallExternalReference(ref, 3, 1); 1425 __ TailCallExternalReference(ref, 3, 1);
1426 } 1426 }
1427 1427
1428 1428
1429 void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
1430 // ----------- S t a t e -------------
1431 // -- eax : value
1432 // -- ecx : name
1433 // -- edx : receiver
1434 // -- esp[0] : return address
1435 // -----------------------------------
1436 //
1437 // This accepts as a receiver anything JSArray::SetElementsLength accepts
1438 // (currently anything except for external arrays which means anything with
1439 // elements of FixedArray type). Value must be a number, but only smis are
1440 // accepted as the most common case.
1441
1442 Label miss;
1443
1444 Register receiver = edx;
1445 Register value = eax;
1446 Register scratch = ebx;
1447
1448 // Check that the receiver isn't a smi.
1449 __ JumpIfSmi(receiver, &miss);
1450
1451 // Check that the object is a JS array.
1452 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
1453 __ j(not_equal, &miss);
1454
1455 // Check that elements are FixedArray.
1456 // We rely on StoreIC_ArrayLength below to deal with all types of
1457 // fast elements (including COW).
1458 __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
1459 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
1460 __ j(not_equal, &miss);
1461
1462 // Check that the array has fast properties, otherwise the length
1463 // property might have been redefined.
1464 __ mov(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
1465 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
1466 Heap::kHashTableMapRootIndex);
1467 __ j(equal, &miss);
1468
1469 // Check that value is a smi.
1470 __ JumpIfNotSmi(value, &miss);
1471
1472 // Prepare tail call to StoreIC_ArrayLength.
1473 __ pop(scratch);
1474 __ push(receiver);
1475 __ push(value);
1476 __ push(scratch); // return address
1477
1478 ExternalReference ref =
1479 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate());
1480 __ TailCallExternalReference(ref, 2, 1);
1481
1482 __ bind(&miss);
1483
1484 GenerateMiss(masm);
1485 }
1486
1487
1488 void StoreIC::GenerateNormal(MacroAssembler* masm) { 1429 void StoreIC::GenerateNormal(MacroAssembler* masm) {
1489 // ----------- S t a t e ------------- 1430 // ----------- S t a t e -------------
1490 // -- eax : value 1431 // -- eax : value
1491 // -- ecx : name 1432 // -- ecx : name
1492 // -- edx : receiver 1433 // -- edx : receiver
1493 // -- esp[0] : return address 1434 // -- esp[0] : return address
1494 // ----------------------------------- 1435 // -----------------------------------
1495 1436
1496 Label miss, restore_miss; 1437 Label miss, restore_miss;
1497 1438
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1665 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1725 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1666 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1726 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1667 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1727 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1668 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1728 } 1669 }
1729 1670
1730 1671
1731 } } // namespace v8::internal 1672 } } // namespace v8::internal
1732 1673
1733 #endif // V8_TARGET_ARCH_IA32 1674 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698