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

Side by Side Diff: src/mips/ic-mips.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 | « src/ic.cc ('k') | src/objects.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 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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1463
1464 1464
1465 void StoreIC::GenerateArrayLength(MacroAssembler* masm) { 1465 void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
1466 // ----------- S t a t e ------------- 1466 // ----------- S t a t e -------------
1467 // -- a0 : value 1467 // -- a0 : value
1468 // -- a1 : receiver 1468 // -- a1 : receiver
1469 // -- a2 : name 1469 // -- a2 : name
1470 // -- ra : return address 1470 // -- ra : return address
1471 // ----------------------------------- 1471 // -----------------------------------
1472 // 1472 //
1473 // This accepts as a receiver anything JSObject::SetElementsLength accepts 1473 // This accepts as a receiver anything JSArray::SetElementsLength accepts
1474 // (currently anything except for external and pixel arrays which means 1474 // (currently anything except for external arrays which means anything with
1475 // anything with elements of FixedArray type.), but currently is restricted 1475 // elements of FixedArray type). Value must be a number, but only smis are
1476 // to JSArray. 1476 // accepted as the most common case.
1477 // Value must be a number, but only smis are accepted as the most common case.
1478 1477
1479 Label miss; 1478 Label miss;
1480 1479
1481 Register receiver = a1; 1480 Register receiver = a1;
1482 Register value = a0; 1481 Register value = a0;
1483 Register scratch = a3; 1482 Register scratch = a3;
1484 1483
1485 // Check that the receiver isn't a smi. 1484 // Check that the receiver isn't a smi.
1486 __ JumpIfSmi(receiver, &miss); 1485 __ JumpIfSmi(receiver, &miss);
1487 1486
1488 // Check that the object is a JS array. 1487 // Check that the object is a JS array.
1489 __ GetObjectType(receiver, scratch, scratch); 1488 __ GetObjectType(receiver, scratch, scratch);
1490 __ Branch(&miss, ne, scratch, Operand(JS_ARRAY_TYPE)); 1489 __ Branch(&miss, ne, scratch, Operand(JS_ARRAY_TYPE));
1491 1490
1492 // Check that elements are FixedArray. 1491 // Check that elements are FixedArray.
1493 // We rely on StoreIC_ArrayLength below to deal with all types of 1492 // We rely on StoreIC_ArrayLength below to deal with all types of
1494 // fast elements (including COW). 1493 // fast elements (including COW).
1495 __ lw(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset)); 1494 __ lw(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
1496 __ GetObjectType(scratch, scratch, scratch); 1495 __ GetObjectType(scratch, scratch, scratch);
1497 __ Branch(&miss, ne, scratch, Operand(FIXED_ARRAY_TYPE)); 1496 __ Branch(&miss, ne, scratch, Operand(FIXED_ARRAY_TYPE));
1498 1497
1498 // Check that the array has fast properties, otherwise the length
1499 // property might have been redefined.
1500 // TODO(mstarzinger): Port this check to MIPS.
1501
1499 // Check that value is a smi. 1502 // Check that value is a smi.
1500 __ JumpIfNotSmi(value, &miss); 1503 __ JumpIfNotSmi(value, &miss);
1501 1504
1502 // Prepare tail call to StoreIC_ArrayLength. 1505 // Prepare tail call to StoreIC_ArrayLength.
1503 __ Push(receiver, value); 1506 __ Push(receiver, value);
1504 1507
1505 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength), 1508 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength),
1506 masm->isolate()); 1509 masm->isolate());
1507 __ TailCallExternalReference(ref, 2, 1); 1510 __ TailCallExternalReference(ref, 2, 1);
1508 1511
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); 1675 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch));
1673 patcher.masm()->andi(at, reg, kSmiTagMask); 1676 patcher.masm()->andi(at, reg, kSmiTagMask);
1674 patcher.ChangeBranchCondition(eq); 1677 patcher.ChangeBranchCondition(eq);
1675 } 1678 }
1676 } 1679 }
1677 1680
1678 1681
1679 } } // namespace v8::internal 1682 } } // namespace v8::internal
1680 1683
1681 #endif // V8_TARGET_ARCH_MIPS 1684 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698