Changeset 233658 in webkit
- Timestamp:
- Jul 9, 2018 2:55:48 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r233657 r233658 1 2018-07-09 Mark Lam <mark.lam@apple.com> 2 3 Add --traceLLIntExecution and --traceLLIntSlowPath options. 4 https://bugs.webkit.org/show_bug.cgi?id=187479 5 6 Reviewed by Yusuke Suzuki and Saam Barati. 7 8 These options are only available if LLINT_TRACING is enabled in LLIntCommon.h. 9 10 The details: 11 1. LLINT_TRACING consolidates and replaces LLINT_EXECUTION_TRACING and LLINT_SLOW_PATH_TRACING. 12 2. Tracing is now guarded behind runtime options --traceLLIntExecution and --traceLLIntSlowPath. 13 This makes it such that enabling LLINT_TRACING doesn't means that we'll 14 continually spammed with logging until we rebuild. 15 3. Fixed slow path LLINT tracing to work with exception check validation. 16 17 * llint/LLIntCommon.h: 18 * llint/LLIntExceptions.cpp: 19 (JSC::LLInt::returnToThrow): 20 (JSC::LLInt::callToThrow): 21 * llint/LLIntOfflineAsmConfig.h: 22 * llint/LLIntSlowPaths.cpp: 23 (JSC::LLInt::slowPathLog): 24 (JSC::LLInt::slowPathLn): 25 (JSC::LLInt::slowPathLogF): 26 (JSC::LLInt::slowPathLogLn): 27 (JSC::LLInt::llint_trace_operand): 28 (JSC::LLInt::llint_trace_value): 29 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 30 (JSC::LLInt::traceFunctionPrologue): 31 (JSC::LLInt::handleHostCall): 32 (JSC::LLInt::setUpCall): 33 * llint/LLIntSlowPaths.h: 34 * llint/LowLevelInterpreter.asm: 35 * runtime/CommonSlowPathsExceptions.cpp: 36 (JSC::CommonSlowPaths::interpreterThrowInCaller): 37 * runtime/Options.cpp: 38 (JSC::Options::isAvailable): 39 * runtime/Options.h: 40 1 41 2018-07-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 42 -
trunk/Source/JavaScriptCore/llint/LLIntCommon.h
r229478 r233658 1 1 /* 2 * Copyright (C) 2012-201 3, 2016Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 // Print every instruction executed.29 #define LLINT_EXECUTION_TRACING 0 30 31 // Print some information for some of the more subtle slow paths.32 #define LLINT_ SLOW_PATH_TRACING 028 // Enables LLINT tracing. 29 // - Prints every instruction executed if Options::traceLLIntExecution() is enabled. 30 // - Prints some information for some of the more subtle slow paths if 31 // Options::traceLLIntSlowPath() is enabled. 32 #define LLINT_TRACING 0 33 33 34 34 // Disable inline allocation in the interpreter. This is great if you're changing -
trunk/Source/JavaScriptCore/llint/LLIntExceptions.cpp
r230865 r233658 34 34 #include "JSCInlines.h" 35 35 36 #if LLINT_ SLOW_PATH_TRACING36 #if LLINT_TRACING 37 37 #include "Exception.h" 38 38 #endif … … 43 43 { 44 44 UNUSED_PARAM(exec); 45 #if LLINT_SLOW_PATH_TRACING 46 VM* vm = &exec->vm(); 47 auto scope = DECLARE_THROW_SCOPE(*vm); 48 dataLog("Throwing exception ", JSValue(scope.exception()), " (returnToThrow).\n"); 45 #if LLINT_TRACING 46 if (UNLIKELY(Options::traceLLIntSlowPath())) { 47 VM* vm = &exec->vm(); 48 auto scope = DECLARE_CATCH_SCOPE(*vm); 49 dataLog("Throwing exception ", JSValue(scope.exception()), " (returnToThrow).\n"); 50 } 49 51 #endif 50 52 return LLInt::exceptionInstructions(); … … 54 56 { 55 57 UNUSED_PARAM(exec); 56 #if LLINT_SLOW_PATH_TRACING 57 VM* vm = &exec->vm(); 58 auto scope = DECLARE_THROW_SCOPE(*vm); 59 dataLog("Throwing exception ", JSValue(scope.exception()), " (callToThrow).\n"); 58 #if LLINT_TRACING 59 if (UNLIKELY(Options::traceLLIntSlowPath())) { 60 VM* vm = &exec->vm(); 61 auto scope = DECLARE_CATCH_SCOPE(*vm); 62 dataLog("Throwing exception ", JSValue(scope.exception()), " (callToThrow).\n"); 63 } 60 64 #endif 61 65 return LLInt::getCodePtr<ExceptionHandlerPtrTag>(llint_throw_during_call_trampoline).executableAddress(); -
trunk/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
r229482 r233658 164 164 #endif 165 165 166 #if LLINT_ EXECUTION_TRACING167 #define OFFLINE_ASM_ EXECUTION_TRACING 1166 #if LLINT_TRACING 167 #define OFFLINE_ASM_TRACING 1 168 168 #else 169 #define OFFLINE_ASM_ EXECUTION_TRACING 0169 #define OFFLINE_ASM_TRACING 0 170 170 #endif 171 171 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r233657 r233658 189 189 LLINT_RETURN_TWO(pc, __rcf_exec); \ 190 190 } while (false) 191 191 192 #if LLINT_TRACING 193 194 template<typename... Types> 195 void slowPathLog(const Types&... values) 196 { 197 dataLogIf(Options::traceLLIntSlowPath(), values...); 198 } 199 200 template<typename... Types> 201 void slowPathLn(const Types&... values) 202 { 203 dataLogLnIf(Options::traceLLIntSlowPath(), values...); 204 } 205 206 template<typename... Types> 207 void slowPathLogF(const char* format, const Types&... values) 208 { 209 #if COMPILER(GCC_OR_CLANG) 210 #pragma GCC diagnostic push 211 #pragma GCC diagnostic ignored "-Wformat-nonliteral" 212 #pragma GCC diagnostic ignored "-Wformat-security" 213 #endif 214 if (Options::traceLLIntSlowPath()) 215 dataLogF(format, values...); 216 #if COMPILER(GCC_OR_CLANG) 217 #pragma GCC diagnostic pop 218 #endif 219 } 220 221 #else // not LLINT_TRACING 222 223 template<typename... Types> void slowPathLog(const Types&...) { } 224 template<typename... Types> void slowPathLogLn(const Types&...) { } 225 template<typename... Types> void slowPathLogF(const char*, const Types&...) { } 226 227 #endif // LLINT_TRACING 228 192 229 extern "C" SlowPathReturnType llint_trace_operand(ExecState* exec, Instruction* pc, int fromWhere, int operand) 193 230 { 231 if (!Options::traceLLIntExecution()) 232 LLINT_END_IMPL(); 233 194 234 LLINT_BEGIN(); 195 235 dataLogF("<%p> %p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d\n", … … 207 247 extern "C" SlowPathReturnType llint_trace_value(ExecState* exec, Instruction* pc, int fromWhere, int operand) 208 248 { 249 if (!Options::traceLLIntExecution()) 250 LLINT_END_IMPL(); 251 209 252 JSValue value = LLINT_OP_C(operand).jsValue(); 210 253 union { … … 234 277 LLINT_SLOW_PATH_DECL(trace_prologue) 235 278 { 279 if (!Options::traceLLIntExecution()) 280 LLINT_END_IMPL(); 281 236 282 dataLogF("<%p> %p / %p: in prologue of ", &Thread::current(), exec->codeBlock(), exec); 237 dataLog( *exec->codeBlock(), "\n");283 dataLog(exec->codeBlock(), "\n"); 238 284 LLINT_END_IMPL(); 239 285 } … … 241 287 static void traceFunctionPrologue(ExecState* exec, const char* comment, CodeSpecializationKind kind) 242 288 { 289 if (!Options::traceLLIntExecution()) 290 return; 291 243 292 JSFunction* callee = jsCast<JSFunction*>(exec->jsCallee()); 244 293 FunctionExecutable* executable = callee->jsExecutable(); 245 294 CodeBlock* codeBlock = executable->codeBlockFor(kind); 246 295 dataLogF("<%p> %p / %p: in %s of ", &Thread::current(), codeBlock, exec, comment); 247 dataLog( *codeBlock);296 dataLog(codeBlock); 248 297 dataLogF(" function %p, executable %p; numVars = %u, numParameters = %u, numCalleeLocals = %u, caller = %p.\n", 249 298 callee, executable, codeBlock->numVars(), codeBlock->numParameters(), codeBlock->numCalleeLocals(), exec->callerFrame()); … … 276 325 LLINT_SLOW_PATH_DECL(trace) 277 326 { 327 if (!Options::traceLLIntExecution()) 328 LLINT_END_IMPL(); 329 278 330 OpcodeID opcodeID = Interpreter::getOpcodeID(pc[0].u.opcode); 279 331 dataLogF("<%p> %p / %p: executing bc#%zu, %s, pc = %p\n", … … 294 346 } 295 347 296 LLINT_SLOW_PATH_DECL(special_trace)297 {298 dataLogF("<%p> %p / %p: executing special case bc#%zu, op#%u, return PC is %p\n",299 &Thread::current(),300 exec->codeBlock(),301 exec,302 static_cast<intptr_t>(exec->codeBlock()->bytecodeOffset(pc)),303 Interpreter::getOpcodeID(pc[0].u.opcode),304 exec->returnPC().value());305 LLINT_END_IMPL();306 }307 308 348 enum EntryKind { Prologue, ArityCheck }; 309 349 … … 496 536 LLINT_SET_PC_FOR_STUBS(); 497 537 498 #if LLINT_SLOW_PATH_TRACING 499 dataLogF("Checking stack height with exec = %p.\n", exec); 500 dataLog("CodeBlock = ", *exec->codeBlock(), "\n"); 501 dataLogF("Num callee registers = %u.\n", exec->codeBlock()->numCalleeLocals()); 502 dataLogF("Num vars = %u.\n", exec->codeBlock()->numVars()); 503 504 dataLogF("Current OS stack end is at %p.\n", vm.softStackLimit()); 538 CodeBlock* codeBlock = exec->codeBlock(); 539 slowPathLogF("Checking stack height with exec = %p.\n", exec); 540 slowPathLog("CodeBlock = ", codeBlock, "\n"); 541 if (codeBlock) { 542 slowPathLogF("Num callee registers = %u.\n", codeBlock->numCalleeLocals()); 543 slowPathLogF("Num vars = %u.\n", codeBlock->numVars()); 544 } 545 slowPathLogF("Current OS stack end is at %p.\n", vm.softStackLimit()); 505 546 #if !ENABLE(JIT) 506 dataLogF("Current C Loop stack end is at %p.\n", vm.cloopStackLimit());547 slowPathLogF("Current C Loop stack end is at %p.\n", vm.cloopStackLimit()); 507 548 #endif 508 549 509 #endif510 550 // If the stack check succeeds and we don't need to throw the error, then 511 551 // we'll return 0 instead. The prologue will check for a non-zero value … … 1263 1303 CodeBlock* codeBlock = exec->codeBlock(); 1264 1304 JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope(); 1265 #if LLINT_SLOW_PATH_TRACING 1266 dataLogF("Creating function!\n"); 1267 #endif 1305 slowPathLogF("Creating function!\n"); 1268 1306 LLINT_RETURN(JSFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope)); 1269 1307 } … … 1274 1312 CodeBlock* codeBlock = exec->codeBlock(); 1275 1313 JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope(); 1276 #if LLINT_SLOW_PATH_TRACING 1277 dataLogF("Creating function!\n"); 1278 #endif 1314 slowPathLogF("Creating function!\n"); 1279 1315 LLINT_RETURN(JSGeneratorFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope)); 1280 1316 } … … 1285 1321 CodeBlock* codeBlock = exec->codeBlock(); 1286 1322 JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope(); 1287 #if LLINT_SLOW_PATH_TRACING 1288 dataLogF("Creating async function!\n"); 1289 #endif 1323 slowPathLogF("Creating async function!\n"); 1290 1324 LLINT_RETURN(JSAsyncFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope)); 1291 1325 } … … 1296 1330 CodeBlock* codeBlock = exec->codeBlock(); 1297 1331 JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope(); 1298 #if LLINT_SLOW_PATH_TRACING 1299 dataLogF("Creating async generator function!\n"); 1300 #endif 1332 slowPathLogF("Creating async generator function!\n"); 1301 1333 LLINT_RETURN(JSAsyncGeneratorFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope)); 1302 1334 } … … 1359 1391 UNUSED_PARAM(pc); 1360 1392 1361 #if LLINT_SLOW_PATH_TRACING 1362 dataLog("Performing host call.\n"); 1363 #endif 1393 slowPathLog("Performing host call.\n"); 1364 1394 1365 1395 ExecState* exec = execCallee->callerFrame(); … … 1385 1415 } 1386 1416 1387 #if LLINT_SLOW_PATH_TRACING 1388 dataLog("Call callee is not a function: ", callee, "\n"); 1389 #endif 1417 slowPathLog("Call callee is not a function: ", callee, "\n"); 1390 1418 1391 1419 ASSERT(callType == CallType::None); … … 1409 1437 } 1410 1438 1411 #if LLINT_SLOW_PATH_TRACING 1412 dataLog("Constructor callee is not a function: ", callee, "\n"); 1413 #endif 1439 slowPathLog("Constructor callee is not a function: ", callee, "\n"); 1414 1440 1415 1441 ASSERT(constructType == ConstructType::None); … … 1423 1449 auto throwScope = DECLARE_THROW_SCOPE(vm); 1424 1450 1425 #if LLINT_SLOW_PATH_TRACING 1426 dataLogF("Performing call with recorded PC = %p\n", exec->currentVPC()); 1427 #endif 1451 slowPathLogF("Performing call with recorded PC = %p\n", exec->currentVPC()); 1428 1452 1429 1453 JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h
r230376 r233658 1 1 /* 2 * Copyright (C) 2011-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 LLINT_SLOW_PATH_HIDDEN_DECL(trace_arityCheck_for_construct); 54 54 LLINT_SLOW_PATH_HIDDEN_DECL(trace); 55 LLINT_SLOW_PATH_HIDDEN_DECL(special_trace);56 55 LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr); 57 56 LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr_function_for_call); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r232658 r233658 840 840 841 841 macro traceExecution() 842 if EXECUTION_TRACING842 if TRACING 843 843 callSlowPath(_llint_trace) 844 844 end … … 1007 1007 preserveCallerPCAndCFR() 1008 1008 1009 if EXECUTION_TRACING1009 if TRACING 1010 1010 subp maxFrameExtentForSlowPathCall, sp 1011 1011 callSlowPath(traceSlowPath) -
trunk/Source/JavaScriptCore/runtime/CommonSlowPathsExceptions.cpp
r218794 r233658 35 35 #include "JSCInlines.h" 36 36 37 #if LLINT_ SLOW_PATH_TRACING37 #if LLINT_TRACING 38 38 #include "Exception.h" 39 39 #endif … … 48 48 49 49 throwException(exec, scope, error); 50 #if LLINT_SLOW_PATH_TRACING 51 dataLog("Throwing exception ", JSValue(scope.exception()), ".\n"); 50 #if LLINT_TRACING 51 if (UNLIKELY(Options::traceLLIntSlowPath())) 52 dataLog("Throwing exception ", JSValue(scope.exception()), ".\n"); 52 53 #endif 53 54 } -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r232733 r233658 28 28 29 29 #include "AssemblerCommon.h" 30 #include "LLIntCommon.h" 30 31 #include "MinimumReservedZoneSize.h" 31 32 #include "SigillCrashAnalyzer.h" … … 159 160 return true; 160 161 #endif 162 if (id == traceLLIntExecutionID) 163 return !!LLINT_TRACING; 164 if (id == traceLLIntSlowPathID) 165 return !!LLINT_TRACING; 161 166 return false; 162 167 } -
trunk/Source/JavaScriptCore/runtime/Options.h
r233378 r233658 514 514 v(bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \ 515 515 v(bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \ 516 v(bool, useTracePoints, false, Normal, nullptr) 516 v(bool, useTracePoints, false, Normal, nullptr) \ 517 v(bool, traceLLIntExecution, false, Configurable, nullptr) \ 518 v(bool, traceLLIntSlowPath, false, Configurable, nullptr) \ 517 519 518 520
Note: See TracChangeset
for help on using the changeset viewer.