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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.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/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 __ bind(&l_call); 2117 __ bind(&l_call);
2118 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); 2118 __ ldr(load_receiver, MemOperand(sp, kPointerSize));
2119 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); 2119 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize));
2120 __ mov(LoadDescriptor::SlotRegister(), 2120 __ mov(LoadDescriptor::SlotRegister(),
2121 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2121 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2122 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); 2122 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2123 CallIC(ic, TypeFeedbackId::None()); 2123 CallIC(ic, TypeFeedbackId::None());
2124 __ mov(r1, r0); 2124 __ mov(r1, r0);
2125 __ str(r1, MemOperand(sp, 2 * kPointerSize)); 2125 __ str(r1, MemOperand(sp, 2 * kPointerSize));
2126 SetCallPosition(expr, 1); 2126 SetCallPosition(expr, 1);
2127 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2127 __ mov(r0, Operand(1));
2128 __ CallStub(&stub); 2128 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2129 2129
2130 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2130 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2131 __ Drop(1); // The function is still on the stack; drop it. 2131 __ Drop(1); // The function is still on the stack; drop it.
2132 2132
2133 // if (!result.done) goto l_try; 2133 // if (!result.done) goto l_try;
2134 __ bind(&l_loop); 2134 __ bind(&l_loop);
2135 __ Move(load_receiver, r0); 2135 __ Move(load_receiver, r0);
2136 2136
2137 __ push(load_receiver); // save result 2137 __ push(load_receiver); // save result
2138 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2138 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2810 // the debugger can patch them correctly. 2810 // the debugger can patch them correctly.
2811 __ Call(code, RelocInfo::CODE_TARGET, ast_id, al, 2811 __ Call(code, RelocInfo::CODE_TARGET, ast_id, al,
2812 NEVER_INLINE_TARGET_ADDRESS); 2812 NEVER_INLINE_TARGET_ADDRESS);
2813 } 2813 }
2814 2814
2815 2815
2816 // Code common for calls using the IC. 2816 // Code common for calls using the IC.
2817 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2817 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
2818 Expression* callee = expr->expression(); 2818 Expression* callee = expr->expression();
2819 2819
2820 CallICState::CallType call_type =
2821 callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD;
2822
2823 // Get the target function. 2820 // Get the target function.
2824 if (call_type == CallICState::FUNCTION) { 2821 if (callee->IsVariableProxy()) {
2825 { StackValueContext context(this); 2822 { StackValueContext context(this);
2826 EmitVariableLoad(callee->AsVariableProxy()); 2823 EmitVariableLoad(callee->AsVariableProxy());
2827 PrepareForBailout(callee, NO_REGISTERS); 2824 PrepareForBailout(callee, NO_REGISTERS);
2828 } 2825 }
2829 // Push undefined as receiver. This is patched in the method prologue if it 2826 // Push undefined as receiver. This is patched in the method prologue if it
2830 // is a sloppy mode method. 2827 // is a sloppy mode method.
2831 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 2828 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
2832 __ push(ip); 2829 __ push(ip);
2833 } else { 2830 } else {
2834 // Load the function from the receiver. 2831 // Load the function from the receiver.
2835 DCHECK(callee->IsProperty()); 2832 DCHECK(callee->IsProperty());
2836 DCHECK(!callee->AsProperty()->IsSuperAccess()); 2833 DCHECK(!callee->AsProperty()->IsSuperAccess());
2837 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2834 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2838 EmitNamedPropertyLoad(callee->AsProperty()); 2835 EmitNamedPropertyLoad(callee->AsProperty());
2839 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2836 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2840 // Push the target function under the receiver. 2837 // Push the target function under the receiver.
2841 __ ldr(ip, MemOperand(sp, 0)); 2838 __ ldr(ip, MemOperand(sp, 0));
2842 __ push(ip); 2839 __ push(ip);
2843 __ str(r0, MemOperand(sp, kPointerSize)); 2840 __ str(r0, MemOperand(sp, kPointerSize));
2844 } 2841 }
2845 2842
2846 EmitCall(expr, call_type); 2843 EmitCall(expr);
2847 } 2844 }
2848 2845
2849 2846
2850 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { 2847 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
2851 Expression* callee = expr->expression(); 2848 Expression* callee = expr->expression();
2852 DCHECK(callee->IsProperty()); 2849 DCHECK(callee->IsProperty());
2853 Property* prop = callee->AsProperty(); 2850 Property* prop = callee->AsProperty();
2854 DCHECK(prop->IsSuperAccess()); 2851 DCHECK(prop->IsSuperAccess());
2855 SetExpressionPosition(prop); 2852 SetExpressionPosition(prop);
2856 2853
(...skipping 19 matching lines...) Expand all
2876 // - key 2873 // - key
2877 // - language_mode 2874 // - language_mode
2878 __ CallRuntime(Runtime::kLoadFromSuper, 4); 2875 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2879 2876
2880 // Replace home_object with target function. 2877 // Replace home_object with target function.
2881 __ str(r0, MemOperand(sp, kPointerSize)); 2878 __ str(r0, MemOperand(sp, kPointerSize));
2882 2879
2883 // Stack here: 2880 // Stack here:
2884 // - target function 2881 // - target function
2885 // - this (receiver) 2882 // - this (receiver)
2886 EmitCall(expr, CallICState::METHOD); 2883 EmitCall(expr);
2887 } 2884 }
2888 2885
2889 2886
2890 // Code common for calls using the IC. 2887 // Code common for calls using the IC.
2891 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2888 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
2892 Expression* key) { 2889 Expression* key) {
2893 // Load the key. 2890 // Load the key.
2894 VisitForAccumulatorValue(key); 2891 VisitForAccumulatorValue(key);
2895 2892
2896 Expression* callee = expr->expression(); 2893 Expression* callee = expr->expression();
2897 2894
2898 // Load the function from the receiver. 2895 // Load the function from the receiver.
2899 DCHECK(callee->IsProperty()); 2896 DCHECK(callee->IsProperty());
2900 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2897 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2901 __ Move(LoadDescriptor::NameRegister(), r0); 2898 __ Move(LoadDescriptor::NameRegister(), r0);
2902 EmitKeyedPropertyLoad(callee->AsProperty()); 2899 EmitKeyedPropertyLoad(callee->AsProperty());
2903 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2900 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2904 2901
2905 // Push the target function under the receiver. 2902 // Push the target function under the receiver.
2906 __ ldr(ip, MemOperand(sp, 0)); 2903 __ ldr(ip, MemOperand(sp, 0));
2907 __ push(ip); 2904 __ push(ip);
2908 __ str(r0, MemOperand(sp, kPointerSize)); 2905 __ str(r0, MemOperand(sp, kPointerSize));
2909 2906
2910 EmitCall(expr, CallICState::METHOD); 2907 EmitCall(expr);
2911 } 2908 }
2912 2909
2913 2910
2914 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 2911 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2915 Expression* callee = expr->expression(); 2912 Expression* callee = expr->expression();
2916 DCHECK(callee->IsProperty()); 2913 DCHECK(callee->IsProperty());
2917 Property* prop = callee->AsProperty(); 2914 Property* prop = callee->AsProperty();
2918 DCHECK(prop->IsSuperAccess()); 2915 DCHECK(prop->IsSuperAccess());
2919 2916
2920 SetExpressionPosition(prop); 2917 SetExpressionPosition(prop);
(...skipping 17 matching lines...) Expand all
2938 // - key 2935 // - key
2939 // - language_mode 2936 // - language_mode
2940 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); 2937 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2941 2938
2942 // Replace home_object with target function. 2939 // Replace home_object with target function.
2943 __ str(r0, MemOperand(sp, kPointerSize)); 2940 __ str(r0, MemOperand(sp, kPointerSize));
2944 2941
2945 // Stack here: 2942 // Stack here:
2946 // - target function 2943 // - target function
2947 // - this (receiver) 2944 // - this (receiver)
2948 EmitCall(expr, CallICState::METHOD); 2945 EmitCall(expr);
2949 } 2946 }
2950 2947
2951 2948
2952 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2949 void FullCodeGenerator::EmitCall(Call* expr) {
2953 // Load the arguments. 2950 // Load the arguments.
2954 ZoneList<Expression*>* args = expr->arguments(); 2951 ZoneList<Expression*>* args = expr->arguments();
2955 int arg_count = args->length(); 2952 int arg_count = args->length();
2956 for (int i = 0; i < arg_count; i++) { 2953 for (int i = 0; i < arg_count; i++) {
2957 VisitForStackValue(args->at(i)); 2954 VisitForStackValue(args->at(i));
2958 } 2955 }
2959 2956
2960 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 2957 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2961 SetCallPosition(expr, arg_count); 2958 SetCallPosition(expr, arg_count);
2962 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); 2959 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code();
2963 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); 2960 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot())));
2964 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2961 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2965 // Don't assign a type feedback id to the IC, since type feedback is provided 2962 // Don't assign a type feedback id to the IC, since type feedback is provided
2966 // by the vector above. 2963 // by the vector above.
2967 CallIC(ic); 2964 CallIC(ic);
2968 2965
2969 RecordJSReturnSite(expr); 2966 RecordJSReturnSite(expr);
2970 // Restore context register. 2967 // Restore context register.
2971 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2968 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2972 context()->DropAndPlug(1, r0); 2969 context()->DropAndPlug(1, r0);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 __ push(r1); 3057 __ push(r1);
3061 EmitResolvePossiblyDirectEval(arg_count); 3058 EmitResolvePossiblyDirectEval(arg_count);
3062 3059
3063 // Touch up the stack with the resolved function. 3060 // Touch up the stack with the resolved function.
3064 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3061 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3065 3062
3066 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); 3063 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
3067 3064
3068 // Record source position for debugger. 3065 // Record source position for debugger.
3069 SetCallPosition(expr, arg_count); 3066 SetCallPosition(expr, arg_count);
3070 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3071 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3067 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3072 __ CallStub(&stub); 3068 __ mov(r0, Operand(arg_count));
3069 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3073 RecordJSReturnSite(expr); 3070 RecordJSReturnSite(expr);
3074 // Restore context register. 3071 // Restore context register.
3075 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3072 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3076 context()->DropAndPlug(1, r0); 3073 context()->DropAndPlug(1, r0);
3077 } 3074 }
3078 3075
3079 3076
3080 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3077 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3081 Comment cmnt(masm_, "[ CallNew"); 3078 Comment cmnt(masm_, "[ CallNew");
3082 // According to ECMA-262, section 11.2.2, page 44, the function 3079 // According to ECMA-262, section 11.2.2, page 44, the function
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
4275 __ ldr(r0, FieldMemOperand(r0, JSGlobalObject::kNativeContextOffset)); 4272 __ ldr(r0, FieldMemOperand(r0, JSGlobalObject::kNativeContextOffset));
4276 __ ldr(r0, ContextOperand(r0, expr->context_index())); 4273 __ ldr(r0, ContextOperand(r0, expr->context_index()));
4277 } 4274 }
4278 4275
4279 4276
4280 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4277 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4281 ZoneList<Expression*>* args = expr->arguments(); 4278 ZoneList<Expression*>* args = expr->arguments();
4282 int arg_count = args->length(); 4279 int arg_count = args->length();
4283 4280
4284 SetCallPosition(expr, arg_count); 4281 SetCallPosition(expr, arg_count);
4285 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4286 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 4282 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4287 __ CallStub(&stub); 4283 __ mov(r0, Operand(arg_count));
4284 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
4288 } 4285 }
4289 4286
4290 4287
4291 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4288 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4292 ZoneList<Expression*>* args = expr->arguments(); 4289 ZoneList<Expression*>* args = expr->arguments();
4293 int arg_count = args->length(); 4290 int arg_count = args->length();
4294 4291
4295 if (expr->is_jsruntime()) { 4292 if (expr->is_jsruntime()) {
4296 Comment cmnt(masm_, "[ CallRuntime"); 4293 Comment cmnt(masm_, "[ CallRuntime");
4297 EmitLoadJSRuntimeFunction(expr); 4294 EmitLoadJSRuntimeFunction(expr);
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 DCHECK(interrupt_address == 5141 DCHECK(interrupt_address ==
5145 isolate->builtins()->OsrAfterStackCheck()->entry()); 5142 isolate->builtins()->OsrAfterStackCheck()->entry());
5146 return OSR_AFTER_STACK_CHECK; 5143 return OSR_AFTER_STACK_CHECK;
5147 } 5144 }
5148 5145
5149 5146
5150 } // namespace internal 5147 } // namespace internal
5151 } // namespace v8 5148 } // namespace v8
5152 5149
5153 #endif // V8_TARGET_ARCH_ARM 5150 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698