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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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
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/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 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 3236
3237 __ bind(&runtime); 3237 __ bind(&runtime);
3238 CallRuntimeWithOperands(Runtime::kCreateIterResultObject); 3238 CallRuntimeWithOperands(Runtime::kCreateIterResultObject);
3239 3239
3240 __ bind(&done); 3240 __ bind(&done);
3241 context()->Plug(eax); 3241 context()->Plug(eax);
3242 } 3242 }
3243 3243
3244 3244
3245 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 3245 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
3246 // Push function.
3247 __ LoadGlobalFunction(expr->context_index(), eax);
3248 PushOperand(eax);
3249
3246 // Push undefined as receiver. 3250 // Push undefined as receiver.
3247 PushOperand(isolate()->factory()->undefined_value()); 3251 PushOperand(isolate()->factory()->undefined_value());
3248
3249 __ LoadGlobalFunction(expr->context_index(), eax);
3250 } 3252 }
3251 3253
3252 3254
3253 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 3255 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
3254 ZoneList<Expression*>* args = expr->arguments(); 3256 ZoneList<Expression*>* args = expr->arguments();
3255 int arg_count = args->length(); 3257 int arg_count = args->length();
3256 3258
3257 SetCallPosition(expr); 3259 SetCallPosition(expr);
3258 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 3260 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
3259 __ Set(eax, arg_count); 3261 __ Set(eax, arg_count);
3260 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), 3262 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
3261 RelocInfo::CODE_TARGET); 3263 RelocInfo::CODE_TARGET);
3262 OperandStackDepthDecrement(arg_count + 1); 3264 OperandStackDepthDecrement(arg_count + 1);
3263 } 3265 }
3264 3266
3265 3267
3266 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 3268 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
3267 ZoneList<Expression*>* args = expr->arguments(); 3269 ZoneList<Expression*>* args = expr->arguments();
3268 int arg_count = args->length(); 3270 int arg_count = args->length();
3269 3271
3270 if (expr->is_jsruntime()) { 3272 if (expr->is_jsruntime()) {
3271 Comment cmnt(masm_, "[ CallRuntime"); 3273 Comment cmnt(masm_, "[ CallRuntime");
3272 EmitLoadJSRuntimeFunction(expr); 3274 EmitLoadJSRuntimeFunction(expr);
3273 3275
3274 // Push the target function under the receiver.
3275 PushOperand(Operand(esp, 0));
3276 __ mov(Operand(esp, kPointerSize), eax);
3277
3278 // Push the arguments ("left-to-right"). 3276 // Push the arguments ("left-to-right").
3279 for (int i = 0; i < arg_count; i++) { 3277 for (int i = 0; i < arg_count; i++) {
3280 VisitForStackValue(args->at(i)); 3278 VisitForStackValue(args->at(i));
3281 } 3279 }
3282 3280
3283 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 3281 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3284 EmitCallJSRuntimeFunction(expr); 3282 EmitCallJSRuntimeFunction(expr);
3285 3283
3286 // Restore context register. 3284 // Restore context register.
3287 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3285 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
4044 isolate->builtins()->OnStackReplacement()->entry(), 4042 isolate->builtins()->OnStackReplacement()->entry(),
4045 Assembler::target_address_at(call_target_address, unoptimized_code)); 4043 Assembler::target_address_at(call_target_address, unoptimized_code));
4046 return ON_STACK_REPLACEMENT; 4044 return ON_STACK_REPLACEMENT;
4047 } 4045 }
4048 4046
4049 4047
4050 } // namespace internal 4048 } // namespace internal
4051 } // namespace v8 4049 } // namespace v8
4052 4050
4053 #endif // V8_TARGET_ARCH_IA32 4051 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.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