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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3243 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
3244 ZoneList<Expression*>* args = expr->arguments(); | 3244 ZoneList<Expression*>* args = expr->arguments(); |
3245 int arg_count = args->length(); | 3245 int arg_count = args->length(); |
3246 | 3246 |
3247 SetCallPosition(expr); | 3247 SetCallPosition(expr); |
3248 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 3248 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
3249 __ Set(rax, arg_count); | 3249 __ Set(rax, arg_count); |
3250 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3250 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
3251 RelocInfo::CODE_TARGET); | 3251 RelocInfo::CODE_TARGET); |
3252 OperandStackDepthDecrement(arg_count + 1); | 3252 OperandStackDepthDecrement(arg_count + 1); |
| 3253 |
| 3254 // Restore context register. |
| 3255 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3253 } | 3256 } |
3254 | 3257 |
3255 | 3258 |
3256 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
3257 ZoneList<Expression*>* args = expr->arguments(); | |
3258 int arg_count = args->length(); | |
3259 | |
3260 if (expr->is_jsruntime()) { | |
3261 Comment cmnt(masm_, "[ CallRuntime"); | |
3262 EmitLoadJSRuntimeFunction(expr); | |
3263 | |
3264 // Push the arguments ("left-to-right"). | |
3265 for (int i = 0; i < arg_count; i++) { | |
3266 VisitForStackValue(args->at(i)); | |
3267 } | |
3268 | |
3269 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3270 EmitCallJSRuntimeFunction(expr); | |
3271 | |
3272 // Restore context register. | |
3273 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
3274 context()->DropAndPlug(1, rax); | |
3275 | |
3276 } else { | |
3277 const Runtime::Function* function = expr->function(); | |
3278 switch (function->function_id) { | |
3279 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
3280 case Runtime::kInline##Name: { \ | |
3281 Comment cmnt(masm_, "[ Inline" #Name); \ | |
3282 return Emit##Name(expr); \ | |
3283 } | |
3284 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
3285 #undef CALL_INTRINSIC_GENERATOR | |
3286 default: { | |
3287 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
3288 // Push the arguments ("left-to-right"). | |
3289 for (int i = 0; i < arg_count; i++) { | |
3290 VisitForStackValue(args->at(i)); | |
3291 } | |
3292 | |
3293 // Call the C runtime. | |
3294 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3295 __ CallRuntime(function, arg_count); | |
3296 OperandStackDepthDecrement(arg_count); | |
3297 context()->Plug(rax); | |
3298 } | |
3299 } | |
3300 } | |
3301 } | |
3302 | |
3303 | |
3304 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3259 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
3305 switch (expr->op()) { | 3260 switch (expr->op()) { |
3306 case Token::DELETE: { | 3261 case Token::DELETE: { |
3307 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3262 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
3308 Property* property = expr->expression()->AsProperty(); | 3263 Property* property = expr->expression()->AsProperty(); |
3309 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3264 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
3310 | 3265 |
3311 if (property != NULL) { | 3266 if (property != NULL) { |
3312 VisitForStackValue(property->obj()); | 3267 VisitForStackValue(property->obj()); |
3313 VisitForStackValue(property->key()); | 3268 VisitForStackValue(property->key()); |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 DCHECK_EQ( | 3982 DCHECK_EQ( |
4028 isolate->builtins()->OnStackReplacement()->entry(), | 3983 isolate->builtins()->OnStackReplacement()->entry(), |
4029 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3984 Assembler::target_address_at(call_target_address, unoptimized_code)); |
4030 return ON_STACK_REPLACEMENT; | 3985 return ON_STACK_REPLACEMENT; |
4031 } | 3986 } |
4032 | 3987 |
4033 } // namespace internal | 3988 } // namespace internal |
4034 } // namespace v8 | 3989 } // namespace v8 |
4035 | 3990 |
4036 #endif // V8_TARGET_ARCH_X64 | 3991 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |