Bug 1608509 - Part 1: Fix a few odd comments. r=jandem.

The comment about JSOP_GLOBALTHIS and JSOP_FUNCTIONTHIS may never have been
sensible; JSOP_FUNCTIONTHIS never walks the environment chain, as it is used
only in non-arrow functions, which take `this` as an argument in the CallArgs.

JSOP_LOOPENTRY and JSOP_TRACE are gone. So is JSOP_SPREAD.

"JSOP_POPs" was eccentric in a way that would be unclear with CamelCase.

Differential Revision: https://phabricator.services.mozilla.com/D59799

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Orendorff 2020-01-14 17:39:19 +00:00
parent 3779d59f17
commit 58673de7b8
7 changed files with 12 additions and 14 deletions

View File

@ -571,9 +571,7 @@ JS_FRIEND_API bool js::ExecuteInJSMEnvironment(JSContext* cx,
// WithEnvironmentObject[target=targetObj]
// LexicalEnvironmentObject[this=targetObj] (*)
//
// (*) This environment intentionally intercepts JSOP_GLOBALTHIS, but
// not JSOP_FUNCTIONTHIS (which instead will fallback to the NSVO). I
// don't make the rules, I just record them.
// (*) This environment intercepts JSOP_GLOBALTHIS.
// Wrap the target objects in WithEnvironments.
if (!js::CreateObjectsForEnvironmentChain(cx, targetObj, env, &env)) {

View File

@ -489,7 +489,7 @@ bool BytecodeEmitter::emitPopN(unsigned n) {
return emit1(JSOP_POP);
}
// 2 JSOP_POPs (2 bytes) are shorter than JSOP_POPN (3 bytes).
// 2 JSOP_POP instructions (2 bytes) are shorter than JSOP_POPN (3 bytes).
if (n == 2) {
return emit1(JSOP_POP) && emit1(JSOP_POP);
}
@ -593,9 +593,9 @@ Maybe<uint32_t> BytecodeEmitter::getOffsetForLoop(ParseNode* nextpn) {
return Nothing();
}
// Try to give the JSOP_LOOPHEAD and JSOP_LOOPENTRY the same line number as
// the next instruction. nextpn is often a block, in which case the next
// instruction typically comes from the first statement inside.
// Try to give the JSOP_LOOPHEAD the same line number as the next
// instruction. nextpn is often a block, in which case the next instruction
// typically comes from the first statement inside.
if (nextpn->is<LexicalScopeNode>()) {
nextpn = nextpn->as<LexicalScopeNode>().scopeBody();
}

View File

@ -1777,7 +1777,7 @@ bool BaselineCodeGen<Handler>::emit_JSOP_DUP() {
frame.popRegsAndSync(1);
masm.moveValue(R0, R1);
// inc/dec ops use DUP followed by ONE, ADD. Push R0 last to avoid a move.
// inc/dec ops use DUP followed by INC/DEC. Push R0 last to avoid a move.
frame.push(R1);
frame.push(R0);
return true;

View File

@ -297,7 +297,7 @@ class BaselineCompilerHandler {
FixedList<Label> labels_;
RetAddrEntryVector retAddrEntries_;
// Native code offsets for OSR at JSOP_LOOPENTRY ops.
// Native code offsets for OSR at JSOP_LOOPHEAD ops.
using OSREntryVector =
Vector<BaselineScript::OSREntry, 16, SystemAllocPolicy>;
OSREntryVector osrEntries_;

View File

@ -215,7 +215,7 @@ struct BaselineScript final {
};
// Native code offset for OSR from Baseline Interpreter into Baseline JIT at
// JSOP_LOOPENTRY ops.
// JSOP_LOOPHEAD ops.
class OSREntry : public BasePCToNativeEntry {
public:
using BasePCToNativeEntry::BasePCToNativeEntry;

View File

@ -1322,7 +1322,7 @@ class MStart : public MNullaryInstruction {
};
// Instruction marking on entrypoint for on-stack replacement.
// OSR may occur at loop headers (at JSOP_TRACE).
// OSR may occur at loop headers (at JSOP_LOOPHEAD).
// There is at most one MOsrEntry per MIRGraph.
class MOsrEntry : public MNullaryInstruction {
protected:

View File

@ -642,13 +642,13 @@ static MOZ_ALWAYS_INLINE bool InitArrayElemOperation(JSContext* cx,
* If val is a hole, do not call DefineElement.
*
* Furthermore, if the current op is JSOP_INITELEM_INC, always call
* SetLengthProperty even if it is not the last element initialiser,
* because it may be followed by JSOP_SPREAD, which will not set the array
* SetLengthProperty even if it is not the last element initialiser, because
* it may be followed by a SpreadElement loop, which will not set the array
* length if nothing is spread.
*
* Alternatively, if the current op is JSOP_INITELEM_ARRAY, the length will
* have already been set by the earlier JSOP_NEWARRAY; JSOP_INITELEM_ARRAY
* cannot follow JSOP_SPREAD.
* cannot follow SpreadElements.
*/
if (val.isMagic(JS_ELEMENTS_HOLE)) {
if (op == JSOP_INITELEM_INC) {