mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:47:43 +00:00
LibJS: Remove accidentally-committed bytecode caching
This was a hack cache I got from Luke, not ready for prime-time :^)
This commit is contained in:
parent
1cdbfc2ff1
commit
4f8e915ef8
1 changed files with 8 additions and 16 deletions
|
@ -1153,8 +1153,6 @@ template void async_function_start(VM&, PromiseCapability const&, NonnullRefPtr<
|
||||||
template void async_block_start(VM&, SafeFunction<Completion()> const& async_body, PromiseCapability const&, ExecutionContext&);
|
template void async_block_start(VM&, SafeFunction<Completion()> const& async_body, PromiseCapability const&, ExecutionContext&);
|
||||||
template void async_function_start(VM&, PromiseCapability const&, SafeFunction<Completion()> const& async_function_body);
|
template void async_function_start(VM&, PromiseCapability const&, SafeFunction<Completion()> const& async_function_body);
|
||||||
|
|
||||||
static HashMap<NonnullRefPtr<Statement const>, RefPtr<Bytecode::Executable>> executable_cache;
|
|
||||||
|
|
||||||
// 10.2.1.4 OrdinaryCallEvaluateBody ( F, argumentsList ), https://tc39.es/ecma262/#sec-ordinarycallevaluatebody
|
// 10.2.1.4 OrdinaryCallEvaluateBody ( F, argumentsList ), https://tc39.es/ecma262/#sec-ordinarycallevaluatebody
|
||||||
// 15.8.4 Runtime Semantics: EvaluateAsyncFunctionBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatefunctionbody
|
// 15.8.4 Runtime Semantics: EvaluateAsyncFunctionBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatefunctionbody
|
||||||
Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
||||||
|
@ -1168,18 +1166,14 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
||||||
// This is why FunctionDeclarationInstantiation is invoked in the middle.
|
// This is why FunctionDeclarationInstantiation is invoked in the middle.
|
||||||
// The issue is that FunctionDeclarationInstantiation may mark certain functions as hoisted
|
// The issue is that FunctionDeclarationInstantiation may mark certain functions as hoisted
|
||||||
// per Annex B. This affects code generation for FunctionDeclaration nodes.
|
// per Annex B. This affects code generation for FunctionDeclaration nodes.
|
||||||
|
|
||||||
if (!m_bytecode_executable) {
|
if (!m_bytecode_executable) {
|
||||||
auto maybe_cached_executable = executable_cache.get(m_ecmascript_code);
|
size_t default_parameter_index = 0;
|
||||||
if (maybe_cached_executable.has_value()) {
|
for (auto& parameter : m_formal_parameters) {
|
||||||
m_bytecode_executable = maybe_cached_executable.value();
|
if (!parameter.default_value)
|
||||||
} else {
|
continue;
|
||||||
size_t default_parameter_index = 0;
|
auto executable = TRY(Bytecode::compile(vm, *parameter.default_value, FunctionKind::Normal, DeprecatedString::formatted("default parameter #{} for {}", default_parameter_index, m_name)));
|
||||||
for (auto& parameter : m_formal_parameters) {
|
m_default_parameter_bytecode_executables.append(move(executable));
|
||||||
if (!parameter.default_value)
|
|
||||||
continue;
|
|
||||||
auto executable = TRY(Bytecode::compile(vm, *parameter.default_value, FunctionKind::Normal, DeprecatedString::formatted("default parameter #{} for {}", default_parameter_index, m_name)));
|
|
||||||
m_default_parameter_bytecode_executables.append(move(executable));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1190,10 +1184,8 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
||||||
return declaration_result.release_error();
|
return declaration_result.release_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_bytecode_executable) {
|
if (!m_bytecode_executable)
|
||||||
m_bytecode_executable = TRY(Bytecode::compile(vm, *m_ecmascript_code, m_kind, m_name));
|
m_bytecode_executable = TRY(Bytecode::compile(vm, *m_ecmascript_code, m_kind, m_name));
|
||||||
executable_cache.set(m_ecmascript_code, m_bytecode_executable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_kind == FunctionKind::Async) {
|
if (m_kind == FunctionKind::Async) {
|
||||||
if (declaration_result.is_throw_completion()) {
|
if (declaration_result.is_throw_completion()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue