summaryrefslogtreecommitdiffstats
path: root/js/src/jit
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit')
-rw-r--r--js/src/jit/BaselineCompiler.cpp25
-rw-r--r--js/src/jit/BaselineCompiler.h1
-rw-r--r--js/src/jit/CodeGenerator.cpp14
-rw-r--r--js/src/jit/CodeGenerator.h1
-rw-r--r--js/src/jit/IonBuilder.cpp18
-rw-r--r--js/src/jit/IonBuilder.h1
-rw-r--r--js/src/jit/Lowering.cpp12
-rw-r--r--js/src/jit/Lowering.h1
-rw-r--r--js/src/jit/MIR.h28
-rw-r--r--js/src/jit/MOpcodes.h1
-rw-r--r--js/src/jit/shared/LIR-shared.h19
-rw-r--r--js/src/jit/shared/LOpcodes-shared.h1
12 files changed, 122 insertions, 0 deletions
diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp
index c58367aa3..4dcc10b61 100644
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -9,6 +9,8 @@
#include "mozilla/Casting.h"
#include "mozilla/SizePrintfMacros.h"
+#include "jsfun.h"
+
#include "jit/BaselineIC.h"
#include "jit/BaselineJIT.h"
#include "jit/FixedList.h"
@@ -1681,6 +1683,29 @@ BaselineCompiler::emit_JSOP_LAMBDA_ARROW()
return true;
}
+typedef bool (*SetFunNameFn)(JSContext*, HandleFunction, HandleValue, FunctionPrefixKind);
+static const VMFunction SetFunNameInfo =
+ FunctionInfo<SetFunNameFn>(js::SetFunctionNameIfNoOwnName, "SetFunName");
+
+bool
+BaselineCompiler::emit_JSOP_SETFUNNAME()
+{
+ frame.popRegsAndSync(2);
+
+ frame.push(R0);
+ frame.syncStack(0);
+
+ FunctionPrefixKind prefixKind = FunctionPrefixKind(GET_UINT8(pc));
+ masm.unboxObject(R0, R0.scratchReg());
+
+ prepareVMCall();
+
+ pushArg(Imm32(int32_t(prefixKind)));
+ pushArg(R1);
+ pushArg(R0.scratchReg());
+ return callVM(SetFunNameInfo);
+}
+
void
BaselineCompiler::storeValue(const StackValue* source, const Address& dest,
const ValueOperand& scratch)
diff --git a/js/src/jit/BaselineCompiler.h b/js/src/jit/BaselineCompiler.h
index 9adf65c27..77f4dd005 100644
--- a/js/src/jit/BaselineCompiler.h
+++ b/js/src/jit/BaselineCompiler.h
@@ -71,6 +71,7 @@ namespace jit {
_(JSOP_REGEXP) \
_(JSOP_LAMBDA) \
_(JSOP_LAMBDA_ARROW) \
+ _(JSOP_SETFUNNAME) \
_(JSOP_BITOR) \
_(JSOP_BITXOR) \
_(JSOP_BITAND) \
diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp
index ce97363be..3b5ec6baa 100644
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -2548,6 +2548,20 @@ CodeGenerator::emitLambdaInit(Register output, Register envChain,
masm.storePtr(ImmGCPtr(info.fun->displayAtom()), Address(output, JSFunction::offsetOfAtom()));
}
+typedef bool (*SetFunNameFn)(JSContext*, HandleFunction, HandleValue, FunctionPrefixKind);
+static const VMFunction SetFunNameInfo =
+ FunctionInfo<SetFunNameFn>(js::SetFunctionNameIfNoOwnName, "SetFunName");
+
+void
+CodeGenerator::visitSetFunName(LSetFunName* lir)
+{
+ pushArg(Imm32(lir->mir()->prefixKind()));
+ pushArg(ToValue(lir, LSetFunName::NameValue));
+ pushArg(ToRegister(lir->fun()));
+
+ callVM(SetFunNameInfo, lir);
+}
+
void
CodeGenerator::visitOsiPoint(LOsiPoint* lir)
{
diff --git a/js/src/jit/CodeGenerator.h b/js/src/jit/CodeGenerator.h
index 8f4bcc813..b69e919a3 100644
--- a/js/src/jit/CodeGenerator.h
+++ b/js/src/jit/CodeGenerator.h
@@ -134,6 +134,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
void visitOutOfLineLambdaArrow(OutOfLineLambdaArrow* ool);
void visitLambdaArrow(LLambdaArrow* lir);
void visitLambdaForSingleton(LLambdaForSingleton* lir);
+ void visitSetFunName(LSetFunName* lir);
void visitPointer(LPointer* lir);
void visitKeepAliveObject(LKeepAliveObject* lir);
void visitSlots(LSlots* lir);
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index 1488d7d34..2e7784ff4 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -2122,6 +2122,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_LAMBDA_ARROW:
return jsop_lambda_arrow(info().getFunction(pc));
+ case JSOP_SETFUNNAME:
+ return jsop_setfunname(GET_UINT8(pc));
+
case JSOP_ITER:
return jsop_iter(GET_INT8(pc));
@@ -13340,6 +13343,21 @@ IonBuilder::jsop_lambda_arrow(JSFunction* fun)
}
bool
+IonBuilder::jsop_setfunname(uint8_t prefixKind)
+{
+ MDefinition* name = current->pop();
+ MDefinition* fun = current->pop();
+ MOZ_ASSERT(fun->type() == MIRType::Object);
+
+ MSetFunName* ins = MSetFunName::New(alloc(), fun, name, prefixKind);
+
+ current->add(ins);
+ current->push(fun);
+
+ return resumeAfter(ins);
+}
+
+bool
IonBuilder::jsop_setarg(uint32_t arg)
{
// To handle this case, we should spill the arguments to the space where
diff --git a/js/src/jit/IonBuilder.h b/js/src/jit/IonBuilder.h
index 38647a88f..0d1bdb1e3 100644
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -766,6 +766,7 @@ class IonBuilder
MOZ_MUST_USE bool jsop_object(JSObject* obj);
MOZ_MUST_USE bool jsop_lambda(JSFunction* fun);
MOZ_MUST_USE bool jsop_lambda_arrow(JSFunction* fun);
+ MOZ_MUST_USE bool jsop_setfunname(uint8_t prefixKind);
MOZ_MUST_USE bool jsop_functionthis();
MOZ_MUST_USE bool jsop_globalthis();
MOZ_MUST_USE bool jsop_typeof();
diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp
index 13e50820e..a21a529be 100644
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -2460,6 +2460,18 @@ LIRGenerator::visitLambdaArrow(MLambdaArrow* ins)
}
void
+LIRGenerator::visitSetFunName(MSetFunName* ins)
+{
+ MOZ_ASSERT(ins->fun()->type() == MIRType::Object);
+ MOZ_ASSERT(ins->name()->type() == MIRType::Value);
+
+ LSetFunName* lir = new(alloc()) LSetFunName(useRegisterAtStart(ins->fun()),
+ useBoxAtStart(ins->name()));
+ add(lir, ins);
+ assignSafepoint(lir, ins);
+}
+
+void
LIRGenerator::visitKeepAliveObject(MKeepAliveObject* ins)
{
MDefinition* obj = ins->object();
diff --git a/js/src/jit/Lowering.h b/js/src/jit/Lowering.h
index 0f66a3c24..4062c0960 100644
--- a/js/src/jit/Lowering.h
+++ b/js/src/jit/Lowering.h
@@ -185,6 +185,7 @@ class LIRGenerator : public LIRGeneratorSpecific
void visitNullarySharedStub(MNullarySharedStub* ins);
void visitLambda(MLambda* ins);
void visitLambdaArrow(MLambdaArrow* ins);
+ void visitSetFunName(MSetFunName* ins);
void visitKeepAliveObject(MKeepAliveObject* ins);
void visitSlots(MSlots* ins);
void visitElements(MElements* ins);
diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
index dcb08c317..3caa7e357 100644
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -8464,6 +8464,34 @@ class MLambdaArrow
}
};
+class MSetFunName
+ : public MAryInstruction<2>,
+ public MixPolicy<ObjectPolicy<0>, BoxPolicy<1> >::Data
+{
+ uint8_t prefixKind_;
+
+ explicit MSetFunName(MDefinition* fun, MDefinition* name, uint8_t prefixKind)
+ : prefixKind_(prefixKind)
+ {
+ initOperand(0, fun);
+ initOperand(1, name);
+ setResultType(MIRType::None);
+ }
+
+ public:
+ INSTRUCTION_HEADER(SetFunName)
+ TRIVIAL_NEW_WRAPPERS
+ NAMED_OPERANDS((0, fun), (1, name))
+
+ uint8_t prefixKind() const {
+ return prefixKind_;
+ }
+
+ bool possiblyCalls() const override {
+ return true;
+ }
+};
+
// Returns obj->slots.
class MSlots
: public MUnaryInstruction,
diff --git a/js/src/jit/MOpcodes.h b/js/src/jit/MOpcodes.h
index 74594cb35..1a6911247 100644
--- a/js/src/jit/MOpcodes.h
+++ b/js/src/jit/MOpcodes.h
@@ -161,6 +161,7 @@ namespace jit {
_(StringReplace) \
_(Lambda) \
_(LambdaArrow) \
+ _(SetFunName) \
_(KeepAliveObject) \
_(Slots) \
_(Elements) \
diff --git a/js/src/jit/shared/LIR-shared.h b/js/src/jit/shared/LIR-shared.h
index a352f5d8a..f8e0ce9cc 100644
--- a/js/src/jit/shared/LIR-shared.h
+++ b/js/src/jit/shared/LIR-shared.h
@@ -4995,6 +4995,25 @@ class LLambdaArrow : public LInstructionHelper<1, 1 + BOX_PIECES, 0>
}
};
+class LSetFunName : public LCallInstructionHelper<1, 1 + BOX_PIECES, 0>
+{
+ public:
+ LIR_HEADER(SetFunName)
+
+ static const size_t NameValue = 1;
+
+ LSetFunName(const LAllocation& fun, const LBoxAllocation& name) {
+ setOperand(0, fun);
+ setBoxOperand(NameValue, name);
+ }
+ const LAllocation* fun() {
+ return getOperand(0);
+ }
+ const MSetFunName* mir() const {
+ return mir_->toSetFunName();
+ }
+};
+
class LKeepAliveObject : public LInstructionHelper<0, 1, 0>
{
public:
diff --git a/js/src/jit/shared/LOpcodes-shared.h b/js/src/jit/shared/LOpcodes-shared.h
index bb04553a6..e57751437 100644
--- a/js/src/jit/shared/LOpcodes-shared.h
+++ b/js/src/jit/shared/LOpcodes-shared.h
@@ -242,6 +242,7 @@
_(Lambda) \
_(LambdaArrow) \
_(LambdaForSingleton) \
+ _(SetFunName) \
_(KeepAliveObject) \
_(Slots) \
_(Elements) \