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

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

Issue 295383004: Refactor CallICStub to use a different stub for each customization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 6 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/ic.cc ('k') | src/x64/code-stubs-x64.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 3220
3221 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 3221 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
3222 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3222 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3223 __ lw(vector, FieldMemOperand(vector, 3223 __ lw(vector, FieldMemOperand(vector,
3224 JSFunction::kSharedFunctionInfoOffset)); 3224 JSFunction::kSharedFunctionInfoOffset));
3225 __ lw(vector, FieldMemOperand(vector, 3225 __ lw(vector, FieldMemOperand(vector,
3226 SharedFunctionInfo::kFeedbackVectorOffset)); 3226 SharedFunctionInfo::kFeedbackVectorOffset));
3227 } 3227 }
3228 3228
3229 3229
3230 void CallICStub::Generate_MonomorphicArray(MacroAssembler* masm, Label* miss) { 3230 void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
3231 // a1 - function 3231 // a1 - function
3232 // a2 - feedback vector
3233 // a3 - slot id 3232 // a3 - slot id
3233 Label miss;
3234
3235 EmitLoadTypeFeedbackVector(masm, a2);
3236
3234 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at); 3237 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at);
3235 __ Branch(miss, ne, a1, Operand(at)); 3238 __ Branch(&miss, ne, a1, Operand(at));
3236 3239
3237 __ li(a0, Operand(arg_count())); 3240 __ li(a0, Operand(arg_count()));
3238 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); 3241 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
3239 __ Addu(at, a2, Operand(at)); 3242 __ Addu(at, a2, Operand(at));
3240 __ lw(a2, FieldMemOperand(at, FixedArray::kHeaderSize)); 3243 __ lw(a2, FieldMemOperand(at, FixedArray::kHeaderSize));
3241 // Verify that a2 contains an AllocationSite 3244 // Verify that a2 contains an AllocationSite
3242 __ AssertUndefinedOrAllocationSite(a2, at); 3245 __ AssertUndefinedOrAllocationSite(a2, at);
3243 ArrayConstructorStub stub(masm->isolate(), arg_count()); 3246 ArrayConstructorStub stub(masm->isolate(), arg_count());
3244 __ TailCallStub(&stub); 3247 __ TailCallStub(&stub);
3245 }
3246
3247
3248 void CallICStub::Generate_CustomFeedbackCall(MacroAssembler* masm) {
3249 // a1 - function
3250 // a2 - feedback vector
3251 // a3 - slot id
3252 Label miss;
3253
3254 if (state_.stub_type() == CallIC::MONOMORPHIC_ARRAY) {
3255 Generate_MonomorphicArray(masm, &miss);
3256 } else {
3257 // So far there is only one customer for our custom feedback scheme.
3258 UNREACHABLE();
3259 }
3260 3248
3261 __ bind(&miss); 3249 __ bind(&miss);
3262 GenerateMiss(masm); 3250 GenerateMiss(masm, IC::kCallIC_Customization_Miss);
3263 3251
3264 // The slow case, we need this no matter what to complete a call after a miss. 3252 // The slow case, we need this no matter what to complete a call after a miss.
3265 CallFunctionNoFeedback(masm, 3253 CallFunctionNoFeedback(masm,
3266 arg_count(), 3254 arg_count(),
3267 true, 3255 true,
3268 CallAsMethod()); 3256 CallAsMethod());
3269 3257
3270 // Unreachable. 3258 // Unreachable.
3271 __ stop("Unexpected code address"); 3259 __ stop("Unexpected code address");
3272 } 3260 }
3273 3261
3274 3262
3275 void CallICStub::Generate(MacroAssembler* masm) { 3263 void CallICStub::Generate(MacroAssembler* masm) {
3276 // r1 - function 3264 // r1 - function
3277 // r3 - slot id (Smi) 3265 // r3 - slot id (Smi)
3278 Label extra_checks_or_miss, slow_start; 3266 Label extra_checks_or_miss, slow_start;
3279 Label slow, non_function, wrap, cont; 3267 Label slow, non_function, wrap, cont;
3280 Label have_js_function; 3268 Label have_js_function;
3281 int argc = state_.arg_count(); 3269 int argc = state_.arg_count();
3282 ParameterCount actual(argc); 3270 ParameterCount actual(argc);
3283 3271
3284 EmitLoadTypeFeedbackVector(masm, a2); 3272 EmitLoadTypeFeedbackVector(masm, a2);
3285 3273
3286 if (state_.stub_type() != CallIC::DEFAULT) {
3287 Generate_CustomFeedbackCall(masm);
3288 return;
3289 }
3290
3291 // The checks. First, does r1 match the recorded monomorphic target? 3274 // The checks. First, does r1 match the recorded monomorphic target?
3292 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 3275 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
3293 __ Addu(t0, a2, Operand(t0)); 3276 __ Addu(t0, a2, Operand(t0));
3294 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); 3277 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize));
3295 __ Branch(&extra_checks_or_miss, ne, a1, Operand(t0)); 3278 __ Branch(&extra_checks_or_miss, ne, a1, Operand(t0));
3296 3279
3297 __ bind(&have_js_function); 3280 __ bind(&have_js_function);
3298 if (state_.CallAsMethod()) { 3281 if (state_.CallAsMethod()) {
3299 EmitContinueIfStrictOrNative(masm, &cont); 3282 EmitContinueIfStrictOrNative(masm, &cont);
3300 // Compute the receiver in sloppy mode. 3283 // Compute the receiver in sloppy mode.
(...skipping 28 matching lines...) Expand all
3329 // We are going megamorphic, and we don't want to visit the runtime. 3312 // We are going megamorphic, and we don't want to visit the runtime.
3330 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 3313 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
3331 __ Addu(t0, a2, Operand(t0)); 3314 __ Addu(t0, a2, Operand(t0));
3332 __ LoadRoot(at, Heap::kMegamorphicSymbolRootIndex); 3315 __ LoadRoot(at, Heap::kMegamorphicSymbolRootIndex);
3333 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); 3316 __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize));
3334 __ Branch(&slow_start); 3317 __ Branch(&slow_start);
3335 } 3318 }
3336 3319
3337 // We are here because tracing is on or we are going monomorphic. 3320 // We are here because tracing is on or we are going monomorphic.
3338 __ bind(&miss); 3321 __ bind(&miss);
3339 GenerateMiss(masm); 3322 GenerateMiss(masm, IC::kCallIC_Miss);
3340 3323
3341 // the slow case 3324 // the slow case
3342 __ bind(&slow_start); 3325 __ bind(&slow_start);
3343 // Check that the function is really a JavaScript function. 3326 // Check that the function is really a JavaScript function.
3344 // r1: pushed function (to be verified) 3327 // r1: pushed function (to be verified)
3345 __ JumpIfSmi(a1, &non_function); 3328 __ JumpIfSmi(a1, &non_function);
3346 3329
3347 // Goto slow case if we do not have a function. 3330 // Goto slow case if we do not have a function.
3348 __ GetObjectType(a1, t0, t0); 3331 __ GetObjectType(a1, t0, t0);
3349 __ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE)); 3332 __ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE));
3350 __ Branch(&have_js_function); 3333 __ Branch(&have_js_function);
3351 } 3334 }
3352 3335
3353 3336
3354 void CallICStub::GenerateMiss(MacroAssembler* masm) { 3337 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
3355 // Get the receiver of the function from the stack; 1 ~ return address. 3338 // Get the receiver of the function from the stack; 1 ~ return address.
3356 __ lw(t0, MemOperand(sp, (state_.arg_count() + 1) * kPointerSize)); 3339 __ lw(t0, MemOperand(sp, (state_.arg_count() + 1) * kPointerSize));
3357 3340
3358 { 3341 {
3359 FrameScope scope(masm, StackFrame::INTERNAL); 3342 FrameScope scope(masm, StackFrame::INTERNAL);
3360 3343
3361 // Push the receiver and the function and feedback info. 3344 // Push the receiver and the function and feedback info.
3362 __ Push(t0, a1, a2, a3); 3345 __ Push(t0, a1, a2, a3);
3363 3346
3364 // Call the entry. 3347 // Call the entry.
3365 ExternalReference miss = ExternalReference(IC_Utility(IC::kCallIC_Miss), 3348 ExternalReference miss = ExternalReference(IC_Utility(id),
3366 masm->isolate()); 3349 masm->isolate());
3367 __ CallExternalReference(miss, 4); 3350 __ CallExternalReference(miss, 4);
3368 3351
3369 // Move result to a1 and exit the internal frame. 3352 // Move result to a1 and exit the internal frame.
3370 __ mov(a1, v0); 3353 __ mov(a1, v0);
3371 } 3354 }
3372 } 3355 }
3373 3356
3374 3357
3375 // StringCharCodeAtGenerator. 3358 // StringCharCodeAtGenerator.
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
5501 MemOperand(fp, 6 * kPointerSize), 5484 MemOperand(fp, 6 * kPointerSize),
5502 NULL); 5485 NULL);
5503 } 5486 }
5504 5487
5505 5488
5506 #undef __ 5489 #undef __
5507 5490
5508 } } // namespace v8::internal 5491 } } // namespace v8::internal
5509 5492
5510 #endif // V8_TARGET_ARCH_MIPS 5493 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698