Bug 1331092 - Part 6: Support JSOP_TOASYNCGEN in JIT.

Tag #1287
This commit is contained in:
Gaming4JC 2019-12-14 09:13:04 -05:00 committed by Roy Tam
commit 67b8cd621a
12 changed files with 94 additions and 0 deletions

View file

@ -25,6 +25,7 @@
#include "jit/VMFunctions.h"
#include "js/UniquePtr.h"
#include "vm/AsyncFunction.h"
#include "vm/AsyncIteration.h"
#include "vm/EnvironmentObject.h"
#include "vm/Interpreter.h"
#include "vm/TraceLogging.h"
@ -3914,6 +3915,28 @@ BaselineCompiler::emit_JSOP_TOASYNC()
return true;
}
typedef JSObject* (*ToAsyncGenFn)(JSContext*, HandleFunction);
static const VMFunction ToAsyncGenInfo =
FunctionInfo<ToAsyncGenFn>(js::WrapAsyncGenerator, "ToAsyncGen");
bool
BaselineCompiler::emit_JSOP_TOASYNCGEN()
{
frame.syncStack(0);
masm.unboxObject(frame.addressOfStackValue(frame.peek(-1)), R0.scratchReg());
prepareVMCall();
pushArg(R0.scratchReg());
if (!callVM(ToAsyncGenInfo))
return false;
masm.tagValue(JSVAL_TYPE_OBJECT, ReturnReg, R0);
frame.pop();
frame.push(R0);
return true;
}
typedef bool (*ThrowObjectCoercibleFn)(JSContext*, HandleValue);
static const VMFunction ThrowObjectCoercibleInfo =
FunctionInfo<ThrowObjectCoercibleFn>(ThrowObjectCoercible, "ThrowObjectCoercible");