зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1522837 part 12 - Support JSOP_NEWARRAY and JSOP_INITELEM_ARRAY in BaselineCodeGen. r=djvj
Differential Revision: https://phabricator.services.mozilla.com/D19173 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e554148a4e
Коммит
84f0267fa7
|
@ -909,6 +909,39 @@ void BaselineInterpreterCodeGen::loadResumeIndexBytecodeOperand(Register dest) {
|
|||
MOZ_CRASH("NYI: interpreter loadResumeIndexBytecodeOperand");
|
||||
}
|
||||
|
||||
template <>
|
||||
void BaselineCompilerCodeGen::loadInt32LengthBytecodeOperand(Register dest) {
|
||||
uint32_t length = GET_UINT32(handler.pc());
|
||||
MOZ_ASSERT(length <= INT32_MAX,
|
||||
"the bytecode emitter must fail to compile code that would "
|
||||
"produce a length exceeding int32_t range");
|
||||
masm.move32(Imm32(AssertedCast<int32_t>(length)), dest);
|
||||
}
|
||||
|
||||
template <>
|
||||
void BaselineInterpreterCodeGen::loadInt32LengthBytecodeOperand(Register dest) {
|
||||
masm.loadPtr(frame.addressOfInterpreterPC(), dest);
|
||||
LoadInt32Operand(masm, dest, dest);
|
||||
}
|
||||
|
||||
template <>
|
||||
void BaselineCompilerCodeGen::loadInt32IndexBytecodeOperand(ValueOperand dest) {
|
||||
uint32_t index = GET_UINT32(handler.pc());
|
||||
MOZ_ASSERT(index <= INT32_MAX,
|
||||
"the bytecode emitter must fail to compile code that would "
|
||||
"produce an index exceeding int32_t range");
|
||||
masm.moveValue(Int32Value(AssertedCast<int32_t>(index)), dest);
|
||||
}
|
||||
|
||||
template <>
|
||||
void BaselineInterpreterCodeGen::loadInt32IndexBytecodeOperand(
|
||||
ValueOperand dest) {
|
||||
Register scratch = dest.scratchReg();
|
||||
masm.loadPtr(frame.addressOfInterpreterPC(), scratch);
|
||||
LoadInt32Operand(masm, scratch, scratch);
|
||||
masm.tagValue(JSVAL_TYPE_INT32, scratch, dest);
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emitDebugPrologue() {
|
||||
auto ifDebuggee = [this]() {
|
||||
|
@ -2513,17 +2546,12 @@ bool BaselineCodeGen<Handler>::emit_JSOP_LINENO() {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool BaselineCompilerCodeGen::emit_JSOP_NEWARRAY() {
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emit_JSOP_NEWARRAY() {
|
||||
frame.syncStack(0);
|
||||
|
||||
uint32_t length = GET_UINT32(handler.pc());
|
||||
MOZ_ASSERT(length <= INT32_MAX,
|
||||
"the bytecode emitter must fail to compile code that would "
|
||||
"produce JSOP_NEWARRAY with a length exceeding int32_t range");
|
||||
|
||||
// Pass length in R0.
|
||||
masm.move32(Imm32(AssertedCast<int32_t>(length)), R0.scratchReg());
|
||||
loadInt32LengthBytecodeOperand(R0.scratchReg());
|
||||
|
||||
if (!emitNextIC()) {
|
||||
return false;
|
||||
|
@ -2533,11 +2561,6 @@ bool BaselineCompilerCodeGen::emit_JSOP_NEWARRAY() {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool BaselineInterpreterCodeGen::emit_JSOP_NEWARRAY() {
|
||||
MOZ_CRASH("NYI: interpreter JSOP_NEWARRAY");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool BaselineCompilerCodeGen::emit_JSOP_NEWARRAY_COPYONWRITE() {
|
||||
// This is like the interpreter implementation, but we can call
|
||||
|
@ -2583,19 +2606,14 @@ bool BaselineInterpreterCodeGen::emit_JSOP_NEWARRAY_COPYONWRITE() {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool BaselineCompilerCodeGen::emit_JSOP_INITELEM_ARRAY() {
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emit_JSOP_INITELEM_ARRAY() {
|
||||
// Keep the object and rhs on the stack.
|
||||
frame.syncStack(0);
|
||||
|
||||
// Load object in R0, index in R1.
|
||||
masm.loadValue(frame.addressOfStackValue(-2), R0);
|
||||
uint32_t index = GET_UINT32(handler.pc());
|
||||
MOZ_ASSERT(index <= INT32_MAX,
|
||||
"the bytecode emitter must fail to compile code that would "
|
||||
"produce JSOP_INITELEM_ARRAY with a length exceeding "
|
||||
"int32_t range");
|
||||
masm.moveValue(Int32Value(AssertedCast<int32_t>(index)), R1);
|
||||
loadInt32IndexBytecodeOperand(R1);
|
||||
|
||||
// Call IC.
|
||||
if (!emitNextIC()) {
|
||||
|
@ -2607,11 +2625,6 @@ bool BaselineCompilerCodeGen::emit_JSOP_INITELEM_ARRAY() {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool BaselineInterpreterCodeGen::emit_JSOP_INITELEM_ARRAY() {
|
||||
MOZ_CRASH("NYI: interpreter JSOP_INITELEM_ARRAY");
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
bool BaselineCodeGen<Handler>::emit_JSOP_NEWOBJECT() {
|
||||
frame.syncStack(0);
|
||||
|
|
|
@ -321,6 +321,8 @@ class BaselineCodeGen {
|
|||
void pushUint16BytecodeOperandArg();
|
||||
|
||||
void loadResumeIndexBytecodeOperand(Register dest);
|
||||
void loadInt32LengthBytecodeOperand(Register dest);
|
||||
void loadInt32IndexBytecodeOperand(ValueOperand dest);
|
||||
|
||||
// Loads the current JSScript* in dest.
|
||||
void loadScript(Register dest);
|
||||
|
|
Загрузка…
Ссылка в новой задаче