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

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

Issue 817483005: LCodeGen::CallKnownFunction gets the function in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm Created 5 years, 11 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
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/mips/lithium-codegen-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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { 3400 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
3401 DCHECK(ToRegister(instr->context()).is(esi)); 3401 DCHECK(ToRegister(instr->context()).is(esi));
3402 __ push(esi); // The context is the first argument. 3402 __ push(esi); // The context is the first argument.
3403 __ push(Immediate(instr->hydrogen()->pairs())); 3403 __ push(Immediate(instr->hydrogen()->pairs()));
3404 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags()))); 3404 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags())));
3405 CallRuntime(Runtime::kDeclareGlobals, 3, instr); 3405 CallRuntime(Runtime::kDeclareGlobals, 3, instr);
3406 } 3406 }
3407 3407
3408 3408
3409 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3409 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3410 int formal_parameter_count, 3410 int formal_parameter_count, int arity,
3411 int arity, 3411 LInstruction* instr) {
3412 LInstruction* instr,
3413 EDIState edi_state) {
3414 bool dont_adapt_arguments = 3412 bool dont_adapt_arguments =
3415 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3413 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3416 bool can_invoke_directly = 3414 bool can_invoke_directly =
3417 dont_adapt_arguments || formal_parameter_count == arity; 3415 dont_adapt_arguments || formal_parameter_count == arity;
3418 3416
3417 Register function_reg = edi;
3418
3419 if (can_invoke_directly) { 3419 if (can_invoke_directly) {
3420 if (edi_state == EDI_UNINITIALIZED) {
3421 __ LoadHeapObject(edi, function);
3422 }
3423
3424 // Change context. 3420 // Change context.
3425 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 3421 __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
3426 3422
3427 // Set eax to arguments count if adaption is not needed. Assumes that eax 3423 // Set eax to arguments count if adaption is not needed. Assumes that eax
3428 // is available to write to at this point. 3424 // is available to write to at this point.
3429 if (dont_adapt_arguments) { 3425 if (dont_adapt_arguments) {
3430 __ mov(eax, arity); 3426 __ mov(eax, arity);
3431 } 3427 }
3432 3428
3433 // Invoke function directly. 3429 // Invoke function directly.
3434 if (function.is_identical_to(info()->closure())) { 3430 if (function.is_identical_to(info()->closure())) {
3435 __ CallSelf(); 3431 __ CallSelf();
3436 } else { 3432 } else {
3437 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); 3433 __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
3438 } 3434 }
3439 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3435 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3440 } else { 3436 } else {
3441 // We need to adapt arguments. 3437 // We need to adapt arguments.
3442 LPointerMap* pointers = instr->pointer_map(); 3438 LPointerMap* pointers = instr->pointer_map();
3443 SafepointGenerator generator( 3439 SafepointGenerator generator(
3444 this, pointers, Safepoint::kLazyDeopt); 3440 this, pointers, Safepoint::kLazyDeopt);
3445 ParameterCount count(arity); 3441 ParameterCount count(arity);
3446 ParameterCount expected(formal_parameter_count); 3442 ParameterCount expected(formal_parameter_count);
3447 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3443 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
3448 } 3444 }
3449 } 3445 }
3450 3446
3451 3447
3452 void LCodeGen::DoTailCallThroughMegamorphicCache( 3448 void LCodeGen::DoTailCallThroughMegamorphicCache(
3453 LTailCallThroughMegamorphicCache* instr) { 3449 LTailCallThroughMegamorphicCache* instr) {
3454 Register receiver = ToRegister(instr->receiver()); 3450 Register receiver = ToRegister(instr->receiver());
3455 Register name = ToRegister(instr->name()); 3451 Register name = ToRegister(instr->name());
3456 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); 3452 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister()));
3457 DCHECK(name.is(LoadDescriptor::NameRegister())); 3453 DCHECK(name.is(LoadDescriptor::NameRegister()));
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); 3925 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3930 if (known_function.is_null()) { 3926 if (known_function.is_null()) {
3931 LPointerMap* pointers = instr->pointer_map(); 3927 LPointerMap* pointers = instr->pointer_map();
3932 SafepointGenerator generator( 3928 SafepointGenerator generator(
3933 this, pointers, Safepoint::kLazyDeopt); 3929 this, pointers, Safepoint::kLazyDeopt);
3934 ParameterCount count(instr->arity()); 3930 ParameterCount count(instr->arity());
3935 __ InvokeFunction(edi, count, CALL_FUNCTION, generator); 3931 __ InvokeFunction(edi, count, CALL_FUNCTION, generator);
3936 } else { 3932 } else {
3937 CallKnownFunction(known_function, 3933 CallKnownFunction(known_function,
3938 instr->hydrogen()->formal_parameter_count(), 3934 instr->hydrogen()->formal_parameter_count(),
3939 instr->arity(), 3935 instr->arity(), instr);
3940 instr,
3941 EDI_CONTAINS_TARGET);
3942 } 3936 }
3943 } 3937 }
3944 3938
3945 3939
3946 void LCodeGen::DoCallFunction(LCallFunction* instr) { 3940 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3947 DCHECK(ToRegister(instr->context()).is(esi)); 3941 DCHECK(ToRegister(instr->context()).is(esi));
3948 DCHECK(ToRegister(instr->function()).is(edi)); 3942 DCHECK(ToRegister(instr->function()).is(edi));
3949 DCHECK(ToRegister(instr->result()).is(eax)); 3943 DCHECK(ToRegister(instr->result()).is(eax));
3950 3944
3951 int arity = instr->arity(); 3945 int arity = instr->arity();
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5736 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5743 RecordSafepoint(Safepoint::kNoLazyDeopt); 5737 RecordSafepoint(Safepoint::kNoLazyDeopt);
5744 } 5738 }
5745 5739
5746 5740
5747 #undef __ 5741 #undef __
5748 5742
5749 } } // namespace v8::internal 5743 } } // namespace v8::internal
5750 5744
5751 #endif // V8_TARGET_ARCH_IA32 5745 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698