mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibJS: Make $262.evalScript() work in bytecode mode
29 new passes on test262. :^)
This commit is contained in:
parent
1932f7e6b6
commit
77f1e91e9d
Notes:
sideshowbarker
2024-07-17 06:29:49 +09:00
Author: https://github.com/awesomekling
Commit: 77f1e91e9d
Pull-request: https://github.com/SerenityOS/serenity/pull/19627
1 changed files with 7 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/TypeCasts.h>
|
||||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Contrib/Test262/$262Object.h>
|
||||
#include <LibJS/Contrib/Test262/AgentObject.h>
|
||||
#include <LibJS/Contrib/Test262/GlobalObject.h>
|
||||
|
@ -102,7 +103,12 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::eval_script)
|
|||
}
|
||||
|
||||
// 5. Let status be ScriptEvaluation(s).
|
||||
auto status = vm.interpreter().run(script_or_error.value());
|
||||
auto status = [&] {
|
||||
if (auto* bytecode_interpreter = vm.bytecode_interpreter_if_exists())
|
||||
return bytecode_interpreter->run(script_or_error.value());
|
||||
else
|
||||
return vm.interpreter().run(script_or_error.value());
|
||||
}();
|
||||
|
||||
// 6. Return Completion(status).
|
||||
return status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue