OLD | NEW |
---|---|
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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1216 // This simulates the initial call to bytecode handlers in interpreter entry | 1216 // This simulates the initial call to bytecode handlers in interpreter entry |
1217 // trampoline. The return will never actually be taken, but our stack walker | 1217 // trampoline. The return will never actually be taken, but our stack walker |
1218 // uses this address to determine whether a frame is interpreted. | 1218 // uses this address to determine whether a frame is interpreted. |
1219 __ mov(r14, | 1219 __ mov(r14, |
1220 Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1220 Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
1221 | 1221 |
1222 Generate_EnterBytecodeDispatch(masm); | 1222 Generate_EnterBytecodeDispatch(masm); |
1223 } | 1223 } |
1224 | 1224 |
1225 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1225 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1226 // ----------- S t a t e ------------- | |
1227 // -- r2 : argument count (preserved for callee) | |
1228 // -- r5 : new target (preserved for callee) | |
1229 // -- r3 : target function (preserved for callee) | |
1230 // ----------------------------------- | |
1231 // First lookup code, maybe we don't need to compile! | |
1232 Label gotta_call_runtime; | |
1233 Label maybe_call_runtime; | |
1234 Label try_shared; | |
1235 Label loop_top, loop_bottom; | |
1236 | |
1237 Register closure = r3; | |
1238 Register map = r8; | |
1239 Register index = r4; | |
1240 __ LoadP(map, | |
1241 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | |
1242 __ LoadP(map, | |
1243 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | |
1244 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | |
1245 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); | |
1246 __ blt(&gotta_call_runtime); | |
1247 | |
1248 // Find literals. | |
1249 // r9 : native context | |
1250 // r4 : length / index | |
1251 // r8 : optimized code map | |
1252 // r5 : new target | |
1253 // r3 : closure | |
1254 Register native_context = r9; | |
1255 __ LoadP(native_context, NativeContextMemOperand()); | |
1256 | |
1257 __ bind(&loop_top); | |
1258 Register temp = r1; | |
1259 Register array_pointer = r7; | |
1260 | |
1261 // Does the native context match? | |
1262 __ SmiToPtrArrayOffset(array_pointer, index); | |
1263 __ AddP(array_pointer, map, array_pointer); | |
1264 __ LoadP(temp, FieldMemOperand(array_pointer, | |
1265 SharedFunctionInfo::kOffsetToPreviousContext)); | |
1266 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | |
1267 __ CmpP(temp, native_context); | |
1268 __ bne(&loop_bottom); | |
JoranSiu
2016/04/15 12:01:27
Please add Label::kNear
| |
1269 // OSR id set to none? | |
1270 __ LoadP(temp, | |
1271 FieldMemOperand(array_pointer, | |
1272 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); | |
1273 const int bailout_id = BailoutId::None().ToInt(); | |
1274 __ CmpSmiLiteral(temp, Smi::FromInt(bailout_id), r0); | |
1275 __ bne(&loop_bottom); | |
JoranSiu
2016/04/15 12:01:27
Please add Label::kNear
| |
1276 // Literals available? | |
1277 __ LoadP(temp, | |
1278 FieldMemOperand(array_pointer, | |
1279 SharedFunctionInfo::kOffsetToPreviousLiterals)); | |
1280 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | |
1281 __ JumpIfSmi(temp, &gotta_call_runtime); | |
1282 | |
1283 // Save the literals in the closure. | |
1284 __ StoreP(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset), r0); | |
1285 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r6, | |
1286 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | |
1287 OMIT_SMI_CHECK); | |
1288 | |
1289 // Code available? | |
1290 Register entry = r6; | |
1291 __ LoadP(entry, | |
1292 FieldMemOperand(array_pointer, | |
1293 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | |
1294 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | |
1295 __ JumpIfSmi(entry, &maybe_call_runtime); | |
1296 | |
1297 // Found literals and code. Get them into the closure and return. | |
1298 // Store code entry in the closure. | |
1299 __ AddP(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
1300 | |
1301 Label install_optimized_code_and_tailcall; | |
1302 __ bind(&install_optimized_code_and_tailcall); | |
1303 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); | |
1304 __ RecordWriteCodeEntryField(closure, entry, r7); | |
1305 | |
1306 // Link the closure into the optimized function list. | |
1307 // r6 : code entry | |
1308 // r9: native context | |
1309 // r3 : closure | |
1310 __ LoadP( | |
1311 r7, ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | |
1312 __ StoreP(r7, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset), | |
1313 r0); | |
1314 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, r7, temp, | |
1315 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | |
1316 OMIT_SMI_CHECK); | |
1317 const int function_list_offset = | |
1318 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST); | |
1319 __ StoreP( | |
1320 closure, | |
1321 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST), r0); | |
1322 // Save closure before the write barrier. | |
1323 __ LoadRR(r7, closure); | |
1324 __ RecordWriteContextSlot(native_context, function_list_offset, r7, temp, | |
1325 kLRHasNotBeenSaved, kDontSaveFPRegs); | |
1326 __ JumpToJSEntry(entry); | |
1327 | |
1328 __ bind(&loop_bottom); | |
1329 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), | |
1330 r0); | |
1331 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); | |
1332 __ bgt(&loop_top); | |
1333 | |
1334 // We found neither literals nor code. | |
1335 __ b(&gotta_call_runtime); | |
1336 | |
1337 __ bind(&maybe_call_runtime); | |
1338 | |
1339 // Last possibility. Check the context free optimized code map entry. | |
1340 __ LoadP(entry, | |
1341 FieldMemOperand(map, FixedArray::kHeaderSize + | |
1342 SharedFunctionInfo::kSharedCodeIndex)); | |
1343 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | |
1344 __ JumpIfSmi(entry, &try_shared); | |
1345 | |
1346 // Store code entry in the closure. | |
1347 __ AddP(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
1348 __ b(&install_optimized_code_and_tailcall); | |
1349 | |
1350 __ bind(&try_shared); | |
1351 // Is the full code valid? | |
1352 __ LoadP(entry, | |
1353 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | |
1354 __ LoadP(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); | |
1355 __ LoadlW(r7, FieldMemOperand(entry, Code::kFlagsOffset)); | |
1356 __ DecodeField<Code::KindField>(r7); | |
1357 __ CmpP(r7, Operand(Code::BUILTIN)); | |
1358 __ beq(&gotta_call_runtime); | |
1359 // Yes, install the full code. | |
1360 __ AddP(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
1361 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); | |
1362 __ RecordWriteCodeEntryField(closure, entry, r7); | |
1363 __ JumpToJSEntry(entry); | |
1364 | |
1365 __ bind(&gotta_call_runtime); | |
1226 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); | 1366 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
1227 } | 1367 } |
1228 | 1368 |
1229 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1369 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1230 GenerateTailCallToReturnedCode(masm, | 1370 GenerateTailCallToReturnedCode(masm, |
1231 Runtime::kCompileOptimized_NotConcurrent); | 1371 Runtime::kCompileOptimized_NotConcurrent); |
1232 } | 1372 } |
1233 | 1373 |
1234 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1374 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1235 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1375 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2669 __ bkpt(0); | 2809 __ bkpt(0); |
2670 } | 2810 } |
2671 } | 2811 } |
2672 | 2812 |
2673 #undef __ | 2813 #undef __ |
2674 | 2814 |
2675 } // namespace internal | 2815 } // namespace internal |
2676 } // namespace v8 | 2816 } // namespace v8 |
2677 | 2817 |
2678 #endif // V8_TARGET_ARCH_S390 | 2818 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |