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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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/x64/full-codegen-x64.cc ('k') | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 __ bind(&call); 2915 __ bind(&call);
2916 } 2916 }
2917 } else { 2917 } else {
2918 VisitForStackValue(callee); 2918 VisitForStackValue(callee);
2919 // refEnv.WithBaseObject() 2919 // refEnv.WithBaseObject()
2920 __ push(Immediate(isolate()->factory()->undefined_value())); 2920 __ push(Immediate(isolate()->factory()->undefined_value()));
2921 } 2921 }
2922 } 2922 }
2923 2923
2924 2924
2925 void FullCodeGenerator::VisitCall(Call* expr) { 2925 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
2926 #ifdef DEBUG 2926 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
2927 // We want to verify that RecordJSReturnSite gets called on all paths 2927 // to resolve the function we need to call. Then we call the resolved
2928 // through this function. Avoid early returns. 2928 // function using the given arguments.
2929 expr->return_is_recorded_ = false; 2929 ZoneList<Expression*>* args = expr->arguments();
2930 #endif 2930 int arg_count = args->length();
2931 2931
2932 Comment cmnt(masm_, "[ Call"); 2932 PushCalleeAndWithBaseObject(expr);
2933 Expression* callee = expr->expression();
2934 Call::CallType call_type = expr->GetCallType(isolate());
2935 2933
2936 if (call_type == Call::POSSIBLY_EVAL_CALL) { 2934 // Push the arguments.
2937 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 2935 for (int i = 0; i < arg_count; i++) {
2938 // to resolve the function we need to call. Then we call the resolved 2936 VisitForStackValue(args->at(i));
2939 // function using the given arguments.
2940 ZoneList<Expression*>* args = expr->arguments();
2941 int arg_count = args->length();
2942
2943 PushCalleeAndWithBaseObject(expr);
2944
2945 // Push the arguments.
2946 for (int i = 0; i < arg_count; i++) {
2947 VisitForStackValue(args->at(i));
2948 }
2949
2950 // Push a copy of the function (found below the arguments) and
2951 // resolve eval.
2952 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
2953 EmitResolvePossiblyDirectEval(arg_count);
2954
2955 // Touch up the stack with the resolved function.
2956 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2957
2958 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2959
2960 SetCallPosition(expr, arg_count);
2961 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
2962 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2963 __ CallStub(&stub);
2964 RecordJSReturnSite(expr);
2965 // Restore context register.
2966 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2967 context()->DropAndPlug(1, eax);
2968
2969 } else if (call_type == Call::GLOBAL_CALL) {
2970 EmitCallWithLoadIC(expr);
2971 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2972 // Call to a lookup slot (dynamically introduced variable).
2973 PushCalleeAndWithBaseObject(expr);
2974 EmitCall(expr);
2975 } else if (call_type == Call::NAMED_PROPERTY_CALL) {
2976 Property* property = callee->AsProperty();
2977 VisitForStackValue(property->obj());
2978 EmitCallWithLoadIC(expr);
2979 } else if (call_type == Call::KEYED_PROPERTY_CALL) {
2980 Property* property = callee->AsProperty();
2981 VisitForStackValue(property->obj());
2982 EmitKeyedCallWithLoadIC(expr, property->key());
2983 } else if (call_type == Call::NAMED_SUPER_PROPERTY_CALL) {
2984 EmitSuperCallWithLoadIC(expr);
2985 } else if (call_type == Call::KEYED_SUPER_PROPERTY_CALL) {
2986 EmitKeyedSuperCallWithLoadIC(expr);
2987 } else if (call_type == Call::SUPER_CALL) {
2988 EmitSuperConstructorCall(expr);
2989 } else {
2990 DCHECK(call_type == Call::OTHER_CALL);
2991 // Call to an arbitrary expression not handled specially above.
2992 VisitForStackValue(callee);
2993 __ push(Immediate(isolate()->factory()->undefined_value()));
2994 // Emit function call.
2995 EmitCall(expr);
2996 } 2937 }
2997 2938
2998 #ifdef DEBUG 2939 // Push a copy of the function (found below the arguments) and
2999 // RecordJSReturnSite should have been called. 2940 // resolve eval.
3000 DCHECK(expr->return_is_recorded_); 2941 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
3001 #endif 2942 EmitResolvePossiblyDirectEval(arg_count);
2943
2944 // Touch up the stack with the resolved function.
2945 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
2946
2947 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
2948
2949 SetCallPosition(expr, arg_count);
2950 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
2951 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2952 __ CallStub(&stub);
2953 RecordJSReturnSite(expr);
2954 // Restore context register.
2955 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2956 context()->DropAndPlug(1, eax);
3002 } 2957 }
3003 2958
3004 2959
3005 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2960 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3006 Comment cmnt(masm_, "[ CallNew"); 2961 Comment cmnt(masm_, "[ CallNew");
3007 // According to ECMA-262, section 11.2.2, page 44, the function 2962 // According to ECMA-262, section 11.2.2, page 44, the function
3008 // expression in new calls must be evaluated before the 2963 // expression in new calls must be evaluated before the
3009 // arguments. 2964 // arguments.
3010 2965
3011 // Push constructor on the stack. If it's not a function it's used as 2966 // 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
5052 Assembler::target_address_at(call_target_address, 5007 Assembler::target_address_at(call_target_address,
5053 unoptimized_code)); 5008 unoptimized_code));
5054 return OSR_AFTER_STACK_CHECK; 5009 return OSR_AFTER_STACK_CHECK;
5055 } 5010 }
5056 5011
5057 5012
5058 } // namespace internal 5013 } // namespace internal
5059 } // namespace v8 5014 } // namespace v8
5060 5015
5061 #endif // V8_TARGET_ARCH_X87 5016 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698