Bug 1847469 - Part 11: Use column number types in JSScript. r=iain

Differential Revision: https://phabricator.services.mozilla.com/D185749
This commit is contained in:
Tooru Fujisawa 2023-08-16 10:26:30 +00:00
Родитель c38b6641b8
Коммит 6ed9b0b30a
24 изменённых файлов: 102 добавлений и 81 удалений

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

@ -374,7 +374,7 @@ bool DebuggerScript::CallData::getStartLine() {
bool DebuggerScript::CallData::getStartColumn() {
args.rval().setNumber(referent.get().match(
[](BaseScript*& s) { return s->column(); },
[](BaseScript*& s) { return s->column().zeroOriginValue(); },
[](WasmInstanceObject*&) {
return JS::WasmFunctionIndex::DefaultBinarySourceColumnNumberZeroOrigin;
}));

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

@ -1573,7 +1573,7 @@ static bool DelazifyCanonicalScriptedFunctionImpl(JSContext* cx,
JS::CompileOptions options(cx);
options.setMutedErrors(lazy->mutedErrors())
.setFileAndLine(lazy->filename(), lazy->lineno())
.setColumn(lazy->column())
.setColumn(lazy->column().zeroOriginValue())
.setScriptSourceOffset(lazy->sourceStart())
.setNoScriptRval(false)
.setSelfHostingMode(false)

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

@ -477,7 +477,8 @@ bool BaselineStackBuilder::initFrame() {
}
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%u:%u",
script_->filename(), script_->lineno(), script_->column());
script_->filename(), script_->lineno(),
script_->column().zeroOriginValue());
JitSpew(JitSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
// Write the previous frame pointer value. For the outermost frame we reuse
@ -1494,7 +1495,7 @@ bool BaselineStackBuilder::buildOneFrame() {
" Resuming %s pc offset %d (op %s) (line %u) of %s:%u:%u",
resumeAfter() ? "after" : "at", (int)pcOff, CodeName(op_),
PCToLineNumber(script_, pc()), script_->filename(), script_->lineno(),
script_->column());
script_->column().zeroOriginValue());
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
BailoutKindString(bailoutKind()));
#endif
@ -1580,7 +1581,8 @@ bool jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation,
JitSpew(JitSpew_BaselineBailouts,
"Bailing to baseline %s:%u:%u (IonScript=%p) (FrameType=%d)",
iter.script()->filename(), iter.script()->lineno(),
iter.script()->column(), (void*)iter.ionScript(), (int)prevFrameType);
iter.script()->column().zeroOriginValue(), (void*)iter.ionScript(),
(int)prevFrameType);
if (excInfo) {
if (excInfo->catchingException()) {
@ -1625,7 +1627,7 @@ bool jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation,
if (iter.maybeCallee()) {
JitSpew(JitSpew_BaselineBailouts, " Callee function (%s:%u:%u)",
iter.script()->filename(), iter.script()->lineno(),
iter.script()->column());
iter.script()->column().zeroOriginValue());
} else {
JitSpew(JitSpew_BaselineBailouts, " No callee!");
}
@ -1729,9 +1731,9 @@ static void HandleLexicalCheckFailure(JSContext* cx, HandleScript outerScript,
HandleScript innerScript) {
JitSpew(JitSpew_IonBailouts,
"Lexical check failure %s:%u:%u, inlined into %s:%u:%u",
innerScript->filename(), innerScript->lineno(), innerScript->column(),
outerScript->filename(), outerScript->lineno(),
outerScript->column());
innerScript->filename(), innerScript->lineno(),
innerScript->column().zeroOriginValue(), outerScript->filename(),
outerScript->lineno(), outerScript->column().zeroOriginValue());
if (!innerScript->failedLexicalCheck()) {
innerScript->setFailedLexicalCheck();
@ -1958,9 +1960,10 @@ bool jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfoArg) {
JitSpew(JitSpew_BaselineBailouts,
" Restored outerScript=(%s:%u:%u,%u) innerScript=(%s:%u:%u,%u) "
"(bailoutKind=%u)",
outerScript->filename(), outerScript->lineno(), outerScript->column(),
outerScript->filename(), outerScript->lineno(),
outerScript->column().zeroOriginValue(),
outerScript->getWarmUpCount(), innerScript->filename(),
innerScript->lineno(), innerScript->column(),
innerScript->lineno(), innerScript->column().zeroOriginValue(),
innerScript->getWarmUpCount(), (unsigned)bailoutKind);
BailoutAction action = BailoutAction::InvalidateImmediately;

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

@ -2573,7 +2573,7 @@ ICAttachResult js::jit::AttachBaselineCacheIRStub(
JitSpew(JitSpew_BaselineICFallback,
"Tried attaching identical stub for (%s:%u:%u)",
outerScript->filename(), outerScript->lineno(),
outerScript->column());
outerScript->column().zeroOriginValue());
return ICAttachResult::DuplicateStub;
}

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

@ -201,10 +201,12 @@ MethodStatus BaselineCompiler::compile() {
Rooted<JSScript*> script(cx, handler.script());
JitSpew(JitSpew_BaselineScripts, "Baseline compiling script %s:%u:%u (%p)",
script->filename(), script->lineno(), script->column(), script.get());
script->filename(), script->lineno(),
script->column().zeroOriginValue(), script.get());
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%u:%u",
script->filename(), script->lineno(), script->column());
script->filename(), script->lineno(),
script->column().zeroOriginValue());
AutoIncrementalTimer timer(cx->realm()->timers.baselineCompileTime);
@ -285,7 +287,7 @@ MethodStatus BaselineCompiler::compile() {
JitSpew(JitSpew_BaselineScripts,
"Created BaselineScript %p (raw %p) for %s:%u:%u",
(void*)baselineScript.get(), (void*)code->raw(), script->filename(),
script->lineno(), script->column());
script->lineno(), script->column().zeroOriginValue());
baselineScript->copyRetAddrEntries(handler.retAddrEntries().begin());
baselineScript->copyOSREntries(handler.osrEntries().begin());
@ -310,8 +312,8 @@ MethodStatus BaselineCompiler::compile() {
{
JitSpew(JitSpew_Profiling,
"Added JitcodeGlobalEntry for baseline script %s:%u:%u (%p)",
script->filename(), script->lineno(), script->column(),
baselineScript.get());
script->filename(), script->lineno(),
script->column().zeroOriginValue(), baselineScript.get());
// Generate profiling string.
UniqueChars str = GeckoProfilerRuntime::allocProfileString(cx, script);

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

@ -206,7 +206,7 @@ static void SpewPatchBaselineFrame(const uint8_t* oldReturnAddress,
JitSpew(JitSpew_BaselineDebugModeOSR,
"Patch return %p -> %p on BaselineJS frame (%s:%u:%u) from %s at %s",
oldReturnAddress, newReturnAddress, script->filename(),
script->lineno(), script->column(),
script->lineno(), script->column().zeroOriginValue(),
RetAddrEntryKindToString(frameKind), CodeName(JSOp(*pc)));
}
@ -411,7 +411,8 @@ static bool RecompileBaselineScriptForDebugMode(
}
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%u:%u) for %s",
script->filename(), script->lineno(), script->column(),
script->filename(), script->lineno(),
script->column().zeroOriginValue(),
observing ? "DEBUGGING" : "NORMAL EXECUTION");
AutoKeepJitScripts keepJitScripts(cx);

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

@ -158,9 +158,10 @@ void FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...) {
JitSpew(
JitSpew_BaselineICFallback,
"Fallback hit for (%s:%u:%u) (pc=%zu,line=%u,uses=%u,stubs=%zu): %s",
script->filename(), script->lineno(), script->column(),
script->pcToOffset(pc), PCToLineNumber(script, pc),
script->getWarmUpCount(), stub->numOptimizedStubs(), fmtbuf);
script->filename(), script->lineno(),
script->column().zeroOriginValue(), script->pcToOffset(pc),
PCToLineNumber(script, pc), script->getWarmUpCount(),
stub->numOptimizedStubs(), fmtbuf);
}
}
#endif // JS_JITSPEW

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

@ -320,7 +320,8 @@ bool BytecodeAnalysis::init(TempAllocator& alloc) {
JitSpew(
JitSpew_IonAbort,
"Disabling Warp support for %s:%d:%d due to Yield being in a loop",
script_->filename(), script_->lineno(), script_->column());
script_->filename(), script_->lineno(),
script_->column().zeroOriginValue());
script_->disableIon();
}
}
@ -335,8 +336,8 @@ void BytecodeAnalysis::checkWarpSupport(JSOp op) {
#undef DEF_CASE
if (script_->canIonCompile()) {
JitSpew(JitSpew_IonAbort, "Disabling Warp support for %s:%d:%d due to %s",
script_->filename(), script_->lineno(), script_->column(),
CodeName(op));
script_->filename(), script_->lineno(),
script_->column().zeroOriginValue(), CodeName(op));
script_->disableIon();
}
break;

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

@ -141,7 +141,8 @@ void CacheIRHealth::spewShapeInformation(AutoStructuredSpewer& spew,
{
spew->property("filename", baseScript->filename());
spew->property("line", baseScript->lineno());
spew->property("column", baseScript->column());
spew->property("column",
baseScript->column().zeroOriginValue());
}
spew->endObject();
}
@ -305,7 +306,7 @@ void CacheIRHealth::spewScriptFinalWarmUpCount(JSContext* cx,
spew->property("filename", filename);
spew->property("line", script->lineno());
spew->property("column", script->column());
spew->property("column", script->column().zeroOriginValue());
spew->property("finalWarmUpCount", warmUpCount);
}

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

@ -14102,7 +14102,7 @@ bool CodeGenerator::generate() {
JitSpew(JitSpew_Codegen, "# Emitting code for script %s:%u:%u",
gen->outerInfo().script()->filename(),
gen->outerInfo().script()->lineno(),
gen->outerInfo().script()->column());
gen->outerInfo().script()->column().zeroOriginValue());
// Initialize native code table with an entry to the start of
// top-level script.

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

@ -241,7 +241,7 @@ JitCode* JitRuntime::generateEntryTrampolineForScript(JSContext* cx,
JitSpew(JitSpew_Codegen,
"# Emitting Interpreter Entry Trampoline for %s (%s:%u:%u)",
funName ? funName.get() : "*", script->filename(), script->lineno(),
script->column());
script->column().zeroOriginValue());
}
TempAllocator temp(&cx->tempLifoAlloc());

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

@ -1670,7 +1670,8 @@ static AbortReason IonCompile(JSContext* cx, HandleScript script,
JitSpew(JitSpew_IonSyncLogs,
"Can't log script %s:%u:%u"
". (Compiled on background thread.)",
script->filename(), script->lineno(), script->column());
script->filename(), script->lineno(),
script->column().zeroOriginValue());
IonCompileTask* task = alloc->new_<IonCompileTask>(cx, *mirGen, snapshot);
if (!task) {
@ -1786,7 +1787,7 @@ static bool ScriptIsTooLarge(JSContext* cx, JSScript* script) {
JitSpew(JitSpew_IonAbort,
"Script too large (%zu bytes) (%zu locals/args) @ %s:%u:%u",
script->length(), numLocalsAndArgs, script->filename(),
script->lineno(), script->column());
script->lineno(), script->column().zeroOriginValue());
return true;
}
@ -1831,7 +1832,8 @@ static MethodStatus Compile(JSContext* cx, HandleScript script,
if (!CanIonCompileScript(cx, script)) {
JitSpew(JitSpew_IonAbort, "Aborted compilation of %s:%u:%u",
script->filename(), script->lineno(), script->column());
script->filename(), script->lineno(),
script->column().zeroOriginValue());
return Method_CantCompile;
}
@ -2096,8 +2098,9 @@ static bool IonCompileScriptForBaseline(JSContext* cx, BaselineFrame* frame,
JitSpew(JitSpew_BaselineOSR,
"WarmUpCounter for %s:%u:%u reached %d at pc %p, trying to switch to "
"Ion!",
script->filename(), script->lineno(), script->column(),
(int)script->getWarmUpCount(), (void*)pc);
script->filename(), script->lineno(),
script->column().zeroOriginValue(), (int)script->getWarmUpCount(),
(void*)pc);
MethodStatus stat;
if (isLoopHead) {
@ -2291,8 +2294,8 @@ static void InvalidateActivation(JS::GCContext* gcx,
JitSpew(JitSpew_IonInvalidate,
"#%zu %s JS frame @ %p, %s:%u:%u (fun: %p, script: %p, pc %p)",
frameno, type, frame.fp(), script->maybeForwardedFilename(),
script->lineno(), script->column(), frame.maybeCallee(), script,
frame.resumePCinCurrentFrame());
script->lineno(), script->column().zeroOriginValue(),
frame.maybeCallee(), script, frame.resumePCinCurrentFrame());
break;
}
case FrameType::BaselineStub:
@ -2466,7 +2469,7 @@ void jit::Invalidate(JSContext* cx, const RecompileInfoVector& invalid,
JitSpew(JitSpew_IonInvalidate, " Invalidate %s:%u:%u, IonScript %p",
info.script()->filename(), info.script()->lineno(),
info.script()->column(), ionScript);
info.script()->column().zeroOriginValue(), ionScript);
// Keep the ion script alive during the invalidation and flag this
// ionScript as being invalidated. This increment is removed by the
@ -2552,8 +2555,8 @@ void jit::Invalidate(JSContext* cx, JSScript* script, bool resetUses,
}
// Construct the descriptive string.
UniqueChars buf =
JS_smprintf("%s:%u:%u", filename, script->lineno(), script->column());
UniqueChars buf = JS_smprintf("%s:%u:%u", filename, script->lineno(),
script->column().zeroOriginValue());
// Ignore the event on allocation failure.
if (buf) {
@ -2587,7 +2590,8 @@ void jit::FinishInvalidation(JS::GCContext* gcx, JSScript* script) {
void jit::ForbidCompilation(JSContext* cx, JSScript* script) {
JitSpew(JitSpew_IonAbort, "Disabling Ion compilation of script %s:%u:%u",
script->filename(), script->lineno(), script->column());
script->filename(), script->lineno(),
script->column().zeroOriginValue());
CancelOffThreadIonCompile(script);

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

@ -1007,7 +1007,7 @@ bool JitcodeIonTable::WriteIonTable(CompactBufferWriter& writer,
JitSpew(JitSpew_Profiling,
"Writing native to bytecode map for %s:%u:%u (%zu entries)",
scriptList[0].script->filename(), scriptList[0].script->lineno(),
scriptList[0].script->column(),
scriptList[0].script->column().zeroOriginValue(),
mozilla::PointerRangeSize(start, end));
JitSpew(JitSpew_Profiling, " ScriptList of size %u",
@ -1015,7 +1015,7 @@ bool JitcodeIonTable::WriteIonTable(CompactBufferWriter& writer,
for (uint32_t i = 0; i < scriptList.length(); i++) {
JitSpew(JitSpew_Profiling, " Script %u - %s:%u:%u", i,
scriptList[i].script->filename(), scriptList[i].script->lineno(),
scriptList[i].script->column());
scriptList[i].script->column().zeroOriginValue());
}
// Write out runs first. Keep a vector tracking the positive offsets from

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

@ -67,6 +67,7 @@ pid_t gettid_pthread() {
#include "jit/JitSpewer.h"
#include "jit/LIR.h"
#include "jit/MIR.h"
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberOffset
#include "js/JitCodeAPI.h"
#include "js/Printf.h"
#include "vm/BytecodeUtil.h"
@ -154,9 +155,10 @@ static void WriteToJitDumpFile(const void* addr, uint32_t size,
}
static void WriteJitDumpDebugEntry(uint64_t addr, const char* filename,
uint32_t lineno, uint32_t colno,
uint32_t lineno,
JS::LimitedColumnNumberZeroOrigin colno,
AutoLockPerfSpewer& lock) {
JitDumpDebugEntry entry = {addr, lineno, colno};
JitDumpDebugEntry entry = {addr, lineno, colno.zeroOriginValue()};
WriteToJitDumpFile(&entry, sizeof(entry), lock);
WriteToJitDumpFile(filename, strlen(filename) + 1, lock);
}
@ -791,7 +793,8 @@ void PerfSpewer::saveJitCodeIRInfo(JitCode* code,
}
uint64_t addr = uint64_t(code->raw()) + entry.offset;
uint64_t lineno = i + 1;
WriteJitDumpDebugEntry(addr, scriptFilename.get(), lineno, 0, lock);
WriteJitDumpDebugEntry(addr, scriptFilename.get(), lineno,
JS::LimitedColumnNumberZeroOrigin::zero(), lock);
}
#endif
@ -863,7 +866,7 @@ void BaselinePerfSpewer::saveJitCodeSourceInfo(
#endif
uint32_t lineno = script->lineno();
uint32_t colno = script->column();
JS::LimitedColumnNumberZeroOrigin colno = script->column();
uint64_t offset = 0;
for (SrcNoteIterator iter(script->notes()); !iter.atEnd(); ++iter) {
const auto* sn = *iter;
@ -872,12 +875,12 @@ void BaselinePerfSpewer::saveJitCodeSourceInfo(
SrcNoteType type = sn->type();
if (type == SrcNoteType::SetLine) {
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
colno = 0;
colno = JS::LimitedColumnNumberZeroOrigin::zero();
} else if (type == SrcNoteType::NewLine) {
lineno++;
colno = 0;
colno = JS::LimitedColumnNumberZeroOrigin::zero();
} else if (type == SrcNoteType::ColSpan) {
colno += SrcNote::ColSpan::getSpan(sn);
colno += JS::ColumnNumberOffset(SrcNote::ColSpan::getSpan(sn));
} else {
continue;
}
@ -891,7 +894,7 @@ void BaselinePerfSpewer::saveJitCodeSourceInfo(
CreateProfilerSourceEntry(profilerRecord, lock)) {
srcInfo->offset = offset;
srcInfo->lineno = lineno;
srcInfo->colno = colno;
srcInfo->colno = colno.zeroOriginValue();
srcInfo->filename = JS_smprintf("%s", filename);
}
@ -959,7 +962,8 @@ void IonPerfSpewer::saveJitCodeSourceInfo(JSScript* script, JitCode* code,
#ifdef JS_ION_PERF
if (perfProfiling) {
WriteJitDumpDebugEntry(uint64_t(code->raw()) + entry.offset, filename,
lineno, colno, lock);
lineno, JS::LimitedColumnNumberZeroOrigin(colno),
lock);
}
#endif
}
@ -977,11 +981,11 @@ static UniqueChars GetFunctionDesc(const char* tierName, JSContext* cx,
if (stubName) {
return JS_smprintf("%s: %s : %s (%s:%u:%u)", tierName, stubName,
funName ? funName.get() : "*", script->filename(),
script->lineno(), script->column());
script->lineno(), script->column().zeroOriginValue());
}
return JS_smprintf("%s: %s (%s:%u:%u)", tierName,
funName ? funName.get() : "*", script->filename(),
script->lineno(), script->column());
script->lineno(), script->column().zeroOriginValue());
}
void PerfSpewer::saveDebugInfo(JSScript* script, JitCode* code,

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

@ -91,7 +91,8 @@ bool DoTrialInlining(JSContext* cx, BaselineFrame* frame) {
"Trial inlining for %s script '%s' (%s:%u:%u (%p)) (inliningRoot=%p)",
(isRecursive ? "inner" : "outer"),
funName ? funName.get() : "<unnamed>", script->filename(),
script->lineno(), script->column(), frame->script(), root);
script->lineno(), script->column().zeroOriginValue(), frame->script(),
root);
JitSpewIndent spewIndent(JitSpew_WarpTrialInlining);
}
@ -545,7 +546,7 @@ TrialInliningDecision TrialInliner::getInliningDecision(JSFunction* target,
funName ? funName.get() : "<unnamed>",
baseScript ? baseScript->filename() : "<not-scripted>",
baseScript ? baseScript->lineno() : 0,
baseScript ? baseScript->column() : 0);
baseScript ? baseScript->column().zeroOriginValue() : 0);
JitSpewIndent spewIndent(JitSpew_WarpTrialInlining);
}
#endif

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

@ -137,8 +137,8 @@ AbortReasonOr<WarpSnapshot*> WarpOracle::createSnapshot() {
JitSpew(JitSpew_IonScripts,
"Warp %s script %s:%u:%u (%p) (warmup-counter=%" PRIu32 ",%s%s)",
mode, outerScript_->filename(), outerScript_->lineno(),
outerScript_->column(), static_cast<JSScript*>(outerScript_),
outerScript_->getWarmUpCount(),
outerScript_->column().zeroOriginValue(),
static_cast<JSScript*>(outerScript_), outerScript_->getWarmUpCount(),
outerScript_->isGenerator() ? " isGenerator" : "",
outerScript_->isAsync() ? " isAsync" : "");
#endif
@ -735,7 +735,7 @@ static void LineNumberAndColumn(HandleScript script, BytecodeLocation loc,
*line = PCToLineNumber(script, loc.toRawBytecode(), column);
#else
*line = script->lineno();
*column = script->column();
*column = script->column().zeroOriginValue();
#endif
}

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

@ -79,7 +79,7 @@ void WarpScriptSnapshot::dump(GenericPrinter& out) const {
out.printf("WarpScriptSnapshot (0x%p)\n", this);
out.printf("------------------------------\n");
out.printf("Script: %s:%u:%u (0x%p)\n", script_->filename(),
script_->lineno(), script_->column(),
script_->lineno(), script_->column().zeroOriginValue(),
static_cast<JSScript*>(script_));
out.printf(" moduleObject: 0x%p\n", moduleObject());
out.printf(" isArrowFunction: %u\n", isArrowFunction());

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

@ -306,7 +306,7 @@ void CodeGeneratorShared::dumpNativeToBytecodeEntries() {
InlineScriptTree* topTree = gen->outerInfo().inlineScriptTree();
JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%u:%u\n",
topTree->script()->filename(), topTree->script()->lineno(),
topTree->script()->column());
topTree->script()->column().zeroOriginValue());
for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++) {
dumpNativeToBytecodeEntry(i);
}
@ -332,11 +332,12 @@ void CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx) {
JitSpew_Profiling, " %08zx [+%-6u] => %-6ld [%-4u] {%-10s} (%s:%u:%u",
ref.nativeOffset.offset(), nativeDelta, (long)(ref.pc - script->code()),
pcDelta, CodeName(JSOp(*ref.pc)), script->filename(), script->lineno(),
script->column());
script->column().zeroOriginValue());
for (tree = tree->caller(); tree; tree = tree->caller()) {
JitSpewCont(JitSpew_Profiling, " <= %s:%u:%u", tree->script()->filename(),
tree->script()->lineno(), tree->script()->column());
tree->script()->lineno(),
tree->script()->column().zeroOriginValue());
}
JitSpewCont(JitSpew_Profiling, ")");
JitSpewFin(JitSpew_Profiling);

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

@ -88,7 +88,7 @@ static bool MatchJSScript(JSScript* script, const char* pattern) {
char signature[2048] = {0};
SprintfLiteral(signature, "%s:%u:%u", script->filename(), script->lineno(),
script->column());
script->column().zeroOriginValue());
// Trivial containment match.
char* result = strstr(signature, pattern);
@ -131,7 +131,7 @@ void StructuredSpewer::startObject(JSContext* cx, const JSScript* script,
json.beginObjectProperty("location");
json.property("filename", script->filename());
json.property("line", script->lineno());
json.property("column", script->column());
json.property("column", script->column().zeroOriginValue());
json.endObject();
}
}

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

@ -118,7 +118,7 @@ class BytecodeRangeWithPosition : private BytecodeRange {
: BytecodeRange(cx, script),
initialLine(script->lineno()),
lineno(script->lineno()),
column(script->column()),
column(script->column().zeroOriginValue()),
sn(script->notes()),
snpc(script->code()),
isEntryPoint(false),

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

@ -286,8 +286,9 @@ UniqueChars GeckoProfilerRuntime::allocProfileString(JSContext* cx,
size_t lineAndColumnLength = 0;
char lineAndColumnStr[30];
if (hasName || script->isFunction() || script->isForEval()) {
lineAndColumnLength = SprintfLiteral(lineAndColumnStr, "%u:%u",
script->lineno(), script->column());
lineAndColumnLength =
SprintfLiteral(lineAndColumnStr, "%u:%u", script->lineno(),
script->column().zeroOriginValue());
hasLineAndColumn = true;
}

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

@ -46,6 +46,7 @@
#include "jit/JitOptions.h"
#include "jit/JitRuntime.h"
#include "js/CharacterEncoding.h" // JS_EncodeStringToUTF8
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberOffset
#include "js/CompileOptions.h"
#include "js/experimental/SourceHook.h"
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
@ -2736,8 +2737,8 @@ unsigned js::PCToLineNumber(JSScript* script, jsbytecode* pc,
return 0;
}
return PCToLineNumber(script->lineno(), script->column(), script->notes(),
script->code(), pc, columnp);
return PCToLineNumber(script->lineno(), script->column().zeroOriginValue(),
script->notes(), script->code(), pc, columnp);
}
jsbytecode* js::LineNumberToPC(JSScript* script, unsigned target) {
@ -3403,7 +3404,7 @@ bool JSScript::dump(JSContext* cx, JS::Handle<JSScript*> script,
}
json.property("lineno", script->lineno());
json.property("column", script->column());
json.property("column", script->column().zeroOriginValue());
json.beginListProperty("immutableFlags");
DumpImmutableScriptFlags(json, script->immutableFlags());
@ -3507,7 +3508,7 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
unsigned offset = 0;
unsigned lineno = script->lineno();
unsigned column = script->column();
JS::LimitedColumnNumberZeroOrigin column = script->column();
SrcNote* notes = script->notes();
for (SrcNoteIterator iter(notes); !iter.atEnd(); ++iter) {
const auto* sn = *iter;
@ -3517,7 +3518,7 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
SrcNoteType type = sn->type();
const char* name = sn->name();
if (!sp->jsprintf("%3u: %4u %6u %5u [%4u] %-10s", unsigned(sn - notes),
lineno, column, offset, delta, name)) {
lineno, column.zeroOriginValue(), offset, delta, name)) {
return false;
}
@ -3534,7 +3535,7 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
if (!sp->jsprintf(" colspan %u", colspan)) {
return false;
}
column += colspan;
column += JS::ColumnNumberOffset(colspan);
break;
}
@ -3543,12 +3544,12 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
if (!sp->jsprintf(" lineno %u", lineno)) {
return false;
}
column = 0;
column = JS::LimitedColumnNumberZeroOrigin::zero();
break;
case SrcNoteType::NewLine:
++lineno;
column = 0;
column = JS::LimitedColumnNumberZeroOrigin::zero();
break;
default:
@ -3689,7 +3690,8 @@ bool JSScript::dumpGCThings(JSContext* cx, JS::Handle<JSScript*> script,
if (fun->hasBaseScript()) {
BaseScript* script = fun->baseScript();
if (!sp->jsprintf(" @ %u:%u\n", script->lineno(), script->column())) {
if (!sp->jsprintf(" @ %u:%u\n", script->lineno(),
script->column().zeroOriginValue())) {
return false;
}
} else {

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

@ -27,6 +27,7 @@
#include "frontend/ScriptIndex.h" // ScriptIndex
#include "gc/Barrier.h"
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
#include "js/CompileOptions.h"
#include "js/Transcoding.h"
#include "js/UbiNode.h"
@ -1543,8 +1544,8 @@ class BaseScript : public gc::TenuredCellWithNonGCPointer<uint8_t> {
// Line number (1-origin)
uint32_t lineno() const { return extent_.lineno; }
// Column number in UTF-16 code units (0-origin)
uint32_t column() const { return extent_.column.zeroOriginValue(); }
// Column number in UTF-16 code units
JS::LimitedColumnNumberZeroOrigin column() const { return extent_.column; }
JS::DelazificationOption delazificationMode() const {
return scriptSource()->delazificationMode();

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

@ -109,11 +109,9 @@ void MarkScript(const js::jit::JitCode* code, JSScript* script,
method.method_size = code->instructionsSize();
method.module_name = const_cast<char*>(module);
// Line numbers begin at 1, but columns begin at 0.
// Text editors start at 1,1 so fixup is performed to match.
char namebuf[512];
SprintfLiteral(namebuf, "%s:%u:%u", script->filename(), script->lineno(),
script->column() + 1);
script->column().oneOriginValue());
method.method_name = &namebuf[0];