mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:47:35 +00:00
LibJS: Make $262.evalScript() work in bytecode mode
29 new passes on test262. :^)
This commit is contained in:
parent
1932f7e6b6
commit
77f1e91e9d
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