| 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 // |
| (...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 if (FLAG_vector_ics) { | 2354 if (FLAG_vector_ics) { |
| 2355 __ li(VectorLoadICDescriptor::SlotRegister(), | 2355 __ li(VectorLoadICDescriptor::SlotRegister(), |
| 2356 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2356 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2357 CallIC(ic); | 2357 CallIC(ic); |
| 2358 } else { | 2358 } else { |
| 2359 CallIC(ic, prop->PropertyFeedbackId()); | 2359 CallIC(ic, prop->PropertyFeedbackId()); |
| 2360 } | 2360 } |
| 2361 } | 2361 } |
| 2362 | 2362 |
| 2363 | 2363 |
| 2364 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2365 // Stack: receiver, home_object, key. |
| 2366 SetSourcePosition(prop->position()); |
| 2367 |
| 2368 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2369 } |
| 2370 |
| 2371 |
| 2364 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2372 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2365 Token::Value op, | 2373 Token::Value op, |
| 2366 OverwriteMode mode, | 2374 OverwriteMode mode, |
| 2367 Expression* left_expr, | 2375 Expression* left_expr, |
| 2368 Expression* right_expr) { | 2376 Expression* right_expr) { |
| 2369 Label done, smi_case, stub_call; | 2377 Label done, smi_case, stub_call; |
| 2370 | 2378 |
| 2371 Register scratch1 = a2; | 2379 Register scratch1 = a2; |
| 2372 Register scratch2 = a3; | 2380 Register scratch2 = a3; |
| 2373 | 2381 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 EmitNamedPropertyLoad(expr); | 2671 EmitNamedPropertyLoad(expr); |
| 2664 } else { | 2672 } else { |
| 2665 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2673 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
| 2666 EmitLoadHomeObject(expr->obj()->AsSuperReference()); | 2674 EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
| 2667 __ Push(result_register()); | 2675 __ Push(result_register()); |
| 2668 EmitNamedSuperPropertyLoad(expr); | 2676 EmitNamedSuperPropertyLoad(expr); |
| 2669 } | 2677 } |
| 2670 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2678 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
| 2671 context()->Plug(v0); | 2679 context()->Plug(v0); |
| 2672 } else { | 2680 } else { |
| 2673 VisitForStackValue(expr->obj()); | 2681 if (!expr->IsSuperAccess()) { |
| 2674 VisitForAccumulatorValue(expr->key()); | 2682 VisitForStackValue(expr->obj()); |
| 2675 __ Move(LoadDescriptor::NameRegister(), v0); | 2683 VisitForAccumulatorValue(expr->key()); |
| 2676 __ pop(LoadDescriptor::ReceiverRegister()); | 2684 __ Move(LoadDescriptor::NameRegister(), v0); |
| 2677 EmitKeyedPropertyLoad(expr); | 2685 __ pop(LoadDescriptor::ReceiverRegister()); |
| 2686 EmitKeyedPropertyLoad(expr); |
| 2687 } else { |
| 2688 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
| 2689 EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
| 2690 __ Push(result_register()); |
| 2691 VisitForStackValue(expr->key()); |
| 2692 EmitKeyedSuperPropertyLoad(expr); |
| 2693 } |
| 2678 context()->Plug(v0); | 2694 context()->Plug(v0); |
| 2679 } | 2695 } |
| 2680 } | 2696 } |
| 2681 | 2697 |
| 2682 | 2698 |
| 2683 void FullCodeGenerator::CallIC(Handle<Code> code, | 2699 void FullCodeGenerator::CallIC(Handle<Code> code, |
| 2684 TypeFeedbackId id) { | 2700 TypeFeedbackId id) { |
| 2685 ic_total_count_++; | 2701 ic_total_count_++; |
| 2686 __ Call(code, RelocInfo::CODE_TARGET, id); | 2702 __ Call(code, RelocInfo::CODE_TARGET, id); |
| 2687 } | 2703 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 | 2789 |
| 2774 // Push the target function under the receiver. | 2790 // Push the target function under the receiver. |
| 2775 __ lw(at, MemOperand(sp, 0)); | 2791 __ lw(at, MemOperand(sp, 0)); |
| 2776 __ push(at); | 2792 __ push(at); |
| 2777 __ sw(v0, MemOperand(sp, kPointerSize)); | 2793 __ sw(v0, MemOperand(sp, kPointerSize)); |
| 2778 | 2794 |
| 2779 EmitCall(expr, CallICState::METHOD); | 2795 EmitCall(expr, CallICState::METHOD); |
| 2780 } | 2796 } |
| 2781 | 2797 |
| 2782 | 2798 |
| 2799 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| 2800 Expression* callee = expr->expression(); |
| 2801 DCHECK(callee->IsProperty()); |
| 2802 Property* prop = callee->AsProperty(); |
| 2803 DCHECK(prop->IsSuperAccess()); |
| 2804 |
| 2805 SetSourcePosition(prop->position()); |
| 2806 // Load the function from the receiver. |
| 2807 const Register scratch = a1; |
| 2808 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
| 2809 EmitLoadHomeObject(super_ref); |
| 2810 __ Move(scratch, v0); |
| 2811 VisitForAccumulatorValue(super_ref->this_var()); |
| 2812 __ Push(scratch, v0, v0, scratch); |
| 2813 VisitForStackValue(prop->key()); |
| 2814 |
| 2815 // Stack here: |
| 2816 // - home_object |
| 2817 // - this (receiver) |
| 2818 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2819 // - home_object |
| 2820 // - key |
| 2821 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2822 |
| 2823 // Replace home_object with target function. |
| 2824 __ sw(v0, MemOperand(sp, kPointerSize)); |
| 2825 |
| 2826 // Stack here: |
| 2827 // - target function |
| 2828 // - this (receiver) |
| 2829 EmitCall(expr, CallICState::METHOD); |
| 2830 } |
| 2831 |
| 2832 |
| 2783 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2833 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 2784 // Load the arguments. | 2834 // Load the arguments. |
| 2785 ZoneList<Expression*>* args = expr->arguments(); | 2835 ZoneList<Expression*>* args = expr->arguments(); |
| 2786 int arg_count = args->length(); | 2836 int arg_count = args->length(); |
| 2787 { PreservePositionScope scope(masm()->positions_recorder()); | 2837 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2788 for (int i = 0; i < arg_count; i++) { | 2838 for (int i = 0; i < arg_count; i++) { |
| 2789 VisitForStackValue(args->at(i)); | 2839 VisitForStackValue(args->at(i)); |
| 2790 } | 2840 } |
| 2791 } | 2841 } |
| 2792 | 2842 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2920 __ push(a1); | 2970 __ push(a1); |
| 2921 __ bind(&call); | 2971 __ bind(&call); |
| 2922 } | 2972 } |
| 2923 | 2973 |
| 2924 // The receiver is either the global receiver or an object found | 2974 // The receiver is either the global receiver or an object found |
| 2925 // by LoadContextSlot. | 2975 // by LoadContextSlot. |
| 2926 EmitCall(expr); | 2976 EmitCall(expr); |
| 2927 } else if (call_type == Call::PROPERTY_CALL) { | 2977 } else if (call_type == Call::PROPERTY_CALL) { |
| 2928 Property* property = callee->AsProperty(); | 2978 Property* property = callee->AsProperty(); |
| 2929 bool is_named_call = property->key()->IsPropertyName(); | 2979 bool is_named_call = property->key()->IsPropertyName(); |
| 2930 // super.x() is handled in EmitCallWithLoadIC. | 2980 if (property->IsSuperAccess()) { |
| 2931 if (property->IsSuperAccess() && is_named_call) { | 2981 if (is_named_call) { |
| 2932 EmitSuperCallWithLoadIC(expr); | 2982 EmitSuperCallWithLoadIC(expr); |
| 2983 } else { |
| 2984 EmitKeyedSuperCallWithLoadIC(expr); |
| 2985 } |
| 2933 } else { | 2986 } else { |
| 2934 { | 2987 { |
| 2935 PreservePositionScope scope(masm()->positions_recorder()); | 2988 PreservePositionScope scope(masm()->positions_recorder()); |
| 2936 VisitForStackValue(property->obj()); | 2989 VisitForStackValue(property->obj()); |
| 2937 } | 2990 } |
| 2938 if (is_named_call) { | 2991 if (is_named_call) { |
| 2939 EmitCallWithLoadIC(expr); | 2992 EmitCallWithLoadIC(expr); |
| 2940 } else { | 2993 } else { |
| 2941 EmitKeyedCallWithLoadIC(expr, property->key()); | 2994 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 2942 } | 2995 } |
| (...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 Assembler::target_address_at(pc_immediate_load_address)) == | 5083 Assembler::target_address_at(pc_immediate_load_address)) == |
| 5031 reinterpret_cast<uint32_t>( | 5084 reinterpret_cast<uint32_t>( |
| 5032 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5085 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5033 return OSR_AFTER_STACK_CHECK; | 5086 return OSR_AFTER_STACK_CHECK; |
| 5034 } | 5087 } |
| 5035 | 5088 |
| 5036 | 5089 |
| 5037 } } // namespace v8::internal | 5090 } } // namespace v8::internal |
| 5038 | 5091 |
| 5039 #endif // V8_TARGET_ARCH_MIPS | 5092 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |