diff options
author | 2023-08-10 19:55:14 -0700 | |
---|---|---|
committer | 2023-08-10 19:56:02 -0700 | |
commit | 99af827f25bc051061a07b162b812884d6106a9a (patch) | |
tree | ab8c7ba6f1ac6e49c90eeeedf9935fe5309ec2fb | |
parent | a6ec7fe9b17bc270108eb12d8b97aa4a02bfbe09 (diff) | |
download | bun-99af827f25bc051061a07b162b812884d6106a9a.tar.gz bun-99af827f25bc051061a07b162b812884d6106a9a.tar.zst bun-99af827f25bc051061a07b162b812884d6106a9a.zip |
More lazily initialize these static strings
-rw-r--r-- | src/bun.js/bindings/ErrorStackTrace.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bun.js/bindings/ErrorStackTrace.cpp b/src/bun.js/bindings/ErrorStackTrace.cpp index 59e0e765b..a8c5b65d8 100644 --- a/src/bun.js/bindings/ErrorStackTrace.cpp +++ b/src/bun.js/bindings/ErrorStackTrace.cpp @@ -213,10 +213,11 @@ JSCStackFrame::SourcePositions* JSCStackFrame::getSourcePositions() return (SourcePositionsState::Calculated == m_sourcePositionsState) ? &m_sourcePositions : nullptr; } -static auto sourceURLWasmString = MAKE_STATIC_STRING_IMPL("[wasm code]"); -static auto sourceURLNativeString = MAKE_STATIC_STRING_IMPL("[native code]"); ALWAYS_INLINE JSC::JSString* JSCStackFrame::retrieveSourceURL() { + static auto sourceURLWasmString = MAKE_STATIC_STRING_IMPL("[wasm code]"); + static auto sourceURLNativeString = MAKE_STATIC_STRING_IMPL("[native code]"); + if (m_isWasmFrame) { return jsOwnedString(m_vm, sourceURLWasmString); } @@ -229,11 +230,12 @@ ALWAYS_INLINE JSC::JSString* JSCStackFrame::retrieveSourceURL() return sourceURL.isNull() ? m_vm.smallStrings.emptyString() : JSC::jsString(m_vm, sourceURL); } -static auto functionNameEvalCodeString = MAKE_STATIC_STRING_IMPL("eval code"); -static auto functionNameModuleCodeString = MAKE_STATIC_STRING_IMPL("module code"); -static auto functionNameGlobalCodeString = MAKE_STATIC_STRING_IMPL("global code"); ALWAYS_INLINE JSC::JSString* JSCStackFrame::retrieveFunctionName() { + static auto functionNameEvalCodeString = MAKE_STATIC_STRING_IMPL("eval code"); + static auto functionNameModuleCodeString = MAKE_STATIC_STRING_IMPL("module code"); + static auto functionNameGlobalCodeString = MAKE_STATIC_STRING_IMPL("global code"); + if (m_isWasmFrame) { return jsString(m_vm, JSC::Wasm::makeString(m_wasmFunctionIndexOrName)); } |