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

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

Issue 1428953002: Simplify dispatch in FullCodeGenerator::VisitCall a bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MacroAssembler::PushRoot for ARM64. Created 5 years, 1 month 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/full-codegen/full-codegen.cc ('k') | src/full-codegen/mips/full-codegen-mips.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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 __ bind(&call); 2922 __ bind(&call);
2923 } 2923 }
2924 } else { 2924 } else {
2925 VisitForStackValue(callee); 2925 VisitForStackValue(callee);
2926 // refEnv.WithBaseObject() 2926 // refEnv.WithBaseObject()
2927 __ push(Immediate(isolate()->factory()->undefined_value())); 2927 __ push(Immediate(isolate()->factory()->undefined_value()));
2928 } 2928 }
2929 } 2929 }
2930 2930
2931 2931
2932 void FullCodeGenerator::VisitCall(Call* expr) { 2932 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
2933 #ifdef DEBUG 2933 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
2934 // We want to verify that RecordJSReturnSite gets called on all paths 2934 // to resolve the function we need to call. Then we call the resolved
2935 // through this function. Avoid early returns. 2935 // function using the given arguments.
2936 expr->return_is_recorded_ = false; 2936 ZoneList<Expression*>* args = expr->arguments();
2937 #endif 2937 int arg_count = args->length();
2938 2938
2939 Comment cmnt(masm_, "[ Call"); 2939 PushCalleeAndWithBaseObject(expr);
2940 Expression* callee = expr->expression();
2941 Call::CallType call_type = expr->GetCallType(isolate());
2942 2940
2943 if (call_type == Call::POSSIBLY_EVAL_CALL) { 2941 // Push the arguments.
2944 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 2942 for (int i = 0; i < arg_count; i++) {
2945 // to resolve the function we need to call. Then we call the resolved 2943 VisitForStackValue(args->at(i));
2946 // function using the given arguments.
2947 ZoneList<Expression*>* args = expr->arguments();
2948 int arg_count = args->length();
2949
2950 PushCalleeAndWithBaseObject(expr);
2951
2952 // Push the arguments.
2953 for (int i = 0; i < arg_count; i++) {
2954 VisitForStackValue(args->at(i));
2955 }
2956
2957 // Push a copy of the function (found below the arguments) and
2958 // resolve eval.
2959 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
2960 EmitResolvePossiblyDirectEval(arg_count);
2961
2962 // Touch up the stack with the resolved function.
2963 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2964
2965 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2966
2967 SetCallPosition(expr, arg_count);
2968 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
2969 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2970 __ CallStub(&stub);
2971 RecordJSReturnSite(expr);
2972 // Restore context register.
2973 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2974 context()->DropAndPlug(1, eax);
2975
2976 } else if (call_type == Call::GLOBAL_CALL) {
2977 EmitCallWithLoadIC(expr);
2978 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2979 // Call to a lookup slot (dynamically introduced variable).
2980 PushCalleeAndWithBaseObject(expr);
2981 EmitCall(expr);
2982 } else if (call_type == Call::NAMED_PROPERTY_CALL) {
2983 Property* property = callee->AsProperty();
2984 VisitForStackValue(property->obj());
2985 EmitCallWithLoadIC(expr);
2986 } else if (call_type == Call::KEYED_PROPERTY_CALL) {
2987 Property* property = callee->AsProperty();
2988 VisitForStackValue(property->obj());
2989 EmitKeyedCallWithLoadIC(expr, property->key());
2990 } else if (call_type == Call::NAMED_SUPER_PROPERTY_CALL) {
2991 EmitSuperCallWithLoadIC(expr);
2992 } else if (call_type == Call::KEYED_SUPER_PROPERTY_CALL) {
2993 EmitKeyedSuperCallWithLoadIC(expr);
2994 } else if (call_type == Call::SUPER_CALL) {
2995 EmitSuperConstructorCall(expr);
2996 } else {
2997 DCHECK(call_type == Call::OTHER_CALL);
2998 // Call to an arbitrary expression not handled specially above.
2999 VisitForStackValue(callee);
3000 __ push(Immediate(isolate()->factory()->undefined_value()));
3001 // Emit function call.
3002 EmitCall(expr);
3003 } 2944 }
3004 2945
3005 #ifdef DEBUG 2946 // Push a copy of the function (found below the arguments) and
3006 // RecordJSReturnSite should have been called. 2947 // resolve eval.
3007 DCHECK(expr->return_is_recorded_); 2948 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
3008 #endif 2949 EmitResolvePossiblyDirectEval(arg_count);
2950
2951 // Touch up the stack with the resolved function.
2952 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2953
2954 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2955
2956 SetCallPosition(expr, arg_count);
2957 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
2958 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2959 __ CallStub(&stub);
2960 RecordJSReturnSite(expr);
2961 // Restore context register.
2962 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2963 context()->DropAndPlug(1, eax);
3009 } 2964 }
3010 2965
3011 2966
3012 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2967 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3013 Comment cmnt(masm_, "[ CallNew"); 2968 Comment cmnt(masm_, "[ CallNew");
3014 // According to ECMA-262, section 11.2.2, page 44, the function 2969 // According to ECMA-262, section 11.2.2, page 44, the function
3015 // expression in new calls must be evaluated before the 2970 // expression in new calls must be evaluated before the
3016 // arguments. 2971 // arguments.
3017 2972
3018 // Push constructor on the stack. If it's not a function it's used as 2973 // Push constructor on the stack. If it's not a function it's used as
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
5059 Assembler::target_address_at(call_target_address, 5014 Assembler::target_address_at(call_target_address,
5060 unoptimized_code)); 5015 unoptimized_code));
5061 return OSR_AFTER_STACK_CHECK; 5016 return OSR_AFTER_STACK_CHECK;
5062 } 5017 }
5063 5018
5064 5019
5065 } // namespace internal 5020 } // namespace internal
5066 } // namespace v8 5021 } // namespace v8
5067 5022
5068 #endif // V8_TARGET_ARCH_IA32 5023 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698