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

Side by Side Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2809743003: PPC/s390: [ignition] Add call bytecodes for undefined receiver (Closed)
Patch Set: Created 3 years, 8 months 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 | « no previous file | src/builtins/s390/builtins-s390.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/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 // here which will cause scratch to become negative. 1090 // here which will cause scratch to become negative.
1091 __ sub(scratch, sp, scratch); 1091 __ sub(scratch, sp, scratch);
1092 // Check if the arguments will overflow the stack. 1092 // Check if the arguments will overflow the stack.
1093 __ ShiftLeftImm(r0, num_args, Operand(kPointerSizeLog2)); 1093 __ ShiftLeftImm(r0, num_args, Operand(kPointerSizeLog2));
1094 __ cmp(scratch, r0); 1094 __ cmp(scratch, r0);
1095 __ ble(stack_overflow); // Signed comparison. 1095 __ ble(stack_overflow); // Signed comparison.
1096 } 1096 }
1097 1097
1098 static void Generate_InterpreterPushArgs(MacroAssembler* masm, 1098 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
1099 Register num_args, Register index, 1099 Register num_args, Register index,
1100 Register count, Register scratch, 1100 Register count, Register scratch) {
1101 Label* stack_overflow) {
1102 // A stack check before pushing arguments.
1103 Generate_StackOverflowCheck(masm, num_args, scratch, stack_overflow);
1104
1105 Label loop; 1101 Label loop;
1106 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU 1102 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU
1107 __ mtctr(count); 1103 __ mtctr(count);
1108 __ bind(&loop); 1104 __ bind(&loop);
1109 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); 1105 __ LoadPU(scratch, MemOperand(index, -kPointerSize));
1110 __ push(scratch); 1106 __ push(scratch);
1111 __ bdnz(&loop); 1107 __ bdnz(&loop);
1112 } 1108 }
1113 1109
1114 // static 1110 // static
1115 void Builtins::Generate_InterpreterPushArgsThenCallImpl( 1111 void Builtins::Generate_InterpreterPushArgsThenCallImpl(
1116 MacroAssembler* masm, TailCallMode tail_call_mode, 1112 MacroAssembler* masm, ConvertReceiverMode receiver_mode,
1117 InterpreterPushArgsMode mode) { 1113 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) {
1118 // ----------- S t a t e ------------- 1114 // ----------- S t a t e -------------
1119 // -- r3 : the number of arguments (not including the receiver) 1115 // -- r3 : the number of arguments (not including the receiver)
1120 // -- r5 : the address of the first argument to be pushed. Subsequent 1116 // -- r5 : the address of the first argument to be pushed. Subsequent
1121 // arguments should be consecutive above this, in the same order as 1117 // arguments should be consecutive above this, in the same order as
1122 // they are to be pushed onto the stack. 1118 // they are to be pushed onto the stack.
1123 // -- r4 : the target to call (can be any Object). 1119 // -- r4 : the target to call (can be any Object).
1124 // ----------------------------------- 1120 // -----------------------------------
1125 Label stack_overflow; 1121 Label stack_overflow;
1126 1122
1127 // Calculate number of arguments (add one for receiver). 1123 // Calculate number of arguments (add one for receiver).
1128 __ addi(r6, r3, Operand(1)); 1124 __ addi(r6, r3, Operand(1));
1129 1125
1126 Generate_StackOverflowCheck(masm, r6, ip, &stack_overflow);
1127
1128 // Push "undefined" as the receiver arg if we need to.
1129 if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
1130 __ PushRoot(Heap::kUndefinedValueRootIndex);
1131 __ mr(r6, r3); // Argument count is correct.
1132 }
1133
1130 // Push the arguments. r5, r6, r7 will be modified. 1134 // Push the arguments. r5, r6, r7 will be modified.
1131 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7, &stack_overflow); 1135 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7);
1132 1136
1133 // Call the target. 1137 // Call the target.
1134 if (mode == InterpreterPushArgsMode::kJSFunction) { 1138 if (mode == InterpreterPushArgsMode::kJSFunction) {
1135 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 1139 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
1136 tail_call_mode), 1140 tail_call_mode),
1137 RelocInfo::CODE_TARGET); 1141 RelocInfo::CODE_TARGET);
1138 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { 1142 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
1139 __ Jump(masm->isolate()->builtins()->CallWithSpread(), 1143 __ Jump(masm->isolate()->builtins()->CallWithSpread(),
1140 RelocInfo::CODE_TARGET); 1144 RelocInfo::CODE_TARGET);
1141 } else { 1145 } else {
(...skipping 23 matching lines...) Expand all
1165 Label stack_overflow; 1169 Label stack_overflow;
1166 1170
1167 // Push a slot for the receiver to be constructed. 1171 // Push a slot for the receiver to be constructed.
1168 __ li(r0, Operand::Zero()); 1172 __ li(r0, Operand::Zero());
1169 __ push(r0); 1173 __ push(r0);
1170 1174
1171 // Push the arguments (skip if none). 1175 // Push the arguments (skip if none).
1172 Label skip; 1176 Label skip;
1173 __ cmpi(r3, Operand::Zero()); 1177 __ cmpi(r3, Operand::Zero());
1174 __ beq(&skip); 1178 __ beq(&skip);
1179 Generate_StackOverflowCheck(masm, r3, ip, &stack_overflow);
1175 // Push the arguments. r8, r7, r9 will be modified. 1180 // Push the arguments. r8, r7, r9 will be modified.
1176 Generate_InterpreterPushArgs(masm, r3, r7, r3, r8, &stack_overflow); 1181 Generate_InterpreterPushArgs(masm, r3, r7, r3, r9);
1177 __ bind(&skip); 1182 __ bind(&skip);
1178 1183
1179 __ AssertUndefinedOrAllocationSite(r5, r8); 1184 __ AssertUndefinedOrAllocationSite(r5, r8);
1180 if (mode == InterpreterPushArgsMode::kJSFunction) { 1185 if (mode == InterpreterPushArgsMode::kJSFunction) {
1181 __ AssertFunction(r4); 1186 __ AssertFunction(r4);
1182 1187
1183 // Tail call to the function-specific construct stub (still in the caller 1188 // Tail call to the function-specific construct stub (still in the caller
1184 // context at this point). 1189 // context at this point).
1185 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1190 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1186 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); 1191 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset));
(...skipping 22 matching lines...) Expand all
1209 void Builtins::Generate_InterpreterPushArgsThenConstructArray( 1214 void Builtins::Generate_InterpreterPushArgsThenConstructArray(
1210 MacroAssembler* masm) { 1215 MacroAssembler* masm) {
1211 // ----------- S t a t e ------------- 1216 // ----------- S t a t e -------------
1212 // -- r3 : argument count (not including receiver) 1217 // -- r3 : argument count (not including receiver)
1213 // -- r4 : target to call verified to be Array function 1218 // -- r4 : target to call verified to be Array function
1214 // -- r5 : allocation site feedback if available, undefined otherwise. 1219 // -- r5 : allocation site feedback if available, undefined otherwise.
1215 // -- r6 : address of the first argument 1220 // -- r6 : address of the first argument
1216 // ----------------------------------- 1221 // -----------------------------------
1217 Label stack_overflow; 1222 Label stack_overflow;
1218 1223
1219 __ addi(r7, r3, Operand(1)); // Add one for receiver. 1224 // Push a slot for the receiver to be constructed.
1225 __ li(r0, Operand::Zero());
1226 __ push(r0);
1227
1228 Generate_StackOverflowCheck(masm, r3, ip, &stack_overflow);
1220 1229
1221 // Push the arguments. r6, r8, r3 will be modified. 1230 // Push the arguments. r6, r8, r3 will be modified.
1222 Generate_InterpreterPushArgs(masm, r7, r6, r7, r8, &stack_overflow); 1231 Generate_InterpreterPushArgs(masm, r3, r6, r3, r8);
1223 1232
1224 // Array constructor expects constructor in r6. It is same as r4 here. 1233 // Array constructor expects constructor in r6. It is same as r4 here.
1225 __ mr(r6, r4); 1234 __ mr(r6, r4);
1226 1235
1227 ArrayConstructorStub stub(masm->isolate()); 1236 ArrayConstructorStub stub(masm->isolate());
1228 __ TailCallStub(&stub); 1237 __ TailCallStub(&stub);
1229 1238
1230 __ bind(&stack_overflow); 1239 __ bind(&stack_overflow);
1231 { 1240 {
1232 __ TailCallRuntime(Runtime::kThrowStackOverflow); 1241 __ TailCallRuntime(Runtime::kThrowStackOverflow);
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 } 3086 }
3078 // Now jump to the instructions of the returned code object. 3087 // Now jump to the instructions of the returned code object.
3079 __ Jump(r11); 3088 __ Jump(r11);
3080 } 3089 }
3081 3090
3082 #undef __ 3091 #undef __
3083 } // namespace internal 3092 } // namespace internal
3084 } // namespace v8 3093 } // namespace v8
3085 3094
3086 #endif // V8_TARGET_ARCH_PPC 3095 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698