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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 if (FLAG_vector_ics) { | 2375 if (FLAG_vector_ics) { |
2376 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2376 __ mov(VectorLoadICDescriptor::SlotRegister(), |
2377 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2377 Operand(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
2378 CallIC(ic); | 2378 CallIC(ic); |
2379 } else { | 2379 } else { |
2380 CallIC(ic, prop->PropertyFeedbackId()); | 2380 CallIC(ic, prop->PropertyFeedbackId()); |
2381 } | 2381 } |
2382 } | 2382 } |
2383 | 2383 |
2384 | 2384 |
| 2385 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2386 // Stack: receiver, home_object, key. |
| 2387 SetSourcePosition(prop->position()); |
| 2388 |
| 2389 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2390 } |
| 2391 |
| 2392 |
2385 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2393 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2386 Token::Value op, | 2394 Token::Value op, |
2387 OverwriteMode mode, | 2395 OverwriteMode mode, |
2388 Expression* left_expr, | 2396 Expression* left_expr, |
2389 Expression* right_expr) { | 2397 Expression* right_expr) { |
2390 Label done, smi_case, stub_call; | 2398 Label done, smi_case, stub_call; |
2391 | 2399 |
2392 Register scratch1 = r2; | 2400 Register scratch1 = r2; |
2393 Register scratch2 = r3; | 2401 Register scratch2 = r3; |
2394 | 2402 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 EmitNamedPropertyLoad(expr); | 2686 EmitNamedPropertyLoad(expr); |
2679 } else { | 2687 } else { |
2680 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2688 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
2681 EmitLoadHomeObject(expr->obj()->AsSuperReference()); | 2689 EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
2682 __ Push(result_register()); | 2690 __ Push(result_register()); |
2683 EmitNamedSuperPropertyLoad(expr); | 2691 EmitNamedSuperPropertyLoad(expr); |
2684 } | 2692 } |
2685 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2693 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2686 context()->Plug(r0); | 2694 context()->Plug(r0); |
2687 } else { | 2695 } else { |
2688 VisitForStackValue(expr->obj()); | 2696 if (!expr->IsSuperAccess()) { |
2689 VisitForAccumulatorValue(expr->key()); | 2697 VisitForStackValue(expr->obj()); |
2690 __ Move(LoadDescriptor::NameRegister(), r0); | 2698 VisitForAccumulatorValue(expr->key()); |
2691 __ pop(LoadDescriptor::ReceiverRegister()); | 2699 __ Move(LoadDescriptor::NameRegister(), r0); |
2692 EmitKeyedPropertyLoad(expr); | 2700 __ pop(LoadDescriptor::ReceiverRegister()); |
| 2701 EmitKeyedPropertyLoad(expr); |
| 2702 } else { |
| 2703 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
| 2704 EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
| 2705 __ Push(result_register()); |
| 2706 VisitForStackValue(expr->key()); |
| 2707 EmitKeyedSuperPropertyLoad(expr); |
| 2708 } |
2693 context()->Plug(r0); | 2709 context()->Plug(r0); |
2694 } | 2710 } |
2695 } | 2711 } |
2696 | 2712 |
2697 | 2713 |
2698 void FullCodeGenerator::CallIC(Handle<Code> code, | 2714 void FullCodeGenerator::CallIC(Handle<Code> code, |
2699 TypeFeedbackId ast_id) { | 2715 TypeFeedbackId ast_id) { |
2700 ic_total_count_++; | 2716 ic_total_count_++; |
2701 // All calls must have a predictable size in full-codegen code to ensure that | 2717 // All calls must have a predictable size in full-codegen code to ensure that |
2702 // the debugger can patch them correctly. | 2718 // the debugger can patch them correctly. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 | 2810 |
2795 // Push the target function under the receiver. | 2811 // Push the target function under the receiver. |
2796 __ ldr(ip, MemOperand(sp, 0)); | 2812 __ ldr(ip, MemOperand(sp, 0)); |
2797 __ push(ip); | 2813 __ push(ip); |
2798 __ str(r0, MemOperand(sp, kPointerSize)); | 2814 __ str(r0, MemOperand(sp, kPointerSize)); |
2799 | 2815 |
2800 EmitCall(expr, CallICState::METHOD); | 2816 EmitCall(expr, CallICState::METHOD); |
2801 } | 2817 } |
2802 | 2818 |
2803 | 2819 |
| 2820 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| 2821 Expression* callee = expr->expression(); |
| 2822 DCHECK(callee->IsProperty()); |
| 2823 Property* prop = callee->AsProperty(); |
| 2824 DCHECK(prop->IsSuperAccess()); |
| 2825 |
| 2826 SetSourcePosition(prop->position()); |
| 2827 // Load the function from the receiver. |
| 2828 const Register scratch = r1; |
| 2829 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
| 2830 EmitLoadHomeObject(super_ref); |
| 2831 __ Push(r0); |
| 2832 VisitForAccumulatorValue(super_ref->this_var()); |
| 2833 __ Push(r0); |
| 2834 __ Push(r0); |
| 2835 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
| 2836 __ Push(scratch); |
| 2837 VisitForStackValue(prop->key()); |
| 2838 |
| 2839 // Stack here: |
| 2840 // - home_object |
| 2841 // - this (receiver) |
| 2842 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2843 // - home_object |
| 2844 // - key |
| 2845 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2846 |
| 2847 // Replace home_object with target function. |
| 2848 __ str(r0, MemOperand(sp, kPointerSize)); |
| 2849 |
| 2850 // Stack here: |
| 2851 // - target function |
| 2852 // - this (receiver) |
| 2853 EmitCall(expr, CallICState::METHOD); |
| 2854 } |
| 2855 |
| 2856 |
2804 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2857 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2805 // Load the arguments. | 2858 // Load the arguments. |
2806 ZoneList<Expression*>* args = expr->arguments(); | 2859 ZoneList<Expression*>* args = expr->arguments(); |
2807 int arg_count = args->length(); | 2860 int arg_count = args->length(); |
2808 { PreservePositionScope scope(masm()->positions_recorder()); | 2861 { PreservePositionScope scope(masm()->positions_recorder()); |
2809 for (int i = 0; i < arg_count; i++) { | 2862 for (int i = 0; i < arg_count; i++) { |
2810 VisitForStackValue(args->at(i)); | 2863 VisitForStackValue(args->at(i)); |
2811 } | 2864 } |
2812 } | 2865 } |
2813 | 2866 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2943 __ push(r1); | 2996 __ push(r1); |
2944 __ bind(&call); | 2997 __ bind(&call); |
2945 } | 2998 } |
2946 | 2999 |
2947 // The receiver is either the global receiver or an object found | 3000 // The receiver is either the global receiver or an object found |
2948 // by LoadContextSlot. | 3001 // by LoadContextSlot. |
2949 EmitCall(expr); | 3002 EmitCall(expr); |
2950 } else if (call_type == Call::PROPERTY_CALL) { | 3003 } else if (call_type == Call::PROPERTY_CALL) { |
2951 Property* property = callee->AsProperty(); | 3004 Property* property = callee->AsProperty(); |
2952 bool is_named_call = property->key()->IsPropertyName(); | 3005 bool is_named_call = property->key()->IsPropertyName(); |
2953 // super.x() is handled in EmitCallWithLoadIC. | 3006 if (property->IsSuperAccess()) { |
2954 if (property->IsSuperAccess() && is_named_call) { | 3007 if (is_named_call) { |
2955 EmitSuperCallWithLoadIC(expr); | 3008 EmitSuperCallWithLoadIC(expr); |
| 3009 } else { |
| 3010 EmitKeyedSuperCallWithLoadIC(expr); |
| 3011 } |
2956 } else { | 3012 } else { |
2957 { | 3013 { |
2958 PreservePositionScope scope(masm()->positions_recorder()); | 3014 PreservePositionScope scope(masm()->positions_recorder()); |
2959 VisitForStackValue(property->obj()); | 3015 VisitForStackValue(property->obj()); |
2960 } | 3016 } |
2961 if (is_named_call) { | 3017 if (is_named_call) { |
2962 EmitCallWithLoadIC(expr); | 3018 EmitCallWithLoadIC(expr); |
2963 } else { | 3019 } else { |
2964 EmitKeyedCallWithLoadIC(expr, property->key()); | 3020 EmitKeyedCallWithLoadIC(expr, property->key()); |
2965 } | 3021 } |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 | 5142 |
5087 DCHECK(interrupt_address == | 5143 DCHECK(interrupt_address == |
5088 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5144 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5089 return OSR_AFTER_STACK_CHECK; | 5145 return OSR_AFTER_STACK_CHECK; |
5090 } | 5146 } |
5091 | 5147 |
5092 | 5148 |
5093 } } // namespace v8::internal | 5149 } } // namespace v8::internal |
5094 | 5150 |
5095 #endif // V8_TARGET_ARCH_ARM | 5151 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |