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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) { 2731 void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
2732 Register global = ToRegister(instr->global()); 2732 Register global = ToRegister(instr->global());
2733 Register result = ToRegister(instr->result()); 2733 Register result = ToRegister(instr->result());
2734 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); 2734 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset));
2735 } 2735 }
2736 2736
2737 2737
2738 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 2738 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
2739 int arity, 2739 int arity,
2740 LInstruction* instr, 2740 LInstruction* instr,
2741 CallKind call_kind) { 2741 CallKind call_kind,
2742 EDIState edi_state) {
2742 bool can_invoke_directly = !function->NeedsArgumentsAdaption() || 2743 bool can_invoke_directly = !function->NeedsArgumentsAdaption() ||
2743 function->shared()->formal_parameter_count() == arity; 2744 function->shared()->formal_parameter_count() == arity;
2744 2745
2745 LPointerMap* pointers = instr->pointer_map(); 2746 LPointerMap* pointers = instr->pointer_map();
2746 RecordPosition(pointers->position()); 2747 RecordPosition(pointers->position());
2747 2748
2748 if (can_invoke_directly) { 2749 if (can_invoke_directly) {
2749 __ LoadHeapObject(edi, function); 2750 if (edi_state == EDI_UNINITIALIZED) {
2751 __ LoadHeapObject(edi, function);
2752 }
2750 2753
2751 // Change context if needed. 2754 // Change context if needed.
2752 bool change_context = 2755 bool change_context =
2753 (info()->closure()->context() != function->context()) || 2756 (info()->closure()->context() != function->context()) ||
2754 scope()->contains_with() || 2757 scope()->contains_with() ||
2755 (scope()->num_heap_slots() > 0); 2758 (scope()->num_heap_slots() > 0);
2756 2759
2757 if (change_context) { 2760 if (change_context) {
2758 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2761 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2759 } else { 2762 } else {
(...skipping 22 matching lines...) Expand all
2782 __ InvokeFunction(function, count, CALL_FUNCTION, generator, call_kind); 2785 __ InvokeFunction(function, count, CALL_FUNCTION, generator, call_kind);
2783 } 2786 }
2784 } 2787 }
2785 2788
2786 2789
2787 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { 2790 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
2788 ASSERT(ToRegister(instr->result()).is(eax)); 2791 ASSERT(ToRegister(instr->result()).is(eax));
2789 CallKnownFunction(instr->function(), 2792 CallKnownFunction(instr->function(),
2790 instr->arity(), 2793 instr->arity(),
2791 instr, 2794 instr,
2792 CALL_AS_METHOD); 2795 CALL_AS_METHOD,
2796 EDI_UNINITIALIZED);
2793 } 2797 }
2794 2798
2795 2799
2796 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) { 2800 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
2797 Register input_reg = ToRegister(instr->value()); 2801 Register input_reg = ToRegister(instr->value());
2798 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 2802 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
2799 factory()->heap_number_map()); 2803 factory()->heap_number_map());
2800 DeoptimizeIf(not_equal, instr->environment()); 2804 DeoptimizeIf(not_equal, instr->environment());
2801 2805
2802 Label done; 2806 Label done;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 UNREACHABLE(); 3233 UNREACHABLE();
3230 } 3234 }
3231 } 3235 }
3232 3236
3233 3237
3234 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { 3238 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3235 ASSERT(ToRegister(instr->context()).is(esi)); 3239 ASSERT(ToRegister(instr->context()).is(esi));
3236 ASSERT(ToRegister(instr->function()).is(edi)); 3240 ASSERT(ToRegister(instr->function()).is(edi));
3237 ASSERT(instr->HasPointerMap()); 3241 ASSERT(instr->HasPointerMap());
3238 ASSERT(instr->HasDeoptimizationEnvironment()); 3242 ASSERT(instr->HasDeoptimizationEnvironment());
3239 LPointerMap* pointers = instr->pointer_map(); 3243
3240 RecordPosition(pointers->position()); 3244 if (instr->known_function().is_null()) {
3241 SafepointGenerator generator( 3245 LPointerMap* pointers = instr->pointer_map();
3242 this, pointers, Safepoint::kLazyDeopt); 3246 RecordPosition(pointers->position());
3243 ParameterCount count(instr->arity()); 3247 SafepointGenerator generator(
3244 __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_METHOD); 3248 this, pointers, Safepoint::kLazyDeopt);
3249 ParameterCount count(instr->arity());
3250 __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_METHOD);
3251 } else {
3252 CallKnownFunction(instr->known_function(),
3253 instr->arity(),
3254 instr,
3255 CALL_AS_METHOD,
3256 EDI_CONTAINS_TARGET);
3257 }
3245 } 3258 }
3246 3259
3247 3260
3248 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 3261 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3249 ASSERT(ToRegister(instr->context()).is(esi)); 3262 ASSERT(ToRegister(instr->context()).is(esi));
3250 ASSERT(ToRegister(instr->key()).is(ecx)); 3263 ASSERT(ToRegister(instr->key()).is(ecx));
3251 ASSERT(ToRegister(instr->result()).is(eax)); 3264 ASSERT(ToRegister(instr->result()).is(eax));
3252 3265
3253 int arity = instr->arity(); 3266 int arity = instr->arity();
3254 Handle<Code> ic = 3267 Handle<Code> ic =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; 3302 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
3290 Handle<Code> ic = 3303 Handle<Code> ic =
3291 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); 3304 isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
3292 __ mov(ecx, instr->name()); 3305 __ mov(ecx, instr->name());
3293 CallCode(ic, mode, instr); 3306 CallCode(ic, mode, instr);
3294 } 3307 }
3295 3308
3296 3309
3297 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { 3310 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3298 ASSERT(ToRegister(instr->result()).is(eax)); 3311 ASSERT(ToRegister(instr->result()).is(eax));
3299 CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION); 3312 CallKnownFunction(instr->target(),
3313 instr->arity(),
3314 instr,
3315 CALL_AS_FUNCTION,
3316 EDI_UNINITIALIZED);
3300 } 3317 }
3301 3318
3302 3319
3303 void LCodeGen::DoCallNew(LCallNew* instr) { 3320 void LCodeGen::DoCallNew(LCallNew* instr) {
3304 ASSERT(ToRegister(instr->context()).is(esi)); 3321 ASSERT(ToRegister(instr->context()).is(esi));
3305 ASSERT(ToRegister(instr->constructor()).is(edi)); 3322 ASSERT(ToRegister(instr->constructor()).is(edi));
3306 ASSERT(ToRegister(instr->result()).is(eax)); 3323 ASSERT(ToRegister(instr->result()).is(eax));
3307 3324
3308 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 3325 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
3309 __ Set(eax, Immediate(instr->arity())); 3326 __ Set(eax, Immediate(instr->arity()));
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
5008 FixedArray::kHeaderSize - kPointerSize)); 5025 FixedArray::kHeaderSize - kPointerSize));
5009 __ bind(&done); 5026 __ bind(&done);
5010 } 5027 }
5011 5028
5012 5029
5013 #undef __ 5030 #undef __
5014 5031
5015 } } // namespace v8::internal 5032 } } // namespace v8::internal
5016 5033
5017 #endif // V8_TARGET_ARCH_IA32 5034 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698