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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3368 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3368 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
3369 ZoneList<Expression*>* args = expr->arguments(); | 3369 ZoneList<Expression*>* args = expr->arguments(); |
3370 int arg_count = args->length(); | 3370 int arg_count = args->length(); |
3371 | 3371 |
3372 SetCallPosition(expr); | 3372 SetCallPosition(expr); |
3373 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3373 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3374 __ mov(r0, Operand(arg_count)); | 3374 __ mov(r0, Operand(arg_count)); |
3375 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3375 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
3376 RelocInfo::CODE_TARGET); | 3376 RelocInfo::CODE_TARGET); |
3377 OperandStackDepthDecrement(arg_count + 1); | 3377 OperandStackDepthDecrement(arg_count + 1); |
| 3378 |
| 3379 // Restore context register. |
| 3380 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3378 } | 3381 } |
3379 | 3382 |
3380 | 3383 |
3381 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
3382 ZoneList<Expression*>* args = expr->arguments(); | |
3383 int arg_count = args->length(); | |
3384 | |
3385 if (expr->is_jsruntime()) { | |
3386 Comment cmnt(masm_, "[ CallRuntime"); | |
3387 EmitLoadJSRuntimeFunction(expr); | |
3388 | |
3389 // Push the arguments ("left-to-right"). | |
3390 for (int i = 0; i < arg_count; i++) { | |
3391 VisitForStackValue(args->at(i)); | |
3392 } | |
3393 | |
3394 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3395 EmitCallJSRuntimeFunction(expr); | |
3396 | |
3397 // Restore context register. | |
3398 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3399 | |
3400 context()->DropAndPlug(1, r0); | |
3401 | |
3402 } else { | |
3403 const Runtime::Function* function = expr->function(); | |
3404 switch (function->function_id) { | |
3405 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
3406 case Runtime::kInline##Name: { \ | |
3407 Comment cmnt(masm_, "[ Inline" #Name); \ | |
3408 return Emit##Name(expr); \ | |
3409 } | |
3410 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
3411 #undef CALL_INTRINSIC_GENERATOR | |
3412 default: { | |
3413 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
3414 // Push the arguments ("left-to-right"). | |
3415 for (int i = 0; i < arg_count; i++) { | |
3416 VisitForStackValue(args->at(i)); | |
3417 } | |
3418 | |
3419 // Call the C runtime function. | |
3420 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3421 __ CallRuntime(expr->function(), arg_count); | |
3422 OperandStackDepthDecrement(arg_count); | |
3423 context()->Plug(r0); | |
3424 } | |
3425 } | |
3426 } | |
3427 } | |
3428 | |
3429 | |
3430 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3384 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
3431 switch (expr->op()) { | 3385 switch (expr->op()) { |
3432 case Token::DELETE: { | 3386 case Token::DELETE: { |
3433 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3387 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
3434 Property* property = expr->expression()->AsProperty(); | 3388 Property* property = expr->expression()->AsProperty(); |
3435 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3389 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
3436 | 3390 |
3437 if (property != NULL) { | 3391 if (property != NULL) { |
3438 VisitForStackValue(property->obj()); | 3392 VisitForStackValue(property->obj()); |
3439 VisitForStackValue(property->key()); | 3393 VisitForStackValue(property->key()); |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4215 DCHECK(interrupt_address == | 4169 DCHECK(interrupt_address == |
4216 isolate->builtins()->OnStackReplacement()->entry()); | 4170 isolate->builtins()->OnStackReplacement()->entry()); |
4217 return ON_STACK_REPLACEMENT; | 4171 return ON_STACK_REPLACEMENT; |
4218 } | 4172 } |
4219 | 4173 |
4220 | 4174 |
4221 } // namespace internal | 4175 } // namespace internal |
4222 } // namespace v8 | 4176 } // namespace v8 |
4223 | 4177 |
4224 #endif // V8_TARGET_ARCH_ARM | 4178 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |