Bug 1282976 - Part 13: Remove new.target access from frame classes. r=jandem

Depends on D142806

Differential Revision: https://phabricator.services.mozilla.com/D142835
This commit is contained in:
André Bargull 2022-04-04 18:31:19 +00:00
Родитель 7919564686
Коммит 913b8a3a78
8 изменённых файлов: 3 добавлений и 63 удалений

Просмотреть файл

@ -193,17 +193,6 @@ class BaselineFrame {
ArrayObject* dest) const;
public:
Value newTarget() const {
MOZ_ASSERT(isFunctionFrame());
MOZ_ASSERT(!callee()->isArrow());
if (isConstructing()) {
return *(Value*)(reinterpret_cast<const uint8_t*>(this) +
BaselineFrame::Size() +
offsetOfArg(std::max(numFormalArgs(), numActualArgs())));
}
return UndefinedValue();
}
void prepareForBaselineInterpreterToJitOSR() {
// Clearing the RUNNING_IN_INTERPRETER flag is sufficient, but we also null
// out the interpreter fields to ensure we don't use stale values.

Просмотреть файл

@ -682,8 +682,7 @@ class InlineFrameIterator {
void readFrameArgsAndLocals(JSContext* cx, ArgOp& argOp, LocalOp& localOp,
JSObject** envChain, bool* hasInitialEnv,
Value* rval, ArgumentsObject** argsObj,
Value* thisv, Value* newTarget,
ReadFrameArgsBehavior behavior,
Value* thisv, ReadFrameArgsBehavior behavior,
MaybeReadFallback& fallback) const {
SnapshotIterator s(si_);
@ -703,13 +702,6 @@ class InlineFrameIterator {
s.skip();
}
if (newTarget) {
// For now, only support reading new.target when we are reading
// overflown arguments.
MOZ_ASSERT(behavior != ReadFrame_Formals);
newTarget->setUndefined();
}
// Read arguments, which only function frames have.
if (isFunctionFrame()) {
unsigned nactual = numActualArgs();
@ -756,9 +748,6 @@ class InlineFrameIterator {
parent_s.skip(); // return value
parent_s.readFunctionFrameArgs(argOp, nullptr, nullptr, nformal,
nactual, it.script(), fallback);
if (newTarget && isConstructing()) {
*newTarget = parent_s.maybeRead(fallback);
}
} else {
// There is no parent frame to this inlined frame, we can read
// from the frame's Value vector directly.
@ -766,9 +755,6 @@ class InlineFrameIterator {
for (unsigned i = nformal; i < nactual; i++) {
argOp(argv[i]);
}
if (newTarget && isConstructing()) {
*newTarget = argv[nactual];
}
}
}
}
@ -786,7 +772,7 @@ class InlineFrameIterator {
MaybeReadFallback& fallback) const {
Nop nop;
readFrameArgsAndLocals(cx, op, nop, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, behavior, fallback);
nullptr, behavior, fallback);
}
JSScript* script() const { return script_; }

Просмотреть файл

@ -52,7 +52,7 @@ RematerializedFrame::RematerializedFrame(JSContext* cx, uint8_t* top,
CopyValueToRematerializedFrame op(slots_);
iter.readFrameArgsAndLocals(cx, op, op, &envChain_, &hasInitialEnv_,
&returnValue_, &argsObj_, &thisArgument_,
&newTarget_, ReadFrame_Actuals, fallback);
ReadFrame_Actuals, fallback);
}
/* static */
@ -145,7 +145,6 @@ void RematerializedFrame::trace(JSTracer* trc) {
}
TraceRoot(trc, &returnValue_, "remat ion frame return value");
TraceRoot(trc, &thisArgument_, "remat ion frame this");
TraceRoot(trc, &newTarget_, "remat ion frame newTarget");
TraceRootRange(trc, numArgSlots() + script_->nfixed(), slots_,
"remat ion frame stack");
}

Просмотреть файл

@ -87,7 +87,6 @@ class RematerializedFrame {
Value returnValue_;
Value thisArgument_;
Value newTarget_;
Value slots_[1];
RematerializedFrame(JSContext* cx, uint8_t* top, unsigned numActualArgs,
@ -207,13 +206,6 @@ class RematerializedFrame {
return argv()[i];
}
Value newTarget() {
MOZ_ASSERT(isFunctionFrame());
MOZ_ASSERT(!callee()->isArrow());
MOZ_ASSERT_IF(!isConstructing(), newTarget_.isUndefined());
return newTarget_;
}
void setReturnValue(const Value& value) { returnValue_ = value; }
Value& returnValue() { return returnValue_; }

Просмотреть файл

@ -947,19 +947,6 @@ Value FrameIter::thisArgument(JSContext* cx) const {
MOZ_CRASH("Unexpected state");
}
Value FrameIter::newTarget() const {
switch (data_.state_) {
case DONE:
break;
case INTERP:
return interpFrame()->newTarget();
case JIT:
MOZ_ASSERT(jsJitFrame().isBaselineJS());
return jsJitFrame().baselineFrame()->newTarget();
}
MOZ_CRASH("Unexpected state");
}
Value FrameIter::returnValue() const {
switch (data_.state_) {
case DONE:

Просмотреть файл

@ -353,8 +353,6 @@ class FrameIter {
// primitives).
JS::Value thisArgument(JSContext* cx) const;
JS::Value newTarget() const;
JS::Value returnValue() const;
void setReturnValue(const JS::Value& v);

Просмотреть файл

@ -809,16 +809,6 @@ inline Value& AbstractFramePtr::thisArgument() const {
return asRematerializedFrame()->thisArgument();
}
inline Value AbstractFramePtr::newTarget() const {
if (isInterpreterFrame()) {
return asInterpreterFrame()->newTarget();
}
if (isBaselineFrame()) {
return asBaselineFrame()->newTarget();
}
return asRematerializedFrame()->newTarget();
}
inline bool AbstractFramePtr::debuggerNeedsCheckPrimitiveReturn() const {
if (isWasmDebugFrame()) {
return false;

Просмотреть файл

@ -210,7 +210,6 @@ class AbstractFramePtr {
inline Value& thisArgument() const;
inline bool isConstructing() const;
inline Value newTarget() const;
inline bool debuggerNeedsCheckPrimitiveReturn() const;