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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3378 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 3378 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
3379 ZoneList<Expression*>* args = expr->arguments(); | 3379 ZoneList<Expression*>* args = expr->arguments(); |
3380 int arg_count = args->length(); | 3380 int arg_count = args->length(); |
3381 | 3381 |
3382 SetCallPosition(expr); | 3382 SetCallPosition(expr); |
3383 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3383 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3384 __ li(a0, Operand(arg_count)); | 3384 __ li(a0, Operand(arg_count)); |
3385 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 3385 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
3386 RelocInfo::CODE_TARGET); | 3386 RelocInfo::CODE_TARGET); |
3387 OperandStackDepthDecrement(arg_count + 1); | 3387 OperandStackDepthDecrement(arg_count + 1); |
| 3388 |
| 3389 // Restore context register. |
| 3390 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3388 } | 3391 } |
3389 | 3392 |
3390 | 3393 |
3391 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | |
3392 ZoneList<Expression*>* args = expr->arguments(); | |
3393 int arg_count = args->length(); | |
3394 | |
3395 if (expr->is_jsruntime()) { | |
3396 Comment cmnt(masm_, "[ CallRuntime"); | |
3397 EmitLoadJSRuntimeFunction(expr); | |
3398 | |
3399 // Push the arguments ("left-to-right"). | |
3400 for (int i = 0; i < arg_count; i++) { | |
3401 VisitForStackValue(args->at(i)); | |
3402 } | |
3403 | |
3404 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3405 EmitCallJSRuntimeFunction(expr); | |
3406 | |
3407 // Restore context register. | |
3408 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3409 | |
3410 context()->DropAndPlug(1, v0); | |
3411 | |
3412 } else { | |
3413 const Runtime::Function* function = expr->function(); | |
3414 switch (function->function_id) { | |
3415 #define CALL_INTRINSIC_GENERATOR(Name) \ | |
3416 case Runtime::kInline##Name: { \ | |
3417 Comment cmnt(masm_, "[ Inline" #Name); \ | |
3418 return Emit##Name(expr); \ | |
3419 } | |
3420 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) | |
3421 #undef CALL_INTRINSIC_GENERATOR | |
3422 default: { | |
3423 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); | |
3424 // Push the arguments ("left-to-right"). | |
3425 for (int i = 0; i < arg_count; i++) { | |
3426 VisitForStackValue(args->at(i)); | |
3427 } | |
3428 | |
3429 // Call the C runtime function. | |
3430 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
3431 __ CallRuntime(expr->function(), arg_count); | |
3432 OperandStackDepthDecrement(arg_count); | |
3433 context()->Plug(v0); | |
3434 } | |
3435 } | |
3436 } | |
3437 } | |
3438 | |
3439 | |
3440 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3394 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
3441 switch (expr->op()) { | 3395 switch (expr->op()) { |
3442 case Token::DELETE: { | 3396 case Token::DELETE: { |
3443 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3397 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
3444 Property* property = expr->expression()->AsProperty(); | 3398 Property* property = expr->expression()->AsProperty(); |
3445 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 3399 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
3446 | 3400 |
3447 if (property != NULL) { | 3401 if (property != NULL) { |
3448 VisitForStackValue(property->obj()); | 3402 VisitForStackValue(property->obj()); |
3449 VisitForStackValue(property->key()); | 3403 VisitForStackValue(property->key()); |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4160 reinterpret_cast<uint32_t>( | 4114 reinterpret_cast<uint32_t>( |
4161 isolate->builtins()->OnStackReplacement()->entry())); | 4115 isolate->builtins()->OnStackReplacement()->entry())); |
4162 return ON_STACK_REPLACEMENT; | 4116 return ON_STACK_REPLACEMENT; |
4163 } | 4117 } |
4164 | 4118 |
4165 | 4119 |
4166 } // namespace internal | 4120 } // namespace internal |
4167 } // namespace v8 | 4121 } // namespace v8 |
4168 | 4122 |
4169 #endif // V8_TARGET_ARCH_MIPS | 4123 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |