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

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

Issue 1407373007: Remove CallFunctionStub, always call through the Call builtin (also from CallIC) (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
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 __ ld(load_receiver, MemOperand(sp, kPointerSize)); 2114 __ ld(load_receiver, MemOperand(sp, kPointerSize));
2115 __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); 2115 __ ld(load_name, MemOperand(sp, 2 * kPointerSize));
2116 __ li(LoadDescriptor::SlotRegister(), 2116 __ li(LoadDescriptor::SlotRegister(),
2117 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2117 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2118 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); 2118 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2119 CallIC(ic, TypeFeedbackId::None()); 2119 CallIC(ic, TypeFeedbackId::None());
2120 __ mov(a0, v0); 2120 __ mov(a0, v0);
2121 __ mov(a1, a0); 2121 __ mov(a1, a0);
2122 __ sd(a1, MemOperand(sp, 2 * kPointerSize)); 2122 __ sd(a1, MemOperand(sp, 2 * kPointerSize));
2123 SetCallPosition(expr, 1); 2123 SetCallPosition(expr, 1);
2124 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2124 __ li(a0, Operand(1));
2125 __ CallStub(&stub); 2125 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2126 2126
2127 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2127 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2128 __ Drop(1); // The function is still on the stack; drop it. 2128 __ Drop(1); // The function is still on the stack; drop it.
2129 2129
2130 // if (!result.done) goto l_try; 2130 // if (!result.done) goto l_try;
2131 __ Move(load_receiver, v0); 2131 __ Move(load_receiver, v0);
2132 2132
2133 __ push(load_receiver); // save result 2133 __ push(load_receiver); // save result
2134 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2134 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2135 __ li(LoadDescriptor::SlotRegister(), 2135 __ li(LoadDescriptor::SlotRegister(),
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2807 TypeFeedbackId id) { 2807 TypeFeedbackId id) {
2808 ic_total_count_++; 2808 ic_total_count_++;
2809 __ Call(code, RelocInfo::CODE_TARGET, id); 2809 __ Call(code, RelocInfo::CODE_TARGET, id);
2810 } 2810 }
2811 2811
2812 2812
2813 // Code common for calls using the IC. 2813 // Code common for calls using the IC.
2814 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2814 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
2815 Expression* callee = expr->expression(); 2815 Expression* callee = expr->expression();
2816 2816
2817 CallICState::CallType call_type =
2818 callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD;
2819
2820 // Get the target function. 2817 // Get the target function.
2821 if (call_type == CallICState::FUNCTION) { 2818 if (callee->IsVariableProxy()) {
2822 { StackValueContext context(this); 2819 { StackValueContext context(this);
2823 EmitVariableLoad(callee->AsVariableProxy()); 2820 EmitVariableLoad(callee->AsVariableProxy());
2824 PrepareForBailout(callee, NO_REGISTERS); 2821 PrepareForBailout(callee, NO_REGISTERS);
2825 } 2822 }
2826 // Push undefined as receiver. This is patched in the method prologue if it 2823 // Push undefined as receiver. This is patched in the method prologue if it
2827 // is a sloppy mode method. 2824 // is a sloppy mode method.
2828 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 2825 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
2829 __ push(at); 2826 __ push(at);
2830 } else { 2827 } else {
2831 // Load the function from the receiver. 2828 // Load the function from the receiver.
2832 DCHECK(callee->IsProperty()); 2829 DCHECK(callee->IsProperty());
2833 DCHECK(!callee->AsProperty()->IsSuperAccess()); 2830 DCHECK(!callee->AsProperty()->IsSuperAccess());
2834 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2831 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2835 EmitNamedPropertyLoad(callee->AsProperty()); 2832 EmitNamedPropertyLoad(callee->AsProperty());
2836 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2833 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2837 // Push the target function under the receiver. 2834 // Push the target function under the receiver.
2838 __ ld(at, MemOperand(sp, 0)); 2835 __ ld(at, MemOperand(sp, 0));
2839 __ push(at); 2836 __ push(at);
2840 __ sd(v0, MemOperand(sp, kPointerSize)); 2837 __ sd(v0, MemOperand(sp, kPointerSize));
2841 } 2838 }
2842 2839
2843 EmitCall(expr, call_type); 2840 EmitCall(expr);
2844 } 2841 }
2845 2842
2846 2843
2847 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { 2844 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
2848 SetExpressionPosition(expr); 2845 SetExpressionPosition(expr);
2849 Expression* callee = expr->expression(); 2846 Expression* callee = expr->expression();
2850 DCHECK(callee->IsProperty()); 2847 DCHECK(callee->IsProperty());
2851 Property* prop = callee->AsProperty(); 2848 Property* prop = callee->AsProperty();
2852 DCHECK(prop->IsSuperAccess()); 2849 DCHECK(prop->IsSuperAccess());
2853 2850
(...skipping 17 matching lines...) Expand all
2871 // - key 2868 // - key
2872 // - language_mode 2869 // - language_mode
2873 __ CallRuntime(Runtime::kLoadFromSuper, 4); 2870 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2874 2871
2875 // Replace home_object with target function. 2872 // Replace home_object with target function.
2876 __ sd(v0, MemOperand(sp, kPointerSize)); 2873 __ sd(v0, MemOperand(sp, kPointerSize));
2877 2874
2878 // Stack here: 2875 // Stack here:
2879 // - target function 2876 // - target function
2880 // - this (receiver) 2877 // - this (receiver)
2881 EmitCall(expr, CallICState::METHOD); 2878 EmitCall(expr);
2882 } 2879 }
2883 2880
2884 2881
2885 // Code common for calls using the IC. 2882 // Code common for calls using the IC.
2886 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2883 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
2887 Expression* key) { 2884 Expression* key) {
2888 // Load the key. 2885 // Load the key.
2889 VisitForAccumulatorValue(key); 2886 VisitForAccumulatorValue(key);
2890 2887
2891 Expression* callee = expr->expression(); 2888 Expression* callee = expr->expression();
2892 2889
2893 // Load the function from the receiver. 2890 // Load the function from the receiver.
2894 DCHECK(callee->IsProperty()); 2891 DCHECK(callee->IsProperty());
2895 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2892 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2896 __ Move(LoadDescriptor::NameRegister(), v0); 2893 __ Move(LoadDescriptor::NameRegister(), v0);
2897 EmitKeyedPropertyLoad(callee->AsProperty()); 2894 EmitKeyedPropertyLoad(callee->AsProperty());
2898 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2895 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2899 2896
2900 // Push the target function under the receiver. 2897 // Push the target function under the receiver.
2901 __ ld(at, MemOperand(sp, 0)); 2898 __ ld(at, MemOperand(sp, 0));
2902 __ push(at); 2899 __ push(at);
2903 __ sd(v0, MemOperand(sp, kPointerSize)); 2900 __ sd(v0, MemOperand(sp, kPointerSize));
2904 2901
2905 EmitCall(expr, CallICState::METHOD); 2902 EmitCall(expr);
2906 } 2903 }
2907 2904
2908 2905
2909 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 2906 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2910 Expression* callee = expr->expression(); 2907 Expression* callee = expr->expression();
2911 DCHECK(callee->IsProperty()); 2908 DCHECK(callee->IsProperty());
2912 Property* prop = callee->AsProperty(); 2909 Property* prop = callee->AsProperty();
2913 DCHECK(prop->IsSuperAccess()); 2910 DCHECK(prop->IsSuperAccess());
2914 2911
2915 SetExpressionPosition(prop); 2912 SetExpressionPosition(prop);
(...skipping 15 matching lines...) Expand all
2931 // - key 2928 // - key
2932 // - language_mode 2929 // - language_mode
2933 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); 2930 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2934 2931
2935 // Replace home_object with target function. 2932 // Replace home_object with target function.
2936 __ sd(v0, MemOperand(sp, kPointerSize)); 2933 __ sd(v0, MemOperand(sp, kPointerSize));
2937 2934
2938 // Stack here: 2935 // Stack here:
2939 // - target function 2936 // - target function
2940 // - this (receiver) 2937 // - this (receiver)
2941 EmitCall(expr, CallICState::METHOD); 2938 EmitCall(expr);
2942 } 2939 }
2943 2940
2944 2941
2945 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2942 void FullCodeGenerator::EmitCall(Call* expr) {
2946 // Load the arguments. 2943 // Load the arguments.
2947 ZoneList<Expression*>* args = expr->arguments(); 2944 ZoneList<Expression*>* args = expr->arguments();
2948 int arg_count = args->length(); 2945 int arg_count = args->length();
2949 for (int i = 0; i < arg_count; i++) { 2946 for (int i = 0; i < arg_count; i++) {
2950 VisitForStackValue(args->at(i)); 2947 VisitForStackValue(args->at(i));
2951 } 2948 }
2952 2949
2953 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 2950 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2954 // Record source position of the IC call. 2951 // Record source position of the IC call.
2955 SetCallPosition(expr, arg_count); 2952 SetCallPosition(expr, arg_count);
2956 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); 2953 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code();
2957 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); 2954 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot())));
2958 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2955 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2959 // Don't assign a type feedback id to the IC, since type feedback is provided 2956 // Don't assign a type feedback id to the IC, since type feedback is provided
2960 // by the vector above. 2957 // by the vector above.
2961 CallIC(ic); 2958 CallIC(ic);
2962 RecordJSReturnSite(expr); 2959 RecordJSReturnSite(expr);
2963 // Restore context register. 2960 // Restore context register.
2964 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2961 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2965 context()->DropAndPlug(1, v0); 2962 context()->DropAndPlug(1, v0);
2966 } 2963 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3049 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3053 __ push(a1); 3050 __ push(a1);
3054 EmitResolvePossiblyDirectEval(arg_count); 3051 EmitResolvePossiblyDirectEval(arg_count);
3055 3052
3056 // Touch up the stack with the resolved function. 3053 // Touch up the stack with the resolved function.
3057 __ sd(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3054 __ sd(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3058 3055
3059 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); 3056 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
3060 // Record source position for debugger. 3057 // Record source position for debugger.
3061 SetCallPosition(expr, arg_count); 3058 SetCallPosition(expr, arg_count);
3062 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3063 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3059 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3064 __ CallStub(&stub); 3060 __ li(a0, Operand(arg_count));
3061 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3065 RecordJSReturnSite(expr); 3062 RecordJSReturnSite(expr);
3066 // Restore context register. 3063 // Restore context register.
3067 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3064 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3068 context()->DropAndPlug(1, v0); 3065 context()->DropAndPlug(1, v0);
3069 } 3066 }
3070 3067
3071 3068
3072 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3069 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3073 Comment cmnt(masm_, "[ CallNew"); 3070 Comment cmnt(masm_, "[ CallNew");
3074 // According to ECMA-262, section 11.2.2, page 44, the function 3071 // According to ECMA-262, section 11.2.2, page 44, the function
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 __ ld(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset)); 4294 __ ld(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset));
4298 __ ld(v0, ContextOperand(v0, expr->context_index())); 4295 __ ld(v0, ContextOperand(v0, expr->context_index()));
4299 } 4296 }
4300 4297
4301 4298
4302 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4299 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4303 ZoneList<Expression*>* args = expr->arguments(); 4300 ZoneList<Expression*>* args = expr->arguments();
4304 int arg_count = args->length(); 4301 int arg_count = args->length();
4305 4302
4306 SetCallPosition(expr, arg_count); 4303 SetCallPosition(expr, arg_count);
4307 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4308 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 4304 __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4309 __ CallStub(&stub); 4305 __ li(a0, Operand(arg_count));
4306 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
4310 } 4307 }
4311 4308
4312 4309
4313 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4310 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4314 ZoneList<Expression*>* args = expr->arguments(); 4311 ZoneList<Expression*>* args = expr->arguments();
4315 int arg_count = args->length(); 4312 int arg_count = args->length();
4316 4313
4317 if (expr->is_jsruntime()) { 4314 if (expr->is_jsruntime()) {
4318 Comment cmnt(masm_, "[ CallRuntime"); 4315 Comment cmnt(masm_, "[ CallRuntime");
4319 EmitLoadJSRuntimeFunction(expr); 4316 EmitLoadJSRuntimeFunction(expr);
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
5114 reinterpret_cast<uint64_t>( 5111 reinterpret_cast<uint64_t>(
5115 isolate->builtins()->OsrAfterStackCheck()->entry())); 5112 isolate->builtins()->OsrAfterStackCheck()->entry()));
5116 return OSR_AFTER_STACK_CHECK; 5113 return OSR_AFTER_STACK_CHECK;
5117 } 5114 }
5118 5115
5119 5116
5120 } // namespace internal 5117 } // namespace internal
5121 } // namespace v8 5118 } // namespace v8
5122 5119
5123 #endif // V8_TARGET_ARCH_MIPS64 5120 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698