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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 12077009: MIPS: Replace store array length builtin with codestub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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/mips/ic-mips.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 4615 matching lines...) Expand 10 before | Expand all | Expand 10 after
4626 } 4626 }
4627 4627
4628 StubCompiler::GenerateLoadStringLength(masm, receiver, a3, t0, &miss, 4628 StubCompiler::GenerateLoadStringLength(masm, receiver, a3, t0, &miss,
4629 support_wrapper_); 4629 support_wrapper_);
4630 4630
4631 __ bind(&miss); 4631 __ bind(&miss);
4632 StubCompiler::GenerateLoadMiss(masm, kind()); 4632 StubCompiler::GenerateLoadMiss(masm, kind());
4633 } 4633 }
4634 4634
4635 4635
4636 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
4637 // This accepts as a receiver anything JSArray::SetElementsLength accepts
4638 // (currently anything except for external arrays which means anything with
4639 // elements of FixedArray type). Value must be a number, but only smis are
4640 // accepted as the most common case.
4641 Label miss;
4642
4643 Register receiver;
4644 Register value;
4645 if (kind() == Code::KEYED_STORE_IC) {
4646 // ----------- S t a t e -------------
4647 // -- ra : return address
4648 // -- a0 : value
4649 // -- a1 : key
4650 // -- a2 : receiver
4651 // -----------------------------------
4652 __ Branch(&miss, ne, a1,
4653 Operand(masm->isolate()->factory()->length_symbol()));
4654 receiver = a2;
4655 value = a0;
4656 } else {
4657 ASSERT(kind() == Code::STORE_IC);
4658 // ----------- S t a t e -------------
4659 // -- ra : return address
4660 // -- a0 : value
4661 // -- a1 : receiver
4662 // -- a2 : key
4663 // -----------------------------------
4664 receiver = a1;
4665 value = a0;
4666 }
4667 Register scratch = a3;
4668
4669 // Check that the receiver isn't a smi.
4670 __ JumpIfSmi(receiver, &miss);
4671
4672 // Check that the object is a JS array.
4673 __ GetObjectType(receiver, scratch, scratch);
4674 __ Branch(&miss, ne, scratch, Operand(JS_ARRAY_TYPE));
4675
4676 // Check that elements are FixedArray.
4677 // We rely on StoreIC_ArrayLength below to deal with all types of
4678 // fast elements (including COW).
4679 __ lw(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
4680 __ GetObjectType(scratch, scratch, scratch);
4681 __ Branch(&miss, ne, scratch, Operand(FIXED_ARRAY_TYPE));
4682
4683 // Check that the array has fast properties, otherwise the length
4684 // property might have been redefined.
4685 __ lw(scratch, FieldMemOperand(receiver, JSArray::kPropertiesOffset));
4686 __ lw(scratch, FieldMemOperand(scratch, FixedArray::kMapOffset));
4687 __ LoadRoot(at, Heap::kHashTableMapRootIndex);
4688 __ Branch(&miss, eq, scratch, Operand(at));
4689
4690 // Check that value is a smi.
4691 __ JumpIfNotSmi(value, &miss);
4692
4693 // Prepare tail call to StoreIC_ArrayLength.
4694 __ Push(receiver, value);
4695
4696 ExternalReference ref =
4697 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
4698 __ TailCallExternalReference(ref, 2, 1);
4699
4700 __ bind(&miss);
4701
4702 StubCompiler::GenerateStoreMiss(masm, kind());
4703 }
4704
4705
4636 Register InstanceofStub::left() { return a0; } 4706 Register InstanceofStub::left() { return a0; }
4637 4707
4638 4708
4639 Register InstanceofStub::right() { return a1; } 4709 Register InstanceofStub::right() { return a1; }
4640 4710
4641 4711
4642 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 4712 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
4643 // The displacement is the offset of the last parameter (if any) 4713 // The displacement is the offset of the last parameter (if any)
4644 // relative to the frame pointer. 4714 // relative to the frame pointer.
4645 const int kDisplacement = 4715 const int kDisplacement =
(...skipping 3319 matching lines...) Expand 10 before | Expand all | Expand 10 after
7965 __ Pop(ra, t1, a1); 8035 __ Pop(ra, t1, a1);
7966 __ Ret(); 8036 __ Ret();
7967 } 8037 }
7968 8038
7969 8039
7970 #undef __ 8040 #undef __
7971 8041
7972 } } // namespace v8::internal 8042 } } // namespace v8::internal
7973 8043
7974 #endif // V8_TARGET_ARCH_MIPS 8044 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698