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

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

Issue 18191007: MIPS: Hydrogen array constructor cleanup and improvements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/lithium-codegen-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 5027 matching lines...) Expand 10 before | Expand all | Expand 10 after
5038 5038
5039 // A monomorphic cache hit or an already megamorphic state: invoke the 5039 // A monomorphic cache hit or an already megamorphic state: invoke the
5040 // function without changing the state. 5040 // function without changing the state.
5041 __ Branch(&done, eq, a3, Operand(a1)); 5041 __ Branch(&done, eq, a3, Operand(a1));
5042 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 5042 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5043 __ Branch(&done, eq, a3, Operand(at)); 5043 __ Branch(&done, eq, a3, Operand(at));
5044 5044
5045 // Special handling of the Array() function, which caches not only the 5045 // Special handling of the Array() function, which caches not only the
5046 // monomorphic Array function but the initial ElementsKind with special 5046 // monomorphic Array function but the initial ElementsKind with special
5047 // sentinels 5047 // sentinels
5048 Handle<Object> terminal_kind_sentinel =
5049 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
5050 LAST_FAST_ELEMENTS_KIND);
5051 __ JumpIfNotSmi(a3, &miss); 5048 __ JumpIfNotSmi(a3, &miss);
5052 __ Branch(&miss, gt, a3, Operand(terminal_kind_sentinel)); 5049 if (FLAG_debug_code) {
5050 Handle<Object> terminal_kind_sentinel =
5051 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
5052 LAST_FAST_ELEMENTS_KIND);
5053 __ Assert(le, "Array function sentinel is not an ElementsKind",
5054 a3, Operand(terminal_kind_sentinel));
5055 }
5056
5053 // Make sure the function is the Array() function 5057 // Make sure the function is the Array() function
5054 __ LoadArrayFunction(a3); 5058 __ LoadArrayFunction(a3);
5055 __ Branch(&megamorphic, ne, a1, Operand(a3)); 5059 __ Branch(&megamorphic, ne, a1, Operand(a3));
5056 __ jmp(&done); 5060 __ jmp(&done);
5057 5061
5058 __ bind(&miss); 5062 __ bind(&miss);
5059 5063
5060 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 5064 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
5061 // megamorphic. 5065 // megamorphic.
5062 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5066 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
7607 7611
7608 // look at the first argument 7612 // look at the first argument
7609 __ lw(t1, MemOperand(sp, 0)); 7613 __ lw(t1, MemOperand(sp, 0));
7610 __ Branch(&normal_sequence, eq, t1, Operand(zero_reg)); 7614 __ Branch(&normal_sequence, eq, t1, Operand(zero_reg));
7611 7615
7612 // We are going to create a holey array, but our kind is non-holey. 7616 // We are going to create a holey array, but our kind is non-holey.
7613 // Fix kind and retry 7617 // Fix kind and retry
7614 __ Addu(a3, a3, Operand(1)); 7618 __ Addu(a3, a3, Operand(1));
7615 __ Branch(&normal_sequence, eq, a2, Operand(undefined_sentinel)); 7619 __ Branch(&normal_sequence, eq, a2, Operand(undefined_sentinel));
7616 7620
7621 // The type cell may have gone megamorphic, don't overwrite if so.
7622 __ lw(t1, FieldMemOperand(a2, kPointerSize));
7623 __ JumpIfNotSmi(t1, &normal_sequence);
7624
7617 // Save the resulting elements kind in type info 7625 // Save the resulting elements kind in type info
7618 __ SmiTag(a3); 7626 __ SmiTag(a3);
7619 __ sw(a3, FieldMemOperand(a2, kPointerSize)); 7627 __ sw(a3, FieldMemOperand(a2, kPointerSize));
7620 __ SmiUntag(a3); 7628 __ SmiUntag(a3);
7621 7629
7622 __ bind(&normal_sequence); 7630 __ bind(&normal_sequence);
7623 int last_index = GetSequenceIndexFromFastElementsKind( 7631 int last_index = GetSequenceIndexFromFastElementsKind(
7624 TERMINAL_FAST_ELEMENTS_KIND); 7632 TERMINAL_FAST_ELEMENTS_KIND);
7625 for (int i = 0; i <= last_index; ++i) { 7633 for (int i = 0; i <= last_index; ++i) {
7626 Label next; 7634 Label next;
(...skipping 11 matching lines...) Expand all
7638 7646
7639 template<class T> 7647 template<class T>
7640 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 7648 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
7641 int to_index = GetSequenceIndexFromFastElementsKind( 7649 int to_index = GetSequenceIndexFromFastElementsKind(
7642 TERMINAL_FAST_ELEMENTS_KIND); 7650 TERMINAL_FAST_ELEMENTS_KIND);
7643 for (int i = 0; i <= to_index; ++i) { 7651 for (int i = 0; i <= to_index; ++i) {
7644 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 7652 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
7645 T stub(kind); 7653 T stub(kind);
7646 stub.GetCode(isolate)->set_is_pregenerated(true); 7654 stub.GetCode(isolate)->set_is_pregenerated(true);
7647 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 7655 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
7648 T stub1(kind, true); 7656 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES);
7649 stub1.GetCode(isolate)->set_is_pregenerated(true); 7657 stub1.GetCode(isolate)->set_is_pregenerated(true);
7650 } 7658 }
7651 } 7659 }
7652 } 7660 }
7653 7661
7654 7662
7655 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 7663 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
7656 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 7664 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
7657 isolate); 7665 isolate);
7658 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 7666 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
7829 __ bind(&fast_elements_case); 7837 __ bind(&fast_elements_case);
7830 GenerateCase(masm, FAST_ELEMENTS); 7838 GenerateCase(masm, FAST_ELEMENTS);
7831 } 7839 }
7832 7840
7833 7841
7834 #undef __ 7842 #undef __
7835 7843
7836 } } // namespace v8::internal 7844 } } // namespace v8::internal
7837 7845
7838 #endif // V8_TARGET_ARCH_MIPS 7846 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698