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

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

Issue 1470173003: PPC: Refine "Adds the possibility of setting a Code object as the callback of a FunctionTemplate." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | no next file » | 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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 1131
1132 // Clobbers registers {r7, r8, r9, r10}. 1132 // Clobbers registers {r7, r8, r9, r10}.
1133 void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver, 1133 void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
1134 Register function_template_info, 1134 Register function_template_info,
1135 Label* receiver_check_failed) { 1135 Label* receiver_check_failed) {
1136 Register signature = r7; 1136 Register signature = r7;
1137 Register map = r8; 1137 Register map = r8;
1138 Register constructor = r9; 1138 Register constructor = r9;
1139 Register scratch = r10; 1139 Register scratch = r10;
1140 1140
1141 __ JumpIfSmi(receiver, receiver_check_failed);
1142 __ CompareObjectType(receiver, map, no_reg, FIRST_JS_OBJECT_TYPE); 1141 __ CompareObjectType(receiver, map, no_reg, FIRST_JS_OBJECT_TYPE);
1143 __ blt(receiver_check_failed); 1142 __ blt(receiver_check_failed);
1144 1143
1145 // If there is no signature, return the holder. 1144 // If there is no signature, return the holder.
1146 __ LoadP(signature, FieldMemOperand(function_template_info, 1145 __ LoadP(signature, FieldMemOperand(function_template_info,
1147 FunctionTemplateInfo::kSignatureOffset)); 1146 FunctionTemplateInfo::kSignatureOffset));
1148 Label receiver_check_passed; 1147 Label receiver_check_passed;
1149 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, 1148 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex,
1150 &receiver_check_passed); 1149 &receiver_check_passed);
1151 1150
1152 // Walk the prototype chain. 1151 // Walk the prototype chain.
1153 Label prototype_loop_start; 1152 Label prototype_loop_start;
1154 __ bind(&prototype_loop_start); 1153 __ bind(&prototype_loop_start);
1155 1154
1156 // End if the receiver is null or if it's a hidden type. 1155 // End if the receiver is null or if it's a hidden type.
1157 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed); 1156 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1158 __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1157 __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1159 __ LoadP(scratch, FieldMemOperand(map, Map::kBitField3Offset)); 1158 __ LoadP(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1160 __ DecodeField<Map::IsHiddenPrototype>(scratch); 1159 __ DecodeField<Map::IsHiddenPrototype>(scratch, SetRC);
1161 __ cmpi(scratch, Operand::Zero()); 1160 __ bne(receiver_check_failed, cr0);
1162 __ bne(receiver_check_failed);
1163 1161
1164 1162
1165 // Get the constructor, if any. 1163 // Get the constructor, if any.
1166 __ GetMapConstructor(constructor, map, scratch, scratch); 1164 __ GetMapConstructor(constructor, map, scratch, scratch);
1167 __ cmpi(scratch, Operand(JS_FUNCTION_TYPE)); 1165 __ cmpi(scratch, Operand(JS_FUNCTION_TYPE));
1168 Label next_prototype; 1166 Label next_prototype;
1169 __ bne(&next_prototype); 1167 __ bne(&next_prototype);
1170 Register type = constructor; 1168 Register type = constructor;
1171 __ LoadP(type, 1169 __ LoadP(type,
1172 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); 1170 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 // -- r4 : callee 1205 // -- r4 : callee
1208 // -- lr : return address 1206 // -- lr : return address
1209 // -- sp[0] : last argument 1207 // -- sp[0] : last argument
1210 // -- ... 1208 // -- ...
1211 // -- sp[4 * (argc - 1)] : first argument 1209 // -- sp[4 * (argc - 1)] : first argument
1212 // -- sp[4 * argc] : receiver 1210 // -- sp[4 * argc] : receiver
1213 // ----------------------------------- 1211 // -----------------------------------
1214 1212
1215 // Load the receiver. 1213 // Load the receiver.
1216 __ ShiftLeftImm(r11, r3, Operand(kPointerSizeLog2)); 1214 __ ShiftLeftImm(r11, r3, Operand(kPointerSizeLog2));
1217 __ add(r11, sp, r11); 1215 __ LoadPX(r5, MemOperand(sp, r11));
1218 __ LoadP(r5, MemOperand(r11));
1219 1216
1220 // Update the receiver if this is a contextual call. 1217 // Update the receiver if this is a contextual call.
1221 Label set_global_proxy, valid_receiver; 1218 Label set_global_proxy, valid_receiver;
1222 __ JumpIfRoot(r5, Heap::kUndefinedValueRootIndex, &set_global_proxy); 1219 __ JumpIfRoot(r5, Heap::kUndefinedValueRootIndex, &set_global_proxy);
1223 1220
1224 // Load the FunctionTemplateInfo. 1221 // Load the FunctionTemplateInfo.
1225 __ bind(&valid_receiver); 1222 __ bind(&valid_receiver);
1226 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1223 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1227 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); 1224 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset));
1228 1225
1229 // Do the compatible receiver check. 1226 // Do the compatible receiver check.
1230 Label receiver_check_failed; 1227 Label receiver_check_failed;
1231 CompatibleReceiverCheck(masm, r5, r6, &receiver_check_failed); 1228 CompatibleReceiverCheck(masm, r5, r6, &receiver_check_failed);
1232 1229
1233 // Get the callback offset from the FunctionTemplateInfo, and jump to the 1230 // Get the callback offset from the FunctionTemplateInfo, and jump to the
1234 // beginning of the code. 1231 // beginning of the code.
1235 __ LoadP(r6, FieldMemOperand(r6, FunctionTemplateInfo::kCallCodeOffset)); 1232 __ LoadP(r7, FieldMemOperand(r6, FunctionTemplateInfo::kCallCodeOffset));
1236 __ LoadP(r6, FieldMemOperand(r6, CallHandlerInfo::kFastHandlerOffset)); 1233 __ LoadP(r7, FieldMemOperand(r7, CallHandlerInfo::kFastHandlerOffset));
1237 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); 1234 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
1238 __ Jump(r6); 1235 __ JumpToJSEntry(ip);
1239 1236
1240 __ bind(&set_global_proxy); 1237 __ bind(&set_global_proxy);
1241 __ LoadGlobalProxy(r5); 1238 __ LoadGlobalProxy(r5);
1242 __ StoreP(r5, MemOperand(r11)); 1239 __ StorePX(r5, MemOperand(sp, r11));
1243 __ b(&valid_receiver); 1240 __ b(&valid_receiver);
1244 1241
1245 // Compatible receiver check failed: throw an Illegal Invocation exception. 1242 // Compatible receiver check failed: throw an Illegal Invocation exception.
1246 __ bind(&receiver_check_failed); 1243 __ bind(&receiver_check_failed);
1247 // Drop the arguments (including the receiver); 1244 // Drop the arguments (including the receiver);
1248 __ addi(r11, r11, Operand(kPointerSize)); 1245 __ addi(r11, r11, Operand(kPointerSize));
1249 __ StoreP(sp, MemOperand(r11)); 1246 __ add(sp, sp, r11);
1250 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); 1247 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1);
1251 } 1248 }
1252 1249
1253 1250
1254 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1251 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1255 // Lookup the function in the JavaScript frame. 1252 // Lookup the function in the JavaScript frame.
1256 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1253 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1257 { 1254 {
1258 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1255 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1259 // Pass function as argument. 1256 // Pass function as argument.
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 __ bkpt(0); 1990 __ bkpt(0);
1994 } 1991 }
1995 } 1992 }
1996 1993
1997 1994
1998 #undef __ 1995 #undef __
1999 } // namespace internal 1996 } // namespace internal
2000 } // namespace v8 1997 } // namespace v8
2001 1998
2002 #endif // V8_TARGET_ARCH_PPC 1999 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698