| OLD | NEW |
| 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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3255 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3255 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 3256 ZoneList<Expression*>* args = expr->arguments(); | 3256 ZoneList<Expression*>* args = expr->arguments(); |
| 3257 int arg_count = args->length(); | 3257 int arg_count = args->length(); |
| 3258 | 3258 |
| 3259 SetCallPosition(expr); | 3259 SetCallPosition(expr); |
| 3260 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 3260 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 3261 __ Set(eax, arg_count); | 3261 __ Set(eax, arg_count); |
| 3262 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3262 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
| 3263 RelocInfo::CODE_TARGET); | 3263 RelocInfo::CODE_TARGET); |
| 3264 OperandStackDepthDecrement(arg_count + 1); | 3264 OperandStackDepthDecrement(arg_count + 1); |
| 3265 |
| 3266 // Restore context register. |
| 3267 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3265 } | 3268 } |
| 3266 | 3269 |
| 3267 | 3270 |
| 3268 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
| 3269 ZoneList<Expression*>* args = expr->arguments(); | |
| 3270 int arg_count = args->length(); | |
| 3271 | |
| 3272 if (expr->is_jsruntime()) { | |
| 3273 Comment cmnt(masm_, "[ CallRuntime"); | |
| 3274 EmitLoadJSRuntimeFunction(expr); | |
| 3275 | |
| 3276 // Push the arguments ("left-to-right"). | |
| 3277 for (int i = 0; i < arg_count; i++) { | |
| 3278 VisitForStackValue(args->at(i)); | |
| 3279 } | |
| 3280 | |
| 3281 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
| 3282 EmitCallJSRuntimeFunction(expr); | |
| 3283 | |
| 3284 // Restore context register. | |
| 3285 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 3286 context()->DropAndPlug(1, eax); | |
| 3287 | |
| 3288 } else { | |
| 3289 const Runtime::Function* function = expr->function(); | |
| 3290 switch (function->function_id) { | |
| 3291 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
| 3292 case Runtime::kInline##Name: { \ | |
| 3293 Comment cmnt(masm_, "[ Inline" #Name); \ | |
| 3294 return Emit##Name(expr); \ | |
| 3295 } | |
| 3296 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
| 3297 #undef CALL_INTRINSIC_GENERATOR | |
| 3298 default: { | |
| 3299 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
| 3300 // Push the arguments ("left-to-right"). | |
| 3301 for (int i = 0; i < arg_count; i++) { | |
| 3302 VisitForStackValue(args->at(i)); | |
| 3303 } | |
| 3304 | |
| 3305 // Call the C runtime function. | |
| 3306 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
| 3307 __ CallRuntime(expr->function(), arg_count); | |
| 3308 OperandStackDepthDecrement(arg_count); | |
| 3309 context()->Plug(eax); | |
| 3310 } | |
| 3311 } | |
| 3312 } | |
| 3313 } | |
| 3314 | |
| 3315 | |
| 3316 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3271 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3317 switch (expr->op()) { | 3272 switch (expr->op()) { |
| 3318 case Token::DELETE: { | 3273 case Token::DELETE: { |
| 3319 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3274 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 3320 Property* property = expr->expression()->AsProperty(); | 3275 Property* property = expr->expression()->AsProperty(); |
| 3321 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3276 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 3322 | 3277 |
| 3323 if (property != NULL) { | 3278 if (property != NULL) { |
| 3324 VisitForStackValue(property->obj()); | 3279 VisitForStackValue(property->obj()); |
| 3325 VisitForStackValue(property->key()); | 3280 VisitForStackValue(property->key()); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 isolate->builtins()->OnStackReplacement()->entry(), | 3997 isolate->builtins()->OnStackReplacement()->entry(), |
| 4043 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3998 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 4044 return ON_STACK_REPLACEMENT; | 3999 return ON_STACK_REPLACEMENT; |
| 4045 } | 4000 } |
| 4046 | 4001 |
| 4047 | 4002 |
| 4048 } // namespace internal | 4003 } // namespace internal |
| 4049 } // namespace v8 | 4004 } // namespace v8 |
| 4050 | 4005 |
| 4051 #endif // V8_TARGET_ARCH_IA32 | 4006 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |