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

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

Issue 8895025: Fix invalid usage of StoreIC_ArrayLength optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Sven Panne. Created 9 years 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 | « no previous file | src/ia32/ic-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 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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 1462
1463 1463
1464 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { 1464 void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
1465 // ----------- S t a t e ------------- 1465 // ----------- S t a t e -------------
1466 // -- r0 : value 1466 // -- r0 : value
1467 // -- r1 : receiver 1467 // -- r1 : receiver
1468 // -- r2 : name 1468 // -- r2 : name
1469 // -- lr : return address 1469 // -- lr : return address
1470 // ----------------------------------- 1470 // -----------------------------------
1471 // 1471 //
1472 // This accepts as a receiver anything JSObject::SetElementsLength accepts 1472 // This accepts as a receiver anything JSArray::SetElementsLength accepts
1473 // (currently anything except for external and pixel arrays which means 1473 // (currently anything except for external arrays which means anything with
1474 // anything with elements of FixedArray type.), but currently is restricted 1474 // elements of FixedArray type). Value must be a number, but only smis are
1475 // to JSArray. 1475 // accepted as the most common case.
1476 // Value must be a number, but only smis are accepted as the most common case.
1477 1476
1478 Label miss; 1477 Label miss;
1479 1478
1480 Register receiver = r1; 1479 Register receiver = r1;
1481 Register value = r0; 1480 Register value = r0;
1482 Register scratch = r3; 1481 Register scratch = r3;
1483 1482
1484 // Check that the receiver isn't a smi. 1483 // Check that the receiver isn't a smi.
1485 __ JumpIfSmi(receiver, &miss); 1484 __ JumpIfSmi(receiver, &miss);
1486 1485
1487 // Check that the object is a JS array. 1486 // Check that the object is a JS array.
1488 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE); 1487 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE);
1489 __ b(ne, &miss); 1488 __ b(ne, &miss);
1490 1489
1491 // Check that elements are FixedArray. 1490 // Check that elements are FixedArray.
1492 // We rely on StoreIC_ArrayLength below to deal with all types of 1491 // We rely on StoreIC_ArrayLength below to deal with all types of
1493 // fast elements (including COW). 1492 // fast elements (including COW).
1494 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset)); 1493 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
1495 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE); 1494 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE);
1496 __ b(ne, &miss); 1495 __ b(ne, &miss);
1497 1496
1497 // Check that the array has fast properties, otherwise the length
1498 // property might have been redefined.
1499 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kPropertiesOffset));
1500 __ ldr(scratch, FieldMemOperand(scratch, FixedArray::kMapOffset));
1501 __ CompareRoot(scratch, Heap::kHashTableMapRootIndex);
1502 __ b(eq, &miss);
1503
1498 // Check that value is a smi. 1504 // Check that value is a smi.
1499 __ JumpIfNotSmi(value, &miss); 1505 __ JumpIfNotSmi(value, &miss);
1500 1506
1501 // Prepare tail call to StoreIC_ArrayLength. 1507 // Prepare tail call to StoreIC_ArrayLength.
1502 __ Push(receiver, value); 1508 __ Push(receiver, value);
1503 1509
1504 ExternalReference ref = 1510 ExternalReference ref =
1505 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate()); 1511 ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate());
1506 __ TailCallExternalReference(ref, 2, 1); 1512 __ TailCallExternalReference(ref, 2, 1);
1507 1513
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 Register reg = Assembler::GetRn(instr_at_patch); 1679 Register reg = Assembler::GetRn(instr_at_patch);
1674 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1680 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1675 patcher.EmitCondition(eq); 1681 patcher.EmitCondition(eq);
1676 } 1682 }
1677 } 1683 }
1678 1684
1679 1685
1680 } } // namespace v8::internal 1686 } } // namespace v8::internal
1681 1687
1682 #endif // V8_TARGET_ARCH_ARM 1688 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698