Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 1436493002: [builtins] Introduce specialized Call/CallFunction builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); 2110 __ lw(load_name, MemOperand(sp, 2 * kPointerSize));
2111 __ li(LoadDescriptor::SlotRegister(), 2111 __ li(LoadDescriptor::SlotRegister(),
2112 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2112 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2113 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); 2113 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2114 CallIC(ic, TypeFeedbackId::None()); 2114 CallIC(ic, TypeFeedbackId::None());
2115 __ mov(a0, v0); 2115 __ mov(a0, v0);
2116 __ mov(a1, a0); 2116 __ mov(a1, a0);
2117 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); 2117 __ sw(a1, MemOperand(sp, 2 * kPointerSize));
2118 SetCallPosition(expr, 1); 2118 SetCallPosition(expr, 1);
2119 __ li(a0, Operand(1)); 2119 __ li(a0, Operand(1));
2120 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2120 __ Call(
2121 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined),
2122 RelocInfo::CODE_TARGET);
2121 2123
2122 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2124 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2123 __ Drop(1); // The function is still on the stack; drop it. 2125 __ Drop(1); // The function is still on the stack; drop it.
2124 2126
2125 // if (!result.done) goto l_try; 2127 // if (!result.done) goto l_try;
2126 __ Move(load_receiver, v0); 2128 __ Move(load_receiver, v0);
2127 2129
2128 __ push(load_receiver); // save result 2130 __ push(load_receiver); // save result
2129 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2131 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2130 __ li(LoadDescriptor::SlotRegister(), 2132 __ li(LoadDescriptor::SlotRegister(),
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 ic_total_count_++; 2798 ic_total_count_++;
2797 __ Call(code, RelocInfo::CODE_TARGET, id); 2799 __ Call(code, RelocInfo::CODE_TARGET, id);
2798 } 2800 }
2799 2801
2800 2802
2801 // Code common for calls using the IC. 2803 // Code common for calls using the IC.
2802 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2804 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
2803 Expression* callee = expr->expression(); 2805 Expression* callee = expr->expression();
2804 2806
2805 // Get the target function. 2807 // Get the target function.
2808 ConvertReceiverMode convert_mode;
2806 if (callee->IsVariableProxy()) { 2809 if (callee->IsVariableProxy()) {
2807 { StackValueContext context(this); 2810 { StackValueContext context(this);
2808 EmitVariableLoad(callee->AsVariableProxy()); 2811 EmitVariableLoad(callee->AsVariableProxy());
2809 PrepareForBailout(callee, NO_REGISTERS); 2812 PrepareForBailout(callee, NO_REGISTERS);
2810 } 2813 }
2811 // Push undefined as receiver. This is patched in the method prologue if it 2814 // Push undefined as receiver. This is patched in the method prologue if it
2812 // is a sloppy mode method. 2815 // is a sloppy mode method.
2813 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 2816 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
2814 __ push(at); 2817 __ push(at);
2818 convert_mode = ConvertReceiverMode::kNullOrUndefined;
2815 } else { 2819 } else {
2816 // Load the function from the receiver. 2820 // Load the function from the receiver.
2817 DCHECK(callee->IsProperty()); 2821 DCHECK(callee->IsProperty());
2818 DCHECK(!callee->AsProperty()->IsSuperAccess()); 2822 DCHECK(!callee->AsProperty()->IsSuperAccess());
2819 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2823 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2820 EmitNamedPropertyLoad(callee->AsProperty()); 2824 EmitNamedPropertyLoad(callee->AsProperty());
2821 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2825 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2822 // Push the target function under the receiver. 2826 // Push the target function under the receiver.
2823 __ lw(at, MemOperand(sp, 0)); 2827 __ lw(at, MemOperand(sp, 0));
2824 __ push(at); 2828 __ push(at);
2825 __ sw(v0, MemOperand(sp, kPointerSize)); 2829 __ sw(v0, MemOperand(sp, kPointerSize));
2830 convert_mode = ConvertReceiverMode::kNotNullOrUndefined;
2826 } 2831 }
2827 2832
2828 EmitCall(expr); 2833 EmitCall(expr, convert_mode);
2829 } 2834 }
2830 2835
2831 2836
2832 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { 2837 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
2833 SetExpressionPosition(expr); 2838 SetExpressionPosition(expr);
2834 Expression* callee = expr->expression(); 2839 Expression* callee = expr->expression();
2835 DCHECK(callee->IsProperty()); 2840 DCHECK(callee->IsProperty());
2836 Property* prop = callee->AsProperty(); 2841 Property* prop = callee->AsProperty();
2837 DCHECK(prop->IsSuperAccess()); 2842 DCHECK(prop->IsSuperAccess());
2838 2843
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2885 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2881 __ Move(LoadDescriptor::NameRegister(), v0); 2886 __ Move(LoadDescriptor::NameRegister(), v0);
2882 EmitKeyedPropertyLoad(callee->AsProperty()); 2887 EmitKeyedPropertyLoad(callee->AsProperty());
2883 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2888 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2884 2889
2885 // Push the target function under the receiver. 2890 // Push the target function under the receiver.
2886 __ lw(at, MemOperand(sp, 0)); 2891 __ lw(at, MemOperand(sp, 0));
2887 __ push(at); 2892 __ push(at);
2888 __ sw(v0, MemOperand(sp, kPointerSize)); 2893 __ sw(v0, MemOperand(sp, kPointerSize));
2889 2894
2890 EmitCall(expr); 2895 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined);
2891 } 2896 }
2892 2897
2893 2898
2894 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 2899 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2895 Expression* callee = expr->expression(); 2900 Expression* callee = expr->expression();
2896 DCHECK(callee->IsProperty()); 2901 DCHECK(callee->IsProperty());
2897 Property* prop = callee->AsProperty(); 2902 Property* prop = callee->AsProperty();
2898 DCHECK(prop->IsSuperAccess()); 2903 DCHECK(prop->IsSuperAccess());
2899 2904
2900 SetExpressionPosition(prop); 2905 SetExpressionPosition(prop);
(...skipping 19 matching lines...) Expand all
2920 // Replace home_object with target function. 2925 // Replace home_object with target function.
2921 __ sw(v0, MemOperand(sp, kPointerSize)); 2926 __ sw(v0, MemOperand(sp, kPointerSize));
2922 2927
2923 // Stack here: 2928 // Stack here:
2924 // - target function 2929 // - target function
2925 // - this (receiver) 2930 // - this (receiver)
2926 EmitCall(expr); 2931 EmitCall(expr);
2927 } 2932 }
2928 2933
2929 2934
2930 void FullCodeGenerator::EmitCall(Call* expr) { 2935 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
2931 // Load the arguments. 2936 // Load the arguments.
2932 ZoneList<Expression*>* args = expr->arguments(); 2937 ZoneList<Expression*>* args = expr->arguments();
2933 int arg_count = args->length(); 2938 int arg_count = args->length();
2934 for (int i = 0; i < arg_count; i++) { 2939 for (int i = 0; i < arg_count; i++) {
2935 VisitForStackValue(args->at(i)); 2940 VisitForStackValue(args->at(i));
2936 } 2941 }
2937 2942
2938 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 2943 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2939 // Record source position of the IC call. 2944 // Record source position of the IC call.
2940 SetCallPosition(expr, arg_count); 2945 SetCallPosition(expr, arg_count);
2941 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code(); 2946 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code();
2942 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); 2947 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot())));
2943 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2948 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2944 // Don't assign a type feedback id to the IC, since type feedback is provided 2949 // Don't assign a type feedback id to the IC, since type feedback is provided
2945 // by the vector above. 2950 // by the vector above.
2946 CallIC(ic); 2951 CallIC(ic);
2947 2952
2948 RecordJSReturnSite(expr); 2953 RecordJSReturnSite(expr);
2949 // Restore context register. 2954 // Restore context register.
2950 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2955 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2951 context()->DropAndPlug(1, v0); 2956 context()->DropAndPlug(1, v0);
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
4237 } 4242 }
4238 4243
4239 4244
4240 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4245 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4241 ZoneList<Expression*>* args = expr->arguments(); 4246 ZoneList<Expression*>* args = expr->arguments();
4242 int arg_count = args->length(); 4247 int arg_count = args->length();
4243 4248
4244 SetCallPosition(expr, arg_count); 4249 SetCallPosition(expr, arg_count);
4245 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 4250 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4246 __ li(a0, Operand(arg_count)); 4251 __ li(a0, Operand(arg_count));
4247 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 4252 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
4253 RelocInfo::CODE_TARGET);
4248 } 4254 }
4249 4255
4250 4256
4251 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4257 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4252 ZoneList<Expression*>* args = expr->arguments(); 4258 ZoneList<Expression*>* args = expr->arguments();
4253 int arg_count = args->length(); 4259 int arg_count = args->length();
4254 4260
4255 if (expr->is_jsruntime()) { 4261 if (expr->is_jsruntime()) {
4256 Comment cmnt(masm_, "[ CallRuntime"); 4262 Comment cmnt(masm_, "[ CallRuntime");
4257 EmitLoadJSRuntimeFunction(expr); 4263 EmitLoadJSRuntimeFunction(expr);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5049 reinterpret_cast<uint32_t>( 5055 reinterpret_cast<uint32_t>(
5050 isolate->builtins()->OsrAfterStackCheck()->entry())); 5056 isolate->builtins()->OsrAfterStackCheck()->entry()));
5051 return OSR_AFTER_STACK_CHECK; 5057 return OSR_AFTER_STACK_CHECK;
5052 } 5058 }
5053 5059
5054 5060
5055 } // namespace internal 5061 } // namespace internal
5056 } // namespace v8 5062 } // namespace v8
5057 5063
5058 #endif // V8_TARGET_ARCH_MIPS 5064 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698