| 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_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 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3247 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 3248 ZoneList<Expression*>* args = expr->arguments(); | 3248 ZoneList<Expression*>* args = expr->arguments(); |
| 3249 int arg_count = args->length(); | 3249 int arg_count = args->length(); |
| 3250 | 3250 |
| 3251 SetCallPosition(expr); | 3251 SetCallPosition(expr); |
| 3252 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 3252 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 3253 __ Set(eax, arg_count); | 3253 __ Set(eax, arg_count); |
| 3254 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3254 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
| 3255 RelocInfo::CODE_TARGET); | 3255 RelocInfo::CODE_TARGET); |
| 3256 OperandStackDepthDecrement(arg_count + 1); | 3256 OperandStackDepthDecrement(arg_count + 1); |
| 3257 |
| 3258 // Restore context register. |
| 3259 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3257 } | 3260 } |
| 3258 | 3261 |
| 3259 | 3262 |
| 3260 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
| 3261 ZoneList<Expression*>* args = expr->arguments(); | |
| 3262 int arg_count = args->length(); | |
| 3263 | |
| 3264 if (expr->is_jsruntime()) { | |
| 3265 Comment cmnt(masm_, "[ CallRuntime"); | |
| 3266 EmitLoadJSRuntimeFunction(expr); | |
| 3267 | |
| 3268 // Push the arguments ("left-to-right"). | |
| 3269 for (int i = 0; i < arg_count; i++) { | |
| 3270 VisitForStackValue(args->at(i)); | |
| 3271 } | |
| 3272 | |
| 3273 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
| 3274 EmitCallJSRuntimeFunction(expr); | |
| 3275 | |
| 3276 // Restore context register. | |
| 3277 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 3278 context()->DropAndPlug(1, eax); | |
| 3279 | |
| 3280 } else { | |
| 3281 const Runtime::Function* function = expr->function(); | |
| 3282 switch (function->function_id) { | |
| 3283 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
| 3284 case Runtime::kInline##Name: { \ | |
| 3285 Comment cmnt(masm_, "[ Inline" #Name); \ | |
| 3286 return Emit##Name(expr); \ | |
| 3287 } | |
| 3288 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
| 3289 #undef CALL_INTRINSIC_GENERATOR | |
| 3290 default: { | |
| 3291 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
| 3292 // Push the arguments ("left-to-right"). | |
| 3293 for (int i = 0; i < arg_count; i++) { | |
| 3294 VisitForStackValue(args->at(i)); | |
| 3295 } | |
| 3296 | |
| 3297 // Call the C runtime function. | |
| 3298 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
| 3299 __ CallRuntime(expr->function(), arg_count); | |
| 3300 OperandStackDepthDecrement(arg_count); | |
| 3301 context()->Plug(eax); | |
| 3302 } | |
| 3303 } | |
| 3304 } | |
| 3305 } | |
| 3306 | |
| 3307 | |
| 3308 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3263 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3309 switch (expr->op()) { | 3264 switch (expr->op()) { |
| 3310 case Token::DELETE: { | 3265 case Token::DELETE: { |
| 3311 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3266 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 3312 Property* property = expr->expression()->AsProperty(); | 3267 Property* property = expr->expression()->AsProperty(); |
| 3313 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3268 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 3314 | 3269 |
| 3315 if (property != NULL) { | 3270 if (property != NULL) { |
| 3316 VisitForStackValue(property->obj()); | 3271 VisitForStackValue(property->obj()); |
| 3317 VisitForStackValue(property->key()); | 3272 VisitForStackValue(property->key()); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4034 isolate->builtins()->OnStackReplacement()->entry(), | 3989 isolate->builtins()->OnStackReplacement()->entry(), |
| 4035 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3990 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 4036 return ON_STACK_REPLACEMENT; | 3991 return ON_STACK_REPLACEMENT; |
| 4037 } | 3992 } |
| 4038 | 3993 |
| 4039 | 3994 |
| 4040 } // namespace internal | 3995 } // namespace internal |
| 4041 } // namespace v8 | 3996 } // namespace v8 |
| 4042 | 3997 |
| 4043 #endif // V8_TARGET_ARCH_X87 | 3998 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |