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

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

Issue 172383003: Revert "Second attempt at introducing a premonomorphic state in the call" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/ia32/code-stubs-ia32.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 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 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 3152
3153 3153
3154 static void GenerateRecordCallTarget(MacroAssembler* masm) { 3154 static void GenerateRecordCallTarget(MacroAssembler* masm) {
3155 // Cache the called function in a feedback vector slot. Cache states 3155 // Cache the called function in a feedback vector slot. Cache states
3156 // are uninitialized, monomorphic (indicated by a JSFunction), and 3156 // are uninitialized, monomorphic (indicated by a JSFunction), and
3157 // megamorphic. 3157 // megamorphic.
3158 // a0 : number of arguments to the construct function 3158 // a0 : number of arguments to the construct function
3159 // a1 : the function to call 3159 // a1 : the function to call
3160 // a2 : Feedback vector 3160 // a2 : Feedback vector
3161 // a3 : slot in feedback vector (Smi) 3161 // a3 : slot in feedback vector (Smi)
3162 Label check_array, initialize_array, initialize_non_array, megamorphic, done; 3162 Label initialize, done, miss, megamorphic, not_array_function;
3163 3163
3164 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), 3164 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()),
3165 masm->isolate()->heap()->undefined_value()); 3165 masm->isolate()->heap()->undefined_value());
3166 Heap::RootListIndex kMegamorphicRootIndex = Heap::kUndefinedValueRootIndex;
3167 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), 3166 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()),
3168 masm->isolate()->heap()->the_hole_value()); 3167 masm->isolate()->heap()->the_hole_value());
3169 Heap::RootListIndex kUninitializedRootIndex = Heap::kTheHoleValueRootIndex;
3170 ASSERT_EQ(*TypeFeedbackInfo::PremonomorphicSentinel(masm->isolate()),
3171 masm->isolate()->heap()->null_value());
3172 Heap::RootListIndex kPremonomorphicRootIndex = Heap::kNullValueRootIndex;
3173 3168
3174 // Load the cache state into t0. 3169 // Load the cache state into t0.
3175 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 3170 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
3176 __ Addu(t0, a2, Operand(t0)); 3171 __ Addu(t0, a2, Operand(t0));
3177 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); 3172 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize));
3178 3173
3179 // A monomorphic cache hit or an already megamorphic state: invoke the 3174 // A monomorphic cache hit or an already megamorphic state: invoke the
3180 // function without changing the state. 3175 // function without changing the state.
3181 __ Branch(&done, eq, t0, Operand(a1)); 3176 __ Branch(&done, eq, t0, Operand(a1));
3182 __ LoadRoot(at, kMegamorphicRootIndex);
3183 __ Branch(&done, eq, t0, Operand(at));
3184 3177
3185 // Check if we're dealing with the Array function or not. 3178 // If we came here, we need to see if we are the array function.
3186 __ LoadArrayFunction(t1); 3179 // If we didn't have a matching function, and we didn't find the megamorph
3187 __ Branch(&check_array, eq, a1, Operand(t1)); 3180 // sentinel, then we have in the slot either some other function or an
3188 3181 // AllocationSite. Do a map check on the object in a3.
3189 // Non-array cache: Check the cache state.
3190 __ LoadRoot(at, kPremonomorphicRootIndex);
3191 __ Branch(&initialize_non_array, eq, t0, Operand(at));
3192 __ LoadRoot(at, kUninitializedRootIndex);
3193 __ Branch(&megamorphic, ne, t0, Operand(at));
3194
3195 // Non-array cache: Uninitialized -> premonomorphic. The sentinel is an
3196 // immortal immovable object (null) so no write-barrier is needed.
3197 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
3198 __ Addu(t0, a2, at);
3199 __ LoadRoot(at, kPremonomorphicRootIndex);
3200 __ Branch(USE_DELAY_SLOT, &done);
3201 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); // In delay slot.
3202
3203 // Array cache: Check the cache state to see if we're in a monomorphic
3204 // state where the state object is an AllocationSite object.
3205 __ bind(&check_array);
3206 __ lw(t1, FieldMemOperand(t0, 0)); 3182 __ lw(t1, FieldMemOperand(t0, 0));
3207 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 3183 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
3208 __ Branch(&done, eq, t1, Operand(at)); 3184 __ Branch(&miss, ne, t1, Operand(at));
3209 3185
3210 // Array cache: Uninitialized or premonomorphic -> monomorphic. 3186 // Make sure the function is the Array() function
3211 __ LoadRoot(at, kUninitializedRootIndex); 3187 __ LoadArrayFunction(t0);
3212 __ Branch(&initialize_array, eq, t0, Operand(at)); 3188 __ Branch(&megamorphic, ne, a1, Operand(t0));
3213 __ LoadRoot(at, kPremonomorphicRootIndex); 3189 __ jmp(&done);
3214 __ Branch(&initialize_array, eq, t0, Operand(at));
3215 3190
3216 // Both caches: Monomorphic -> megamorphic. The sentinel is an 3191 __ bind(&miss);
3217 // immortal immovable object (undefined) so no write-barrier is needed. 3192
3193 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
3194 // megamorphic.
3195 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3196 __ Branch(&initialize, eq, t0, Operand(at));
3197 // MegamorphicSentinel is an immortal immovable object (undefined) so no
3198 // write-barrier is needed.
3218 __ bind(&megamorphic); 3199 __ bind(&megamorphic);
3219 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 3200 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
3220 __ Addu(t0, a2, Operand(t0)); 3201 __ Addu(t0, a2, Operand(t0));
3221 __ LoadRoot(at, kMegamorphicRootIndex); 3202 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
3222 __ Branch(USE_DELAY_SLOT, &done); 3203 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
3223 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); // In delay slot. 3204 __ jmp(&done);
3224 3205
3225 // Array cache: Uninitialized or premonomorphic -> monomorphic. 3206 // An uninitialized cache is patched with the function or sentinel to
3226 __ bind(&initialize_array); 3207 // indicate the ElementsKind if function is the Array constructor.
3208 __ bind(&initialize);
3209 // Make sure the function is the Array() function
3210 __ LoadArrayFunction(t0);
3211 __ Branch(&not_array_function, ne, a1, Operand(t0));
3212
3213 // The target function is the Array constructor.
3214 // Create an AllocationSite if we don't already have it, store it in the slot.
3227 { 3215 {
3228 FrameScope scope(masm, StackFrame::INTERNAL); 3216 FrameScope scope(masm, StackFrame::INTERNAL);
3229 const RegList kSavedRegs = 3217 const RegList kSavedRegs =
3230 1 << 4 | // a0 3218 1 << 4 | // a0
3231 1 << 5 | // a1 3219 1 << 5 | // a1
3232 1 << 6 | // a2 3220 1 << 6 | // a2
3233 1 << 7; // a3 3221 1 << 7; // a3
3234 3222
3235 // Arguments register must be smi-tagged to call out. 3223 // Arguments register must be smi-tagged to call out.
3236 __ SmiTag(a0); 3224 __ SmiTag(a0);
3237 __ MultiPush(kSavedRegs); 3225 __ MultiPush(kSavedRegs);
3238 3226
3239 CreateAllocationSiteStub create_stub; 3227 CreateAllocationSiteStub create_stub;
3240 __ CallStub(&create_stub); 3228 __ CallStub(&create_stub);
3241 3229
3242 __ MultiPop(kSavedRegs); 3230 __ MultiPop(kSavedRegs);
3243 __ SmiUntag(a0); 3231 __ SmiUntag(a0);
3244 } 3232 }
3245 __ Branch(&done); 3233 __ Branch(&done);
3246 3234
3247 // Non-array cache: Premonomorphic -> monomorphic. 3235 __ bind(&not_array_function);
3248 __ bind(&initialize_non_array); 3236
3249 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 3237 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
3250 __ Addu(t0, a2, Operand(t0)); 3238 __ Addu(t0, a2, Operand(t0));
3251 __ Addu(t0, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 3239 __ Addu(t0, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3252 __ sw(a1, MemOperand(t0, 0)); 3240 __ sw(a1, MemOperand(t0, 0));
3253 3241
3254 __ Push(t0, a2, a1); 3242 __ Push(t0, a2, a1);
3255 __ RecordWrite(a2, t0, a1, kRAHasNotBeenSaved, kDontSaveFPRegs, 3243 __ RecordWrite(a2, t0, a1, kRAHasNotBeenSaved, kDontSaveFPRegs,
3256 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 3244 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3257 __ Pop(t0, a2, a1); 3245 __ Pop(t0, a2, a1);
3258 3246
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after
5772 MemOperand(fp, 6 * kPointerSize), 5760 MemOperand(fp, 6 * kPointerSize),
5773 NULL); 5761 NULL);
5774 } 5762 }
5775 5763
5776 5764
5777 #undef __ 5765 #undef __
5778 5766
5779 } } // namespace v8::internal 5767 } } // namespace v8::internal
5780 5768
5781 #endif // V8_TARGET_ARCH_MIPS 5769 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698