mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1531480 - Replace uses of jsbytecode* with BytecodeLocation and BytecodeIterator inside RemoveReferenceNames r=nbp
Encapsulate manipulation of bytecode within RemoveReferenceNames method using accessor classes BytecodeLocation and BytecodeIterator Differential Revision: https://phabricator.services.mozilla.com/D41120 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
94defbb792
commit
aa38026df8
@ -15,7 +15,7 @@ class BytecodeIterator {
|
||||
BytecodeLocation current_;
|
||||
|
||||
public:
|
||||
explicit BytecodeIterator(const JSScript* script);
|
||||
inline explicit BytecodeIterator(const JSScript* script);
|
||||
|
||||
explicit BytecodeIterator(BytecodeLocation loc) : current_(loc) {}
|
||||
|
||||
|
@ -19,6 +19,11 @@
|
||||
#include "vm/Xdr.h"
|
||||
#include "wasm/WasmInstance.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "vm/BytecodeIterator.h"
|
||||
#include "vm/BytecodeLocation.h"
|
||||
#endif
|
||||
|
||||
#include "gc/Marking-inl.h"
|
||||
#include "vm/JSAtom-inl.h"
|
||||
#include "vm/JSScript-inl.h"
|
||||
@ -26,6 +31,11 @@
|
||||
#include "vm/Stack-inl.h"
|
||||
#include "vm/TypeInference-inl.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "vm/BytecodeIterator-inl.h"
|
||||
#include "vm/BytecodeLocation-inl.h"
|
||||
#endif
|
||||
|
||||
using namespace js;
|
||||
|
||||
typedef Rooted<ArgumentsObject*> RootedArgumentsObject;
|
||||
@ -3771,22 +3781,22 @@ static bool RemoveReferencedNames(JSContext* cx, HandleScript script,
|
||||
// these names and putting eval in an inner script is bad news if you
|
||||
// care about entraining variables unnecessarily.
|
||||
|
||||
for (jsbytecode* pc = script->code(); pc != script->codeEnd();
|
||||
pc += GetBytecodeLength(pc)) {
|
||||
AllBytecodesIterable iter(script);
|
||||
for (BytecodeLocation loc : iter) {
|
||||
PropertyName* name;
|
||||
|
||||
switch (JSOp(*pc)) {
|
||||
switch (loc.getOp()) {
|
||||
case JSOP_GETNAME:
|
||||
case JSOP_SETNAME:
|
||||
case JSOP_STRICTSETNAME:
|
||||
name = script->getName(pc);
|
||||
name = script->getName(loc.toRawBytecode());
|
||||
break;
|
||||
|
||||
case JSOP_GETGNAME:
|
||||
case JSOP_SETGNAME:
|
||||
case JSOP_STRICTSETGNAME:
|
||||
if (script->hasNonSyntacticScope()) {
|
||||
name = script->getName(pc);
|
||||
name = script->getName(loc.toRawBytecode());
|
||||
} else {
|
||||
name = nullptr;
|
||||
}
|
||||
@ -3794,7 +3804,7 @@ static bool RemoveReferencedNames(JSContext* cx, HandleScript script,
|
||||
|
||||
case JSOP_GETALIASEDVAR:
|
||||
case JSOP_SETALIASEDVAR:
|
||||
name = EnvironmentCoordinateNameSlow(script, pc);
|
||||
name = EnvironmentCoordinateNameSlow(script, loc.toRawBytecode());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user