OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3363 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3363 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
3364 ZoneList<Expression*>* args = expr->arguments(); | 3364 ZoneList<Expression*>* args = expr->arguments(); |
3365 int arg_count = args->length(); | 3365 int arg_count = args->length(); |
3366 | 3366 |
3367 SetCallPosition(expr); | 3367 SetCallPosition(expr); |
3368 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); | 3368 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); |
3369 __ mov(r3, Operand(arg_count)); | 3369 __ mov(r3, Operand(arg_count)); |
3370 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3370 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
3371 RelocInfo::CODE_TARGET); | 3371 RelocInfo::CODE_TARGET); |
3372 OperandStackDepthDecrement(arg_count + 1); | 3372 OperandStackDepthDecrement(arg_count + 1); |
| 3373 |
| 3374 // Restore context register. |
| 3375 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3373 } | 3376 } |
3374 | 3377 |
3375 | 3378 |
3376 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
3377 ZoneList<Expression*>* args = expr->arguments(); | |
3378 int arg_count = args->length(); | |
3379 | |
3380 if (expr->is_jsruntime()) { | |
3381 Comment cmnt(masm_, "[ CallRuntime"); | |
3382 EmitLoadJSRuntimeFunction(expr); | |
3383 | |
3384 // Push the arguments ("left-to-right"). | |
3385 for (int i = 0; i < arg_count; i++) { | |
3386 VisitForStackValue(args->at(i)); | |
3387 } | |
3388 | |
3389 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3390 EmitCallJSRuntimeFunction(expr); | |
3391 | |
3392 // Restore context register. | |
3393 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3394 | |
3395 context()->DropAndPlug(1, r3); | |
3396 | |
3397 } else { | |
3398 const Runtime::Function* function = expr->function(); | |
3399 switch (function->function_id) { | |
3400 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
3401 case Runtime::kInline##Name: { \ | |
3402 Comment cmnt(masm_, "[ Inline" #Name); \ | |
3403 return Emit##Name(expr); \ | |
3404 } | |
3405 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
3406 #undef CALL_INTRINSIC_GENERATOR | |
3407 default: { | |
3408 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
3409 // Push the arguments ("left-to-right"). | |
3410 for (int i = 0; i < arg_count; i++) { | |
3411 VisitForStackValue(args->at(i)); | |
3412 } | |
3413 | |
3414 // Call the C runtime function. | |
3415 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3416 __ CallRuntime(expr->function(), arg_count); | |
3417 OperandStackDepthDecrement(arg_count); | |
3418 context()->Plug(r3); | |
3419 } | |
3420 } | |
3421 } | |
3422 } | |
3423 | |
3424 | |
3425 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3379 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
3426 switch (expr->op()) { | 3380 switch (expr->op()) { |
3427 case Token::DELETE: { | 3381 case Token::DELETE: { |
3428 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3382 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
3429 Property* property = expr->expression()->AsProperty(); | 3383 Property* property = expr->expression()->AsProperty(); |
3430 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3384 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
3431 | 3385 |
3432 if (property != NULL) { | 3386 if (property != NULL) { |
3433 VisitForStackValue(property->obj()); | 3387 VisitForStackValue(property->obj()); |
3434 VisitForStackValue(property->key()); | 3388 VisitForStackValue(property->key()); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4134 | 4088 |
4135 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 4089 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
4136 | 4090 |
4137 DCHECK(interrupt_address == | 4091 DCHECK(interrupt_address == |
4138 isolate->builtins()->OnStackReplacement()->entry()); | 4092 isolate->builtins()->OnStackReplacement()->entry()); |
4139 return ON_STACK_REPLACEMENT; | 4093 return ON_STACK_REPLACEMENT; |
4140 } | 4094 } |
4141 } // namespace internal | 4095 } // namespace internal |
4142 } // namespace v8 | 4096 } // namespace v8 |
4143 #endif // V8_TARGET_ARCH_PPC | 4097 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |