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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 10116021: Simplify invocation sequence at monomorphic function invocation sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 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/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.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 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { 2841 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2842 Register global = ToRegister(instr->global()); 2842 Register global = ToRegister(instr->global());
2843 Register result = ToRegister(instr->result()); 2843 Register result = ToRegister(instr->result());
2844 __ lw(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset)); 2844 __ lw(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset));
2845 } 2845 }
2846 2846
2847 2847
2848 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 2848 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2849 int arity, 2849 int arity,
2850 LInstruction* instr, 2850 LInstruction* instr,
2851 CallKind call_kind) { 2851 CallKind call_kind,
2852 A1State a1_state) {
2852 bool can_invoke_directly = !function->NeedsArgumentsAdaption() || 2853 bool can_invoke_directly = !function->NeedsArgumentsAdaption() ||
2853 function->shared()->formal_parameter_count() == arity; 2854 function->shared()->formal_parameter_count() == arity;
2854 2855
2855 LPointerMap* pointers = instr->pointer_map(); 2856 LPointerMap* pointers = instr->pointer_map();
2856 RecordPosition(pointers->position()); 2857 RecordPosition(pointers->position());
2857 2858
2858 if (can_invoke_directly) { 2859 if (can_invoke_directly) {
2859 __ LoadHeapObject(a1, function); 2860 if (a1_state == A1_UNINITIALIZED) {
2861 __ LoadHeapObject(a1, function);
2862 }
2863
2860 // Change context if needed. 2864 // Change context if needed.
2861 bool change_context = 2865 bool change_context =
2862 (info()->closure()->context() != function->context()) || 2866 (info()->closure()->context() != function->context()) ||
2863 scope()->contains_with() || 2867 scope()->contains_with() ||
2864 (scope()->num_heap_slots() > 0); 2868 (scope()->num_heap_slots() > 0);
2865 if (change_context) { 2869 if (change_context) {
2866 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 2870 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2867 } 2871 }
2868 2872
2869 // Set r0 to arguments count if adaption is not needed. Assumes that r0 2873 // Set r0 to arguments count if adaption is not needed. Assumes that r0
(...skipping 16 matching lines...) Expand all
2886 } 2890 }
2887 2891
2888 // Restore context. 2892 // Restore context.
2889 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2893 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2890 } 2894 }
2891 2895
2892 2896
2893 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { 2897 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2894 ASSERT(ToRegister(instr->result()).is(v0)); 2898 ASSERT(ToRegister(instr->result()).is(v0));
2895 __ mov(a0, v0); 2899 __ mov(a0, v0);
2896 CallKnownFunction(instr->function(), instr->arity(), instr, CALL_AS_METHOD); 2900 CallKnownFunction(instr->function(),
2901 instr->arity(),
2902 instr,
2903 CALL_AS_METHOD,
2904 A1_UNINITIALIZED);
2897 } 2905 }
2898 2906
2899 2907
2900 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { 2908 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2901 Register input = ToRegister(instr->InputAt(0)); 2909 Register input = ToRegister(instr->InputAt(0));
2902 Register result = ToRegister(instr->result()); 2910 Register result = ToRegister(instr->result());
2903 Register scratch = scratch0(); 2911 Register scratch = scratch0();
2904 2912
2905 // Deoptimize if not a heap number. 2913 // Deoptimize if not a heap number.
2906 __ lw(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); 2914 __ lw(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 Abort("Unimplemented type of LUnaryMathOperation."); 3331 Abort("Unimplemented type of LUnaryMathOperation.");
3324 UNREACHABLE(); 3332 UNREACHABLE();
3325 } 3333 }
3326 } 3334 }
3327 3335
3328 3336
3329 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { 3337 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3330 ASSERT(ToRegister(instr->function()).is(a1)); 3338 ASSERT(ToRegister(instr->function()).is(a1));
3331 ASSERT(instr->HasPointerMap()); 3339 ASSERT(instr->HasPointerMap());
3332 ASSERT(instr->HasDeoptimizationEnvironment()); 3340 ASSERT(instr->HasDeoptimizationEnvironment());
3333 LPointerMap* pointers = instr->pointer_map(); 3341
3334 RecordPosition(pointers->position()); 3342 if (instr->known_function().is_null()) {
3335 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3343 LPointerMap* pointers = instr->pointer_map();
3336 ParameterCount count(instr->arity()); 3344 RecordPosition(pointers->position());
3337 __ InvokeFunction(a1, count, CALL_FUNCTION, generator, CALL_AS_METHOD); 3345 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3338 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3346 ParameterCount count(instr->arity());
3347 __ InvokeFunction(a1, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
3348 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3349 } else {
3350 CallKnownFunction(instr->known_function(),
3351 instr->arity(),
3352 instr,
3353 CALL_AS_METHOD,
3354 A1_CONTAINS_TARGET);
3355 }
3339 } 3356 }
3340 3357
3341 3358
3342 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 3359 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3343 ASSERT(ToRegister(instr->result()).is(v0)); 3360 ASSERT(ToRegister(instr->result()).is(v0));
3344 3361
3345 int arity = instr->arity(); 3362 int arity = instr->arity();
3346 Handle<Code> ic = 3363 Handle<Code> ic =
3347 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); 3364 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity);
3348 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3365 CallCode(ic, RelocInfo::CODE_TARGET, instr);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 Handle<Code> ic = 3400 Handle<Code> ic =
3384 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); 3401 isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
3385 __ li(a2, Operand(instr->name())); 3402 __ li(a2, Operand(instr->name()));
3386 CallCode(ic, mode, instr); 3403 CallCode(ic, mode, instr);
3387 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3404 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3388 } 3405 }
3389 3406
3390 3407
3391 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { 3408 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3392 ASSERT(ToRegister(instr->result()).is(v0)); 3409 ASSERT(ToRegister(instr->result()).is(v0));
3393 CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION); 3410 CallKnownFunction(instr->target(),
3411 instr->arity(),
3412 instr,
3413 CALL_AS_FUNCTION,
3414 A1_UNINITIALIZED);
3394 } 3415 }
3395 3416
3396 3417
3397 void LCodeGen::DoCallNew(LCallNew* instr) { 3418 void LCodeGen::DoCallNew(LCallNew* instr) {
3398 ASSERT(ToRegister(instr->InputAt(0)).is(a1)); 3419 ASSERT(ToRegister(instr->InputAt(0)).is(a1));
3399 ASSERT(ToRegister(instr->result()).is(v0)); 3420 ASSERT(ToRegister(instr->result()).is(v0));
3400 3421
3401 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 3422 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
3402 __ li(a0, Operand(instr->arity())); 3423 __ li(a0, Operand(instr->arity()));
3403 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); 3424 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr);
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
5089 __ Subu(scratch, result, scratch); 5110 __ Subu(scratch, result, scratch);
5090 __ lw(result, FieldMemOperand(scratch, 5111 __ lw(result, FieldMemOperand(scratch,
5091 FixedArray::kHeaderSize - kPointerSize)); 5112 FixedArray::kHeaderSize - kPointerSize));
5092 __ bind(&done); 5113 __ bind(&done);
5093 } 5114 }
5094 5115
5095 5116
5096 #undef __ 5117 #undef __
5097 5118
5098 } } // namespace v8::internal 5119 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698