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

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

Issue 1425083004: PPC: [builtins] Introduce specialized Call/CallFunction builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@patch4
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/ppc/lithium-codegen-ppc.cc ('k') | src/ppc/builtins-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); 2082 __ LoadP(load_receiver, MemOperand(sp, kPointerSize));
2083 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); 2083 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize));
2084 __ mov(LoadDescriptor::SlotRegister(), 2084 __ mov(LoadDescriptor::SlotRegister(),
2085 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2085 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2086 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); 2086 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2087 CallIC(ic, TypeFeedbackId::None()); 2087 CallIC(ic, TypeFeedbackId::None());
2088 __ mr(r4, r3); 2088 __ mr(r4, r3);
2089 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); 2089 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize));
2090 SetCallPosition(expr, 1); 2090 SetCallPosition(expr, 1);
2091 __ li(r3, Operand(1)); 2091 __ li(r3, Operand(1));
2092 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2092 __ Call(
2093 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined),
2094 RelocInfo::CODE_TARGET);
2093 2095
2094 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2096 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2095 __ Drop(1); // The function is still on the stack; drop it. 2097 __ Drop(1); // The function is still on the stack; drop it.
2096 2098
2097 // if (!result.done) goto l_try; 2099 // if (!result.done) goto l_try;
2098 __ Move(load_receiver, r3); 2100 __ Move(load_receiver, r3);
2099 2101
2100 __ push(load_receiver); // save result 2102 __ push(load_receiver); // save result
2101 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2103 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2102 __ mov(LoadDescriptor::SlotRegister(), 2104 __ mov(LoadDescriptor::SlotRegister(),
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 ic_total_count_++; 2810 ic_total_count_++;
2809 __ Call(code, RelocInfo::CODE_TARGET, ast_id); 2811 __ Call(code, RelocInfo::CODE_TARGET, ast_id);
2810 } 2812 }
2811 2813
2812 2814
2813 // Code common for calls using the IC. 2815 // Code common for calls using the IC.
2814 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2816 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
2815 Expression* callee = expr->expression(); 2817 Expression* callee = expr->expression();
2816 2818
2817 // Get the target function. 2819 // Get the target function.
2820 ConvertReceiverMode convert_mode;
2818 if (callee->IsVariableProxy()) { 2821 if (callee->IsVariableProxy()) {
2819 { 2822 {
2820 StackValueContext context(this); 2823 StackValueContext context(this);
2821 EmitVariableLoad(callee->AsVariableProxy()); 2824 EmitVariableLoad(callee->AsVariableProxy());
2822 PrepareForBailout(callee, NO_REGISTERS); 2825 PrepareForBailout(callee, NO_REGISTERS);
2823 } 2826 }
2824 // Push undefined as receiver. This is patched in the method prologue if it 2827 // Push undefined as receiver. This is patched in the method prologue if it
2825 // is a sloppy mode method. 2828 // is a sloppy mode method.
2826 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 2829 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
2827 __ push(r0); 2830 __ push(r0);
2831 convert_mode = ConvertReceiverMode::kNullOrUndefined;
2828 } else { 2832 } else {
2829 // Load the function from the receiver. 2833 // Load the function from the receiver.
2830 DCHECK(callee->IsProperty()); 2834 DCHECK(callee->IsProperty());
2831 DCHECK(!callee->AsProperty()->IsSuperAccess()); 2835 DCHECK(!callee->AsProperty()->IsSuperAccess());
2832 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2836 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2833 EmitNamedPropertyLoad(callee->AsProperty()); 2837 EmitNamedPropertyLoad(callee->AsProperty());
2834 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2838 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2835 // Push the target function under the receiver. 2839 // Push the target function under the receiver.
2836 __ LoadP(r0, MemOperand(sp, 0)); 2840 __ LoadP(r0, MemOperand(sp, 0));
2837 __ push(r0); 2841 __ push(r0);
2838 __ StoreP(r3, MemOperand(sp, kPointerSize)); 2842 __ StoreP(r3, MemOperand(sp, kPointerSize));
2843 convert_mode = ConvertReceiverMode::kNotNullOrUndefined;
2839 } 2844 }
2840 2845
2841 EmitCall(expr); 2846 EmitCall(expr, convert_mode);
2842 } 2847 }
2843 2848
2844 2849
2845 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { 2850 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
2846 Expression* callee = expr->expression(); 2851 Expression* callee = expr->expression();
2847 DCHECK(callee->IsProperty()); 2852 DCHECK(callee->IsProperty());
2848 Property* prop = callee->AsProperty(); 2853 Property* prop = callee->AsProperty();
2849 DCHECK(prop->IsSuperAccess()); 2854 DCHECK(prop->IsSuperAccess());
2850 SetExpressionPosition(prop); 2855 SetExpressionPosition(prop);
2851 2856
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2897 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
2893 __ Move(LoadDescriptor::NameRegister(), r3); 2898 __ Move(LoadDescriptor::NameRegister(), r3);
2894 EmitKeyedPropertyLoad(callee->AsProperty()); 2899 EmitKeyedPropertyLoad(callee->AsProperty());
2895 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2900 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2896 2901
2897 // Push the target function under the receiver. 2902 // Push the target function under the receiver.
2898 __ LoadP(ip, MemOperand(sp, 0)); 2903 __ LoadP(ip, MemOperand(sp, 0));
2899 __ push(ip); 2904 __ push(ip);
2900 __ StoreP(r3, MemOperand(sp, kPointerSize)); 2905 __ StoreP(r3, MemOperand(sp, kPointerSize));
2901 2906
2902 EmitCall(expr); 2907 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined);
2903 } 2908 }
2904 2909
2905 2910
2906 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 2911 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2907 Expression* callee = expr->expression(); 2912 Expression* callee = expr->expression();
2908 DCHECK(callee->IsProperty()); 2913 DCHECK(callee->IsProperty());
2909 Property* prop = callee->AsProperty(); 2914 Property* prop = callee->AsProperty();
2910 DCHECK(prop->IsSuperAccess()); 2915 DCHECK(prop->IsSuperAccess());
2911 2916
2912 SetExpressionPosition(prop); 2917 SetExpressionPosition(prop);
(...skipping 19 matching lines...) Expand all
2932 // Replace home_object with target function. 2937 // Replace home_object with target function.
2933 __ StoreP(r3, MemOperand(sp, kPointerSize)); 2938 __ StoreP(r3, MemOperand(sp, kPointerSize));
2934 2939
2935 // Stack here: 2940 // Stack here:
2936 // - target function 2941 // - target function
2937 // - this (receiver) 2942 // - this (receiver)
2938 EmitCall(expr); 2943 EmitCall(expr);
2939 } 2944 }
2940 2945
2941 2946
2942 void FullCodeGenerator::EmitCall(Call* expr) { 2947 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
2943 // Load the arguments. 2948 // Load the arguments.
2944 ZoneList<Expression*>* args = expr->arguments(); 2949 ZoneList<Expression*>* args = expr->arguments();
2945 int arg_count = args->length(); 2950 int arg_count = args->length();
2946 for (int i = 0; i < arg_count; i++) { 2951 for (int i = 0; i < arg_count; i++) {
2947 VisitForStackValue(args->at(i)); 2952 VisitForStackValue(args->at(i));
2948 } 2953 }
2949 2954
2950 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); 2955 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2951 SetCallPosition(expr, arg_count); 2956 SetCallPosition(expr, arg_count);
2952 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count).code(); 2957 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code();
2953 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot())); 2958 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot()));
2954 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); 2959 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
2955 // Don't assign a type feedback id to the IC, since type feedback is provided 2960 // Don't assign a type feedback id to the IC, since type feedback is provided
2956 // by the vector above. 2961 // by the vector above.
2957 CallIC(ic); 2962 CallIC(ic);
2958 2963
2959 RecordJSReturnSite(expr); 2964 RecordJSReturnSite(expr);
2960 // Restore context register. 2965 // Restore context register.
2961 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2966 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2962 context()->DropAndPlug(1, r3); 2967 context()->DropAndPlug(1, r3);
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 } 4256 }
4252 4257
4253 4258
4254 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4259 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4255 ZoneList<Expression*>* args = expr->arguments(); 4260 ZoneList<Expression*>* args = expr->arguments();
4256 int arg_count = args->length(); 4261 int arg_count = args->length();
4257 4262
4258 SetCallPosition(expr, arg_count); 4263 SetCallPosition(expr, arg_count);
4259 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0); 4264 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
4260 __ mov(r3, Operand(arg_count)); 4265 __ mov(r3, Operand(arg_count));
4261 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 4266 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined),
4267 RelocInfo::CODE_TARGET);
4262 } 4268 }
4263 4269
4264 4270
4265 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4271 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4266 ZoneList<Expression*>* args = expr->arguments(); 4272 ZoneList<Expression*>* args = expr->arguments();
4267 int arg_count = args->length(); 4273 int arg_count = args->length();
4268 4274
4269 if (expr->is_jsruntime()) { 4275 if (expr->is_jsruntime()) {
4270 Comment cmnt(masm_, "[ CallRuntime"); 4276 Comment cmnt(masm_, "[ CallRuntime");
4271 EmitLoadJSRuntimeFunction(expr); 4277 EmitLoadJSRuntimeFunction(expr);
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 return ON_STACK_REPLACEMENT; 5052 return ON_STACK_REPLACEMENT;
5047 } 5053 }
5048 5054
5049 DCHECK(interrupt_address == 5055 DCHECK(interrupt_address ==
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 } // namespace internal 5059 } // namespace internal
5054 } // namespace v8 5060 } // namespace v8
5055 #endif // V8_TARGET_ARCH_PPC 5061 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/crankshaft/ppc/lithium-codegen-ppc.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698