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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); | 2108 __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); |
2109 __ li(LoadDescriptor::SlotRegister(), | 2109 __ li(LoadDescriptor::SlotRegister(), |
2110 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2110 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2111 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2111 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2112 CallIC(ic, TypeFeedbackId::None()); | 2112 CallIC(ic, TypeFeedbackId::None()); |
2113 __ mov(a0, v0); | 2113 __ mov(a0, v0); |
2114 __ mov(a1, a0); | 2114 __ mov(a1, a0); |
2115 __ sd(a1, MemOperand(sp, 2 * kPointerSize)); | 2115 __ sd(a1, MemOperand(sp, 2 * kPointerSize)); |
2116 SetCallPosition(expr, 1); | 2116 SetCallPosition(expr, 1); |
2117 __ li(a0, Operand(1)); | 2117 __ li(a0, Operand(1)); |
2118 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2118 __ Call( |
| 2119 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), |
| 2120 RelocInfo::CODE_TARGET); |
2119 | 2121 |
2120 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2122 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2121 __ Drop(1); // The function is still on the stack; drop it. | 2123 __ Drop(1); // The function is still on the stack; drop it. |
2122 | 2124 |
2123 // if (!result.done) goto l_try; | 2125 // if (!result.done) goto l_try; |
2124 __ Move(load_receiver, v0); | 2126 __ Move(load_receiver, v0); |
2125 | 2127 |
2126 __ push(load_receiver); // save result | 2128 __ push(load_receiver); // save result |
2127 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2129 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
2128 __ li(LoadDescriptor::SlotRegister(), | 2130 __ li(LoadDescriptor::SlotRegister(), |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 ic_total_count_++; | 2803 ic_total_count_++; |
2802 __ Call(code, RelocInfo::CODE_TARGET, id); | 2804 __ Call(code, RelocInfo::CODE_TARGET, id); |
2803 } | 2805 } |
2804 | 2806 |
2805 | 2807 |
2806 // Code common for calls using the IC. | 2808 // Code common for calls using the IC. |
2807 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2809 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
2808 Expression* callee = expr->expression(); | 2810 Expression* callee = expr->expression(); |
2809 | 2811 |
2810 // Get the target function. | 2812 // Get the target function. |
| 2813 ConvertReceiverMode convert_mode; |
2811 if (callee->IsVariableProxy()) { | 2814 if (callee->IsVariableProxy()) { |
2812 { StackValueContext context(this); | 2815 { StackValueContext context(this); |
2813 EmitVariableLoad(callee->AsVariableProxy()); | 2816 EmitVariableLoad(callee->AsVariableProxy()); |
2814 PrepareForBailout(callee, NO_REGISTERS); | 2817 PrepareForBailout(callee, NO_REGISTERS); |
2815 } | 2818 } |
2816 // Push undefined as receiver. This is patched in the method prologue if it | 2819 // Push undefined as receiver. This is patched in the method prologue if it |
2817 // is a sloppy mode method. | 2820 // is a sloppy mode method. |
2818 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 2821 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
2819 __ push(at); | 2822 __ push(at); |
| 2823 convert_mode = ConvertReceiverMode::kNullOrUndefined; |
2820 } else { | 2824 } else { |
2821 // Load the function from the receiver. | 2825 // Load the function from the receiver. |
2822 DCHECK(callee->IsProperty()); | 2826 DCHECK(callee->IsProperty()); |
2823 DCHECK(!callee->AsProperty()->IsSuperAccess()); | 2827 DCHECK(!callee->AsProperty()->IsSuperAccess()); |
2824 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2828 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2825 EmitNamedPropertyLoad(callee->AsProperty()); | 2829 EmitNamedPropertyLoad(callee->AsProperty()); |
2826 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2830 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2827 // Push the target function under the receiver. | 2831 // Push the target function under the receiver. |
2828 __ ld(at, MemOperand(sp, 0)); | 2832 __ ld(at, MemOperand(sp, 0)); |
2829 __ push(at); | 2833 __ push(at); |
2830 __ sd(v0, MemOperand(sp, kPointerSize)); | 2834 __ sd(v0, MemOperand(sp, kPointerSize)); |
| 2835 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; |
2831 } | 2836 } |
2832 | 2837 |
2833 EmitCall(expr); | 2838 EmitCall(expr, convert_mode); |
2834 } | 2839 } |
2835 | 2840 |
2836 | 2841 |
2837 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | 2842 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
2838 SetExpressionPosition(expr); | 2843 SetExpressionPosition(expr); |
2839 Expression* callee = expr->expression(); | 2844 Expression* callee = expr->expression(); |
2840 DCHECK(callee->IsProperty()); | 2845 DCHECK(callee->IsProperty()); |
2841 Property* prop = callee->AsProperty(); | 2846 Property* prop = callee->AsProperty(); |
2842 DCHECK(prop->IsSuperAccess()); | 2847 DCHECK(prop->IsSuperAccess()); |
2843 | 2848 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2890 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2886 __ Move(LoadDescriptor::NameRegister(), v0); | 2891 __ Move(LoadDescriptor::NameRegister(), v0); |
2887 EmitKeyedPropertyLoad(callee->AsProperty()); | 2892 EmitKeyedPropertyLoad(callee->AsProperty()); |
2888 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2893 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2889 | 2894 |
2890 // Push the target function under the receiver. | 2895 // Push the target function under the receiver. |
2891 __ ld(at, MemOperand(sp, 0)); | 2896 __ ld(at, MemOperand(sp, 0)); |
2892 __ push(at); | 2897 __ push(at); |
2893 __ sd(v0, MemOperand(sp, kPointerSize)); | 2898 __ sd(v0, MemOperand(sp, kPointerSize)); |
2894 | 2899 |
2895 EmitCall(expr); | 2900 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); |
2896 } | 2901 } |
2897 | 2902 |
2898 | 2903 |
2899 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2904 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
2900 Expression* callee = expr->expression(); | 2905 Expression* callee = expr->expression(); |
2901 DCHECK(callee->IsProperty()); | 2906 DCHECK(callee->IsProperty()); |
2902 Property* prop = callee->AsProperty(); | 2907 Property* prop = callee->AsProperty(); |
2903 DCHECK(prop->IsSuperAccess()); | 2908 DCHECK(prop->IsSuperAccess()); |
2904 | 2909 |
2905 SetExpressionPosition(prop); | 2910 SetExpressionPosition(prop); |
(...skipping 19 matching lines...) Expand all Loading... |
2925 // Replace home_object with target function. | 2930 // Replace home_object with target function. |
2926 __ sd(v0, MemOperand(sp, kPointerSize)); | 2931 __ sd(v0, MemOperand(sp, kPointerSize)); |
2927 | 2932 |
2928 // Stack here: | 2933 // Stack here: |
2929 // - target function | 2934 // - target function |
2930 // - this (receiver) | 2935 // - this (receiver) |
2931 EmitCall(expr); | 2936 EmitCall(expr); |
2932 } | 2937 } |
2933 | 2938 |
2934 | 2939 |
2935 void FullCodeGenerator::EmitCall(Call* expr) { | 2940 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
2936 // Load the arguments. | 2941 // Load the arguments. |
2937 ZoneList<Expression*>* args = expr->arguments(); | 2942 ZoneList<Expression*>* args = expr->arguments(); |
2938 int arg_count = args->length(); | 2943 int arg_count = args->length(); |
2939 for (int i = 0; i < arg_count; i++) { | 2944 for (int i = 0; i < arg_count; i++) { |
2940 VisitForStackValue(args->at(i)); | 2945 VisitForStackValue(args->at(i)); |
2941 } | 2946 } |
2942 | 2947 |
2943 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2948 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2944 // Record source position of the IC call. | 2949 // Record source position of the IC call. |
2945 SetCallPosition(expr, arg_count); | 2950 SetCallPosition(expr, arg_count); |
2946 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code(); | 2951 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); |
2947 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2952 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
2948 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2953 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2949 // Don't assign a type feedback id to the IC, since type feedback is provided | 2954 // Don't assign a type feedback id to the IC, since type feedback is provided |
2950 // by the vector above. | 2955 // by the vector above. |
2951 CallIC(ic); | 2956 CallIC(ic); |
2952 RecordJSReturnSite(expr); | 2957 RecordJSReturnSite(expr); |
2953 // Restore context register. | 2958 // Restore context register. |
2954 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2959 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2955 context()->DropAndPlug(1, v0); | 2960 context()->DropAndPlug(1, v0); |
2956 } | 2961 } |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 } | 4247 } |
4243 | 4248 |
4244 | 4249 |
4245 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4250 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4246 ZoneList<Expression*>* args = expr->arguments(); | 4251 ZoneList<Expression*>* args = expr->arguments(); |
4247 int arg_count = args->length(); | 4252 int arg_count = args->length(); |
4248 | 4253 |
4249 SetCallPosition(expr, arg_count); | 4254 SetCallPosition(expr, arg_count); |
4250 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4255 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4251 __ li(a0, Operand(arg_count)); | 4256 __ li(a0, Operand(arg_count)); |
4252 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 4257 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
| 4258 RelocInfo::CODE_TARGET); |
4253 } | 4259 } |
4254 | 4260 |
4255 | 4261 |
4256 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4262 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4257 ZoneList<Expression*>* args = expr->arguments(); | 4263 ZoneList<Expression*>* args = expr->arguments(); |
4258 int arg_count = args->length(); | 4264 int arg_count = args->length(); |
4259 | 4265 |
4260 if (expr->is_jsruntime()) { | 4266 if (expr->is_jsruntime()) { |
4261 Comment cmnt(masm_, "[ CallRuntime"); | 4267 Comment cmnt(masm_, "[ CallRuntime"); |
4262 EmitLoadJSRuntimeFunction(expr); | 4268 EmitLoadJSRuntimeFunction(expr); |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5057 reinterpret_cast<uint64_t>( | 5063 reinterpret_cast<uint64_t>( |
5058 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5064 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5059 return OSR_AFTER_STACK_CHECK; | 5065 return OSR_AFTER_STACK_CHECK; |
5060 } | 5066 } |
5061 | 5067 |
5062 | 5068 |
5063 } // namespace internal | 5069 } // namespace internal |
5064 } // namespace v8 | 5070 } // namespace v8 |
5065 | 5071 |
5066 #endif // V8_TARGET_ARCH_MIPS64 | 5072 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |