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

Side by Side Diff: src/arm/code-stubs-arm.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 | « no previous file | src/arm/ic-arm.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 4583 matching lines...) Expand 10 before | Expand all | Expand 10 after
4594 } 4594 }
4595 4595
4596 StubCompiler::GenerateLoadStringLength(masm, receiver, r3, r4, &miss, 4596 StubCompiler::GenerateLoadStringLength(masm, receiver, r3, r4, &miss,
4597 support_wrapper_); 4597 support_wrapper_);
4598 4598
4599 __ bind(&miss); 4599 __ bind(&miss);
4600 StubCompiler::GenerateLoadMiss(masm, kind()); 4600 StubCompiler::GenerateLoadMiss(masm, kind());
4601 } 4601 }
4602 4602
4603 4603
4604 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
4605 // This accepts as a receiver anything JSArray::SetElementsLength accepts
4606 // (currently anything except for external arrays which means anything with
4607 // elements of FixedArray type). Value must be a number, but only smis are
4608 // accepted as the most common case.
4609 Label miss;
4610
4611 Register receiver;
4612 Register value;
4613 if (kind() == Code::KEYED_STORE_IC) {
4614 // ----------- S t a t e -------------
4615 // -- lr : return address
4616 // -- r0 : value
4617 // -- r1 : key
4618 // -- r2 : receiver
4619 // -----------------------------------
4620 __ cmp(r1, Operand(masm->isolate()->factory()->length_symbol()));
4621 __ b(ne, &miss);
4622 receiver = r2;
4623 value = r0;
4624 } else {
4625 ASSERT(kind() == Code::STORE_IC);
4626 // ----------- S t a t e -------------
4627 // -- lr : return address
4628 // -- r0 : value
4629 // -- r1 : receiver
4630 // -- r2 : key
4631 // -----------------------------------
4632 receiver = r1;
4633 value = r0;
4634 }
4635 Register scratch = r3;
4636
4637 // Check that the receiver isn't a smi.
4638 __ JumpIfSmi(receiver, &miss);
4639
4640 // Check that the object is a JS array.
4641 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE);
4642 __ b(ne, &miss);
4643
4644 // Check that elements are FixedArray.
4645 // We rely on StoreIC_ArrayLength below to deal with all types of
4646 // fast elements (including COW).
4647 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
4648 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE);
4649 __ b(ne, &miss);
4650
4651 // Check that the array has fast properties, otherwise the length
4652 // property might have been redefined.
4653 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kPropertiesOffset));
4654 __ ldr(scratch, FieldMemOperand(scratch, FixedArray::kMapOffset));
4655 __ CompareRoot(scratch, Heap::kHashTableMapRootIndex);
4656 __ b(eq, &miss);
4657
4658 // Check that value is a smi.
4659 __ JumpIfNotSmi(value, &miss);
4660
4661 // Prepare tail call to StoreIC_ArrayLength.
4662 __ Push(receiver, value);
4663
4664 ExternalReference ref =
4665 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
4666 __ TailCallExternalReference(ref, 2, 1);
4667
4668 __ bind(&miss);
4669
4670 StubCompiler::GenerateStoreMiss(masm, kind());
4671 }
4672
4673
4604 Register InstanceofStub::left() { return r0; } 4674 Register InstanceofStub::left() { return r0; }
4605 4675
4606 4676
4607 Register InstanceofStub::right() { return r1; } 4677 Register InstanceofStub::right() { return r1; }
4608 4678
4609 4679
4610 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 4680 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
4611 // The displacement is the offset of the last parameter (if any) 4681 // The displacement is the offset of the last parameter (if any)
4612 // relative to the frame pointer. 4682 // relative to the frame pointer.
4613 const int kDisplacement = 4683 const int kDisplacement =
(...skipping 3235 matching lines...) Expand 10 before | Expand all | Expand 10 after
7849 7919
7850 __ Pop(lr, r5, r1); 7920 __ Pop(lr, r5, r1);
7851 __ Ret(); 7921 __ Ret();
7852 } 7922 }
7853 7923
7854 #undef __ 7924 #undef __
7855 7925
7856 } } // namespace v8::internal 7926 } } // namespace v8::internal
7857 7927
7858 #endif // V8_TARGET_ARCH_ARM 7928 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698