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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
11 // The result_register() for mips is the 'v0' register, which is defined | 11 // The result_register() for mips is the 'v0' register, which is defined |
12 // by the ABI to contain function return values. However, the first | 12 // by the ABI to contain function return values. However, the first |
13 // parameter to a function is defined to be 'a0'. So there are many | 13 // parameter to a function is defined to be 'a0'. So there are many |
14 // places where we have to move a previous result in v0 to a0 for the | 14 // places where we have to move a previous result in v0 to a0 for the |
15 // next call: mov(a0, v0). This is not needed on the other architectures. | 15 // next call: mov(a0, v0). This is not needed on the other architectures. |
16 | 16 |
17 #include "src/code-factory.h" | 17 #include "src/code-factory.h" |
18 #include "src/code-stubs.h" | 18 #include "src/code-stubs.h" |
19 #include "src/codegen.h" | 19 #include "src/codegen.h" |
20 #include "src/compiler.h" | 20 #include "src/compiler.h" |
21 #include "src/debug.h" | 21 #include "src/debug.h" |
22 #include "src/full-codegen.h" | 22 #include "src/full-codegen.h" |
| 23 #include "src/ic/ic.h" |
23 #include "src/isolate-inl.h" | 24 #include "src/isolate-inl.h" |
24 #include "src/parser.h" | 25 #include "src/parser.h" |
25 #include "src/scopes.h" | 26 #include "src/scopes.h" |
26 | 27 |
27 #include "src/mips/code-stubs-mips.h" | 28 #include "src/mips/code-stubs-mips.h" |
28 #include "src/mips/macro-assembler-mips.h" | 29 #include "src/mips/macro-assembler-mips.h" |
29 | 30 |
30 namespace v8 { | 31 namespace v8 { |
31 namespace internal { | 32 namespace internal { |
32 | 33 |
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 TypeFeedbackId id) { | 2605 TypeFeedbackId id) { |
2605 ic_total_count_++; | 2606 ic_total_count_++; |
2606 __ Call(code, RelocInfo::CODE_TARGET, id); | 2607 __ Call(code, RelocInfo::CODE_TARGET, id); |
2607 } | 2608 } |
2608 | 2609 |
2609 | 2610 |
2610 // Code common for calls using the IC. | 2611 // Code common for calls using the IC. |
2611 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2612 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
2612 Expression* callee = expr->expression(); | 2613 Expression* callee = expr->expression(); |
2613 | 2614 |
2614 CallIC::CallType call_type = callee->IsVariableProxy() | 2615 CallICState::CallType call_type = |
2615 ? CallIC::FUNCTION | 2616 callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD; |
2616 : CallIC::METHOD; | |
2617 | 2617 |
2618 // Get the target function. | 2618 // Get the target function. |
2619 if (call_type == CallIC::FUNCTION) { | 2619 if (call_type == CallICState::FUNCTION) { |
2620 { StackValueContext context(this); | 2620 { StackValueContext context(this); |
2621 EmitVariableLoad(callee->AsVariableProxy()); | 2621 EmitVariableLoad(callee->AsVariableProxy()); |
2622 PrepareForBailout(callee, NO_REGISTERS); | 2622 PrepareForBailout(callee, NO_REGISTERS); |
2623 } | 2623 } |
2624 // Push undefined as receiver. This is patched in the method prologue if it | 2624 // Push undefined as receiver. This is patched in the method prologue if it |
2625 // is a sloppy mode method. | 2625 // is a sloppy mode method. |
2626 __ Push(isolate()->factory()->undefined_value()); | 2626 __ Push(isolate()->factory()->undefined_value()); |
2627 } else { | 2627 } else { |
2628 // Load the function from the receiver. | 2628 // Load the function from the receiver. |
2629 DCHECK(callee->IsProperty()); | 2629 DCHECK(callee->IsProperty()); |
(...skipping 23 matching lines...) Expand all Loading... |
2653 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2653 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2654 __ Move(LoadDescriptor::NameRegister(), v0); | 2654 __ Move(LoadDescriptor::NameRegister(), v0); |
2655 EmitKeyedPropertyLoad(callee->AsProperty()); | 2655 EmitKeyedPropertyLoad(callee->AsProperty()); |
2656 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2656 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2657 | 2657 |
2658 // Push the target function under the receiver. | 2658 // Push the target function under the receiver. |
2659 __ lw(at, MemOperand(sp, 0)); | 2659 __ lw(at, MemOperand(sp, 0)); |
2660 __ push(at); | 2660 __ push(at); |
2661 __ sw(v0, MemOperand(sp, kPointerSize)); | 2661 __ sw(v0, MemOperand(sp, kPointerSize)); |
2662 | 2662 |
2663 EmitCall(expr, CallIC::METHOD); | 2663 EmitCall(expr, CallICState::METHOD); |
2664 } | 2664 } |
2665 | 2665 |
2666 | 2666 |
2667 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { | 2667 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2668 // Load the arguments. | 2668 // Load the arguments. |
2669 ZoneList<Expression*>* args = expr->arguments(); | 2669 ZoneList<Expression*>* args = expr->arguments(); |
2670 int arg_count = args->length(); | 2670 int arg_count = args->length(); |
2671 { PreservePositionScope scope(masm()->positions_recorder()); | 2671 { PreservePositionScope scope(masm()->positions_recorder()); |
2672 for (int i = 0; i < arg_count; i++) { | 2672 for (int i = 0; i < arg_count; i++) { |
2673 VisitForStackValue(args->at(i)); | 2673 VisitForStackValue(args->at(i)); |
2674 } | 2674 } |
2675 } | 2675 } |
2676 | 2676 |
2677 // Record source position of the IC call. | 2677 // Record source position of the IC call. |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4872 Assembler::target_address_at(pc_immediate_load_address)) == | 4872 Assembler::target_address_at(pc_immediate_load_address)) == |
4873 reinterpret_cast<uint32_t>( | 4873 reinterpret_cast<uint32_t>( |
4874 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4874 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4875 return OSR_AFTER_STACK_CHECK; | 4875 return OSR_AFTER_STACK_CHECK; |
4876 } | 4876 } |
4877 | 4877 |
4878 | 4878 |
4879 } } // namespace v8::internal | 4879 } } // namespace v8::internal |
4880 | 4880 |
4881 #endif // V8_TARGET_ARCH_MIPS | 4881 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |