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

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

Issue 1811563002: [fullcodegen] Avoid arguments juggling when calling a JS runtime function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@call-js-runtime
Patch Set: Created 4 years, 9 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/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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 3228
3229 __ bind(&runtime); 3229 __ bind(&runtime);
3230 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3230 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3231 3231
3232 __ bind(&done); 3232 __ bind(&done);
3233 context()->Plug(eax); 3233 context()->Plug(eax);
3234 } 3234 }
3235 3235
3236 3236
3237 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3237 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3238 // Push function.
3239 __ LoadGlobalFunction(expr->context_index(), eax);
3240 PushOperand(eax);
3241
3238 // Push undefined as receiver. 3242 // Push undefined as receiver.
3239 PushOperand(isolate()->factory()->undefined_value()); 3243 PushOperand(isolate()->factory()->undefined_value());
3240
3241 __ LoadGlobalFunction(expr->context_index(), eax);
3242 } 3244 }
3243 3245
3244 3246
3245 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3247 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
3246 ZoneList<Expression*>* args = expr->arguments(); 3248 ZoneList<Expression*>* args = expr->arguments();
3247 int arg_count = args->length(); 3249 int arg_count = args->length();
3248 3250
3249 SetCallPosition(expr); 3251 SetCallPosition(expr);
3250 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 3252 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
3251 __ Set(eax, arg_count); 3253 __ Set(eax, arg_count);
3252 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3254 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3253 RelocInfo::CODE_TARGET); 3255 RelocInfo::CODE_TARGET);
3254 OperandStackDepthDecrement(arg_count + 1); 3256 OperandStackDepthDecrement(arg_count + 1);
3255 } 3257 }
3256 3258
3257 3259
3258 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3260 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3259 ZoneList<Expression*>* args = expr->arguments(); 3261 ZoneList<Expression*>* args = expr->arguments();
3260 int arg_count = args->length(); 3262 int arg_count = args->length();
3261 3263
3262 if (expr->is_jsruntime()) { 3264 if (expr->is_jsruntime()) {
3263 Comment cmnt(masm_, "[ CallRuntime"); 3265 Comment cmnt(masm_, "[ CallRuntime");
3264 EmitLoadJSRuntimeFunction(expr); 3266 EmitLoadJSRuntimeFunction(expr);
3265 3267
3266 // Push the target function under the receiver.
3267 PushOperand(Operand(esp, 0));
3268 __ mov(Operand(esp, kPointerSize), eax);
3269
3270 // Push the arguments ("left-to-right"). 3268 // Push the arguments ("left-to-right").
3271 for (int i = 0; i < arg_count; i++) { 3269 for (int i = 0; i < arg_count; i++) {
3272 VisitForStackValue(args->at(i)); 3270 VisitForStackValue(args->at(i));
3273 } 3271 }
3274 3272
3275 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3273 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3276 EmitCallJSRuntimeFunction(expr); 3274 EmitCallJSRuntimeFunction(expr);
3277 3275
3278 // Restore context register. 3276 // Restore context register.
3279 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3277 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 isolate->builtins()->OnStackReplacement()->entry(), 4034 isolate->builtins()->OnStackReplacement()->entry(),
4037 Assembler::target_address_at(call_target_address, unoptimized_code)); 4035 Assembler::target_address_at(call_target_address, unoptimized_code));
4038 return ON_STACK_REPLACEMENT; 4036 return ON_STACK_REPLACEMENT;
4039 } 4037 }
4040 4038
4041 4039
4042 } // namespace internal 4040 } // namespace internal
4043 } // namespace v8 4041 } // namespace v8
4044 4042
4045 #endif // V8_TARGET_ARCH_X87 4043 #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