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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.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
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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 } 3025 }
3026 } else { 3026 } else {
3027 VisitForStackValue(callee); 3027 VisitForStackValue(callee);
3028 // refEnv.WithBaseObject() 3028 // refEnv.WithBaseObject()
3029 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 3029 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
3030 __ push(a2); // Reserved receiver slot. 3030 __ push(a2); // Reserved receiver slot.
3031 } 3031 }
3032 } 3032 }
3033 3033
3034 3034
3035 void FullCodeGenerator::VisitCall(Call* expr) { 3035 void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
3036 #ifdef DEBUG 3036 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3037 // We want to verify that RecordJSReturnSite gets called on all paths 3037 // to resolve the function we need to call. Then we call the resolved
3038 // through this function. Avoid early returns. 3038 // function using the given arguments.
3039 expr->return_is_recorded_ = false; 3039 ZoneList<Expression*>* args = expr->arguments();
3040 #endif 3040 int arg_count = args->length();
3041 PushCalleeAndWithBaseObject(expr);
3041 3042
3042 Comment cmnt(masm_, "[ Call"); 3043 // Push the arguments.
3043 Expression* callee = expr->expression(); 3044 for (int i = 0; i < arg_count; i++) {
3044 Call::CallType call_type = expr->GetCallType(isolate()); 3045 VisitForStackValue(args->at(i));
3045
3046 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3047 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3048 // to resolve the function we need to call. Then we call the resolved
3049 // function using the given arguments.
3050 ZoneList<Expression*>* args = expr->arguments();
3051 int arg_count = args->length();
3052 PushCalleeAndWithBaseObject(expr);
3053
3054 // Push the arguments.
3055 for (int i = 0; i < arg_count; i++) {
3056 VisitForStackValue(args->at(i));
3057 }
3058
3059 // Push a copy of the function (found below the arguments) and
3060 // resolve eval.
3061 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3062 __ push(a1);
3063 EmitResolvePossiblyDirectEval(arg_count);
3064
3065 // Touch up the stack with the resolved function.
3066 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3067
3068 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
3069 // Record source position for debugger.
3070 SetCallPosition(expr, arg_count);
3071 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3072 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3073 __ CallStub(&stub);
3074 RecordJSReturnSite(expr);
3075 // Restore context register.
3076 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3077 context()->DropAndPlug(1, v0);
3078 } else if (call_type == Call::GLOBAL_CALL) {
3079 EmitCallWithLoadIC(expr);
3080 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
3081 // Call to a lookup slot (dynamically introduced variable).
3082 PushCalleeAndWithBaseObject(expr);
3083 EmitCall(expr);
3084 } else if (call_type == Call::NAMED_PROPERTY_CALL) {
3085 Property* property = callee->AsProperty();
3086 VisitForStackValue(property->obj());
3087 EmitCallWithLoadIC(expr);
3088 } else if (call_type == Call::KEYED_PROPERTY_CALL) {
3089 Property* property = callee->AsProperty();
3090 VisitForStackValue(property->obj());
3091 EmitKeyedCallWithLoadIC(expr, property->key());
3092 } else if (call_type == Call::NAMED_SUPER_PROPERTY_CALL) {
3093 EmitSuperCallWithLoadIC(expr);
3094 } else if (call_type == Call::KEYED_SUPER_PROPERTY_CALL) {
3095 EmitKeyedSuperCallWithLoadIC(expr);
3096 } else if (call_type == Call::SUPER_CALL) {
3097 EmitSuperConstructorCall(expr);
3098 } else {
3099 DCHECK(call_type == Call::OTHER_CALL);
3100 // Call to an arbitrary expression not handled specially above.
3101 VisitForStackValue(callee);
3102 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
3103 __ push(a1);
3104 // Emit function call.
3105 EmitCall(expr);
3106 } 3046 }
3107 3047
3108 #ifdef DEBUG 3048 // Push a copy of the function (found below the arguments) and
3109 // RecordJSReturnSite should have been called. 3049 // resolve eval.
3110 DCHECK(expr->return_is_recorded_); 3050 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3111 #endif 3051 __ push(a1);
3052 EmitResolvePossiblyDirectEval(arg_count);
3053
3054 // Touch up the stack with the resolved function.
3055 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3056
3057 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
3058 // Record source position for debugger.
3059 SetCallPosition(expr, arg_count);
3060 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3061 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3062 __ CallStub(&stub);
3063 RecordJSReturnSite(expr);
3064 // Restore context register.
3065 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3066 context()->DropAndPlug(1, v0);
3112 } 3067 }
3113 3068
3114 3069
3115 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3070 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3116 Comment cmnt(masm_, "[ CallNew"); 3071 Comment cmnt(masm_, "[ CallNew");
3117 // According to ECMA-262, section 11.2.2, page 44, the function 3072 // According to ECMA-262, section 11.2.2, page 44, the function
3118 // expression in new calls must be evaluated before the 3073 // expression in new calls must be evaluated before the
3119 // arguments. 3074 // arguments.
3120 3075
3121 // Push constructor on the stack. If it's not a function it's used as 3076 // Push constructor on the stack. If it's not a function it's used as
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
5153 reinterpret_cast<uint32_t>( 5108 reinterpret_cast<uint32_t>(
5154 isolate->builtins()->OsrAfterStackCheck()->entry())); 5109 isolate->builtins()->OsrAfterStackCheck()->entry()));
5155 return OSR_AFTER_STACK_CHECK; 5110 return OSR_AFTER_STACK_CHECK;
5156 } 5111 }
5157 5112
5158 5113
5159 } // namespace internal 5114 } // namespace internal
5160 } // namespace v8 5115 } // namespace v8
5161 5116
5162 #endif // V8_TARGET_ARCH_MIPS 5117 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698