mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Backed out 27 changesets (bug 1847469) for causing spidermonkey bustages in Script.cpp CLOSED TREE
Backed out changeset 9d6e2651a013 (bug 1847469) Backed out changeset 9b72d668efd2 (bug 1847469) Backed out changeset 86abf5cf0a22 (bug 1847469) Backed out changeset 46833087f8ac (bug 1847469) Backed out changeset f3e2207fdeec (bug 1847469) Backed out changeset aed75776cfff (bug 1847469) Backed out changeset 8292a38bd99f (bug 1847469) Backed out changeset 1320f83fb8c7 (bug 1847469) Backed out changeset df9f925f9837 (bug 1847469) Backed out changeset 69f32cf1862a (bug 1847469) Backed out changeset b2ddddec8818 (bug 1847469) Backed out changeset 056eed7abc97 (bug 1847469) Backed out changeset 5df4f43ac0bf (bug 1847469) Backed out changeset cb57923f6532 (bug 1847469) Backed out changeset a0993f2a2195 (bug 1847469) Backed out changeset 782499fbedf2 (bug 1847469) Backed out changeset cf84fb98c5e1 (bug 1847469) Backed out changeset 1fa5ab59814b (bug 1847469) Backed out changeset f5f78944df81 (bug 1847469) Backed out changeset aa14337bf5c6 (bug 1847469) Backed out changeset 6757db4575d7 (bug 1847469) Backed out changeset 236ff135701e (bug 1847469) Backed out changeset 9b4d5b435020 (bug 1847469) Backed out changeset a0f789621bc8 (bug 1847469) Backed out changeset c19b81f48055 (bug 1847469) Backed out changeset b4521e546d7e (bug 1847469) Backed out changeset f26a10289316 (bug 1847469)
This commit is contained in:
parent
abc9ac559a
commit
4fe9ed8f30
@ -71,7 +71,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
|
||||
// This should be probably defined on some other place... but I couldn't find it
|
||||
#define WEBAPPS_PERM_NAME "webapps-manage"
|
||||
@ -532,8 +531,8 @@ bool nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(
|
||||
if (reportViolation) {
|
||||
JS::AutoFilename scriptFilename;
|
||||
nsAutoString fileName;
|
||||
uint32_t lineNum = 0;
|
||||
JS::ColumnNumberZeroOrigin columnNum;
|
||||
unsigned lineNum = 0;
|
||||
unsigned columnNum = 0;
|
||||
if (JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNum, &columnNum)) {
|
||||
if (const char* file = scriptFilename.get()) {
|
||||
CopyUTF8toUTF16(nsDependentCString(file), fileName);
|
||||
@ -555,7 +554,7 @@ bool nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(
|
||||
csp->LogViolationDetails(violationType,
|
||||
nullptr, // triggering element
|
||||
cspEventListener, fileName, scriptSample, lineNum,
|
||||
columnNum.zeroOriginValue(), u""_ns, u""_ns);
|
||||
columnNum, u""_ns, u""_ns);
|
||||
}
|
||||
|
||||
return evalOK;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/UbiNode.h"
|
||||
#include "js/UniquePtr.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
@ -159,7 +158,7 @@ struct DeserializedStackFrame {
|
||||
StackFrameId id;
|
||||
Maybe<StackFrameId> parent;
|
||||
uint32_t line;
|
||||
JS::TaggedColumnNumberOneOrigin column;
|
||||
uint32_t column;
|
||||
// Borrowed references to strings owned by this DeserializedStackFrame's
|
||||
// owning HeapSnapshot.
|
||||
const char16_t* source;
|
||||
@ -170,11 +169,13 @@ struct DeserializedStackFrame {
|
||||
// AddRef'ing because this frame's lifetime is equal to that of its owner.
|
||||
HeapSnapshot* owner;
|
||||
|
||||
explicit DeserializedStackFrame(
|
||||
StackFrameId id, const Maybe<StackFrameId>& parent, uint32_t line,
|
||||
JS::TaggedColumnNumberOneOrigin column, const char16_t* source,
|
||||
const char16_t* functionDisplayName, bool isSystem, bool isSelfHosted,
|
||||
HeapSnapshot& owner)
|
||||
explicit DeserializedStackFrame(StackFrameId id,
|
||||
const Maybe<StackFrameId>& parent,
|
||||
uint32_t line, uint32_t column,
|
||||
const char16_t* source,
|
||||
const char16_t* functionDisplayName,
|
||||
bool isSystem, bool isSelfHosted,
|
||||
HeapSnapshot& owner)
|
||||
: id(id),
|
||||
parent(parent),
|
||||
line(line),
|
||||
@ -197,6 +198,7 @@ struct DeserializedStackFrame {
|
||||
: id(0),
|
||||
parent(Nothing()),
|
||||
line(0),
|
||||
column(0),
|
||||
source(nullptr),
|
||||
functionDisplayName(nullptr),
|
||||
isSystem(false),
|
||||
@ -279,9 +281,7 @@ class ConcreteStackFrame<DeserializedStackFrame> : public BaseStackFrame {
|
||||
|
||||
uint64_t identifier() const override { return get().id; }
|
||||
uint32_t line() const override { return get().line; }
|
||||
JS::TaggedColumnNumberOneOrigin column() const override {
|
||||
return get().column;
|
||||
}
|
||||
uint32_t column() const override { return get().column; }
|
||||
bool isSystem() const override { return get().isSystem; }
|
||||
bool isSelfHosted(JSContext* cx) const override { return get().isSelfHosted; }
|
||||
void trace(JSTracer* trc) override {}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
|
||||
|
||||
#include "js/Array.h" // JS::NewArrayObject
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberOneOrigin, JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/Debug.h"
|
||||
#include "js/PropertyAndElement.h" // JS_DefineProperty
|
||||
#include "js/TypeDecls.h"
|
||||
@ -325,8 +324,7 @@ bool HeapSnapshot::saveStackFrame(const protobuf::StackFrame& frame,
|
||||
uint32_t line = data.line();
|
||||
|
||||
if (!data.has_column()) return false;
|
||||
JS::TaggedColumnNumberOneOrigin column(
|
||||
JS::LimitedColumnNumberOneOrigin(data.column()));
|
||||
uint32_t column = data.column();
|
||||
|
||||
if (!data.has_issystem()) return false;
|
||||
bool isSystem = data.issystem();
|
||||
@ -1101,7 +1099,7 @@ class MOZ_STACK_CLASS StreamWriter : public CoreDumpWriter {
|
||||
|
||||
data->set_id(id);
|
||||
data->set_line(frame.line());
|
||||
data->set_column(frame.column().oneOriginValue());
|
||||
data->set_column(frame.column());
|
||||
data->set_issystem(frame.isSystem());
|
||||
data->set_isselfhosted(frame.isSelfHosted(cx));
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
// would like.
|
||||
|
||||
#include "DevTools.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberOneOrigin, JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/SavedFrameAPI.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/devtools/DeserializedNode.h"
|
||||
@ -24,8 +23,7 @@ struct MockDeserializedStackFrame : public DeserializedStackFrame {
|
||||
DEF_TEST(DeserializedStackFrameUbiStackFrames, {
|
||||
StackFrameId id = uint64_t(1) << 42;
|
||||
uint32_t line = 1337;
|
||||
JS::TaggedColumnNumberOneOrigin column(
|
||||
JS::LimitedColumnNumberOneOrigin(9)); // 3 space tabs!?
|
||||
uint32_t column = 9; // 3 space tabs!?
|
||||
const char16_t* source = u"my-javascript-file.js";
|
||||
const char16_t* functionDisplayName = u"myFunctionName";
|
||||
|
||||
@ -61,7 +59,7 @@ DEF_TEST(DeserializedStackFrameUbiStackFrames, {
|
||||
JS::GetSavedFrameLine(cx, principals, savedFrame, &frameLine));
|
||||
EXPECT_EQ(line, frameLine);
|
||||
|
||||
JS::TaggedColumnNumberOneOrigin frameColumn;
|
||||
uint32_t frameColumn;
|
||||
ASSERT_EQ(JS::SavedFrameResult::Ok,
|
||||
JS::GetSavedFrameColumn(cx, principals, savedFrame, &frameColumn));
|
||||
EXPECT_EQ(column, frameColumn);
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "JSOracleParent.h"
|
||||
#include "js/CallAndConstruct.h" // JS::Call
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Object.h" // JS::GetClass
|
||||
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_DefinePropertyById, JS_Enumerate, JS_GetProperty, JS_GetPropertyById, JS_SetProperty, JS_SetPropertyById, JS::IdVector
|
||||
@ -1597,7 +1596,7 @@ void ChromeUtils::CreateError(const GlobalObject& aGlobal,
|
||||
{
|
||||
JS::Rooted<JSString*> fileName(cx, JS_GetEmptyString(cx));
|
||||
uint32_t line = 0;
|
||||
JS::TaggedColumnNumberOneOrigin column;
|
||||
uint32_t column = 0;
|
||||
|
||||
Maybe<JSAutoRealm> ar;
|
||||
JS::Rooted<JSObject*> stack(cx);
|
||||
@ -1627,9 +1626,8 @@ void ChromeUtils::CreateError(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> err(cx);
|
||||
if (!JS::CreateError(cx, JSEXN_ERR, stack, fileName, line,
|
||||
JS::ColumnNumberOneOrigin(column.oneOriginValue()),
|
||||
nullptr, message, JS::NothingHandleValue, &err)) {
|
||||
if (!JS::CreateError(cx, JSEXN_ERR, stack, fileName, line, column, nullptr,
|
||||
message, JS::NothingHandleValue, &err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4323,7 +4323,9 @@ void Document::NoteScriptTrackingStatus(const nsACString& aURL,
|
||||
|
||||
bool Document::IsScriptTracking(JSContext* aCx) const {
|
||||
JS::AutoFilename filename;
|
||||
if (!JS::DescribeScriptedCaller(aCx, &filename)) {
|
||||
uint32_t line = 0;
|
||||
uint32_t column = 0;
|
||||
if (!JS::DescribeScriptedCaller(aCx, &filename, &line, &column)) {
|
||||
return false;
|
||||
}
|
||||
return mTrackingScripts.Contains(nsDependentCString(filename.get()));
|
||||
|
@ -5045,14 +5045,14 @@ nsGlobalWindowInner::ShowSlowScriptDialog(JSContext* aCx,
|
||||
|
||||
// Check if we should offer the option to debug
|
||||
JS::AutoFilename filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
// Computing the line number can be very expensive (see bug 1330231 for
|
||||
// example), and we don't use the line number anywhere except than in the
|
||||
// parent process, so we avoid computing it elsewhere. This gives us most of
|
||||
// the wins we are interested in, since the source of the slowness here is
|
||||
// minified scripts which is more common in Web content that is loaded in the
|
||||
// content process.
|
||||
uint32_t* linenop = XRE_IsParentProcess() ? &lineno : nullptr;
|
||||
unsigned* linenop = XRE_IsParentProcess() ? &lineno : nullptr;
|
||||
bool hasFrame = JS::DescribeScriptedCaller(aCx, &filename, linenop);
|
||||
|
||||
// Record the slow script event if we haven't done so already for this inner
|
||||
|
@ -51,13 +51,9 @@ using namespace mozilla::dom;
|
||||
bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||
uint32_t* aLineno, uint32_t* aColumn) {
|
||||
JS::AutoFilename filename;
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, &column)) {
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
if (aColumn) {
|
||||
*aColumn = column.zeroOriginValue();
|
||||
}
|
||||
|
||||
return aFilename.Assign(filename.get(), fallible);
|
||||
}
|
||||
@ -65,13 +61,9 @@ bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
|
||||
bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
|
||||
uint32_t* aLineno, uint32_t* aColumn) {
|
||||
JS::AutoFilename filename;
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, &column)) {
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) {
|
||||
return false;
|
||||
}
|
||||
if (aColumn) {
|
||||
*aColumn = column.zeroOriginValue();
|
||||
}
|
||||
|
||||
return aFilename.Assign(NS_ConvertUTF8toUTF16(filename.get()), fallible);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "jsapi.h"
|
||||
@ -519,7 +518,7 @@ int32_t JSStackFrame::GetColumnNumber(JSContext* aCx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
JS::TaggedColumnNumberOneOrigin col;
|
||||
uint32_t col;
|
||||
bool canCache = false, useCachedValue = false;
|
||||
GetValueIfNotCached(aCx, mStack, JS::GetSavedFrameColumn, mColNoInitialized,
|
||||
&canCache, &useCachedValue, &col);
|
||||
@ -529,11 +528,11 @@ int32_t JSStackFrame::GetColumnNumber(JSContext* aCx) {
|
||||
}
|
||||
|
||||
if (canCache) {
|
||||
mColNo = col.oneOriginValue();
|
||||
mColNo = col;
|
||||
mColNoInitialized = true;
|
||||
}
|
||||
|
||||
return col.oneOriginValue();
|
||||
return col;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -7,7 +7,6 @@
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/loader/LoadedScript.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
@ -979,8 +978,8 @@ nsresult EventListenerManager::SetEventHandler(nsAtom* aName,
|
||||
|
||||
// Perform CSP check
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = doc->GetCsp();
|
||||
uint32_t lineNum = 0;
|
||||
JS::ColumnNumberZeroOrigin columnNum;
|
||||
unsigned lineNum = 0;
|
||||
unsigned columnNum = 0;
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx && !JS::DescribeScriptedCaller(cx, nullptr, &lineNum, &columnNum)) {
|
||||
@ -996,7 +995,7 @@ nsresult EventListenerManager::SetEventHandler(nsAtom* aName,
|
||||
true, // aParserCreated (true because attribute event handler)
|
||||
aElement,
|
||||
nullptr, // nsICSPEventListener
|
||||
aBody, lineNum, columnNum.zeroOriginValue(), &allowsInlineScript);
|
||||
aBody, lineNum, columnNum, &allowsInlineScript);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// return early if CSP wants us to block inline scripts
|
||||
|
@ -178,8 +178,7 @@ bool ClonedErrorHolder::WriteStructuredClone(JSContext* aCx,
|
||||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_CLONED_ERROR_OBJECT, 0) &&
|
||||
WriteStringPair(aWriter, mName, mMessage) &&
|
||||
WriteStringPair(aWriter, mFilename, mSourceLine) &&
|
||||
JS_WriteUint32Pair(aWriter, mLineNumber,
|
||||
*mColumn.addressOfValueForTranscode()) &&
|
||||
JS_WriteUint32Pair(aWriter, mLineNumber, mColumn) &&
|
||||
JS_WriteUint32Pair(aWriter, mTokenOffset, mErrorNumber) &&
|
||||
JS_WriteUint32Pair(aWriter, uint32_t(mType), uint32_t(mExnType)) &&
|
||||
JS_WriteUint32Pair(aWriter, mCode, uint32_t(mResult)) &&
|
||||
@ -194,8 +193,7 @@ bool ClonedErrorHolder::Init(JSContext* aCx, JSStructuredCloneReader* aReader) {
|
||||
uint32_t type, exnType, result, code;
|
||||
if (!(ReadStringPair(aReader, mName, mMessage) &&
|
||||
ReadStringPair(aReader, mFilename, mSourceLine) &&
|
||||
JS_ReadUint32Pair(aReader, &mLineNumber,
|
||||
mColumn.addressOfValueForTranscode()) &&
|
||||
JS_ReadUint32Pair(aReader, &mLineNumber, &mColumn) &&
|
||||
JS_ReadUint32Pair(aReader, &mTokenOffset, &mErrorNumber) &&
|
||||
JS_ReadUint32Pair(aReader, &type, &exnType) &&
|
||||
JS_ReadUint32Pair(aReader, &code, &result) &&
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define mozilla_dom_ClonedErrorHolder_h
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/ErrorReport.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
@ -83,10 +82,10 @@ class ClonedErrorHolder final {
|
||||
nsCString mFilename; // JSError only
|
||||
nsCString mSourceLine; // JSError only
|
||||
|
||||
uint32_t mLineNumber = 0; // JSError only
|
||||
JS::ColumnNumberOneOrigin mColumn; // JSError only
|
||||
uint32_t mTokenOffset = 0; // JSError only
|
||||
uint32_t mErrorNumber = 0; // JSError only
|
||||
uint32_t mLineNumber = 0; // JSError only, (1-origin)
|
||||
uint32_t mColumn = 0; // JSError only, (1-origin)
|
||||
uint32_t mTokenOffset = 0; // JSError only
|
||||
uint32_t mErrorNumber = 0; // JSError only
|
||||
|
||||
Type mType = Type::Uninitialized;
|
||||
|
||||
|
@ -239,7 +239,7 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
|
||||
xpc::ErrorReport::ErrorReportToMessageString(jsReport.report(),
|
||||
details.mMessage);
|
||||
details.mLineno = jsReport.report()->lineno;
|
||||
details.mColno = jsReport.report()->column.oneOriginValue();
|
||||
details.mColno = jsReport.report()->column;
|
||||
MOZ_ASSERT(!jsReport.report()->isMuted);
|
||||
|
||||
SendErrorToMainThread(aTrack, details);
|
||||
|
@ -15,9 +15,7 @@
|
||||
#include "prsystem.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
#include "js/ColumnNumber.h" // #include "js/CompilationAndEvaluation.h"
|
||||
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
#include "js/CompilationAndEvaluation.h"
|
||||
#include "js/ContextOptions.h" // JS::ContextOptionsRef
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
@ -2029,8 +2027,7 @@ nsresult ScriptLoader::FillCompileOptionsForRequest(
|
||||
if (aRequest->GetScriptLoadContext()->mIsInline &&
|
||||
aRequest->GetScriptLoadContext()->GetParserCreated() ==
|
||||
FROM_PARSER_NETWORK) {
|
||||
aOptions->setColumn(JS::ColumnNumberZeroOrigin(
|
||||
aRequest->GetScriptLoadContext()->mColumnNo));
|
||||
aOptions->setColumn(aRequest->GetScriptLoadContext()->mColumnNo);
|
||||
}
|
||||
aOptions->setIsRunOnce(true);
|
||||
aOptions->setNoScriptRval(true);
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "ErrorList.h"
|
||||
#include "js/ArrayBuffer.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/JSON.h"
|
||||
#include "js/Utility.h"
|
||||
#include "js/experimental/TypedData.h"
|
||||
@ -290,8 +289,8 @@ static bool AssertParentProcessWithCallerLocationImpl(GlobalObject& aGlobal,
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
JS::AutoFilename scriptFilename;
|
||||
uint32_t lineNo = 0;
|
||||
JS::ColumnNumberZeroOrigin colNo;
|
||||
unsigned lineNo = 0;
|
||||
unsigned colNo = 0;
|
||||
|
||||
NS_ENSURE_TRUE(
|
||||
JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNo, &colNo), false);
|
||||
@ -299,7 +298,7 @@ static bool AssertParentProcessWithCallerLocationImpl(GlobalObject& aGlobal,
|
||||
NS_ENSURE_TRUE(scriptFilename.get(), false);
|
||||
|
||||
reason.AppendPrintf(" Called from %s:%d:%d.", scriptFilename.get(), lineNo,
|
||||
colNo.zeroOriginValue());
|
||||
colNo);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "mozilla/dom/WebSocketBinding.h"
|
||||
#include "mozilla/net/WebSocketChannel.h"
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
@ -1372,8 +1371,7 @@ already_AddRefed<WebSocket> WebSocket::ConstructorCommon(
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
uint32_t lineno;
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
unsigned lineno, column;
|
||||
JS::AutoFilename file;
|
||||
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno,
|
||||
&column)) {
|
||||
@ -1383,8 +1381,7 @@ already_AddRefed<WebSocket> WebSocket::ConstructorCommon(
|
||||
RefPtr<InitRunnable> runnable = new InitRunnable(
|
||||
workerPrivate, webSocketImpl,
|
||||
workerPrivate->GlobalScope()->GetClientInfo(), !!aTransportProvider,
|
||||
aUrl, protocolArray, nsDependentCString(file.get()), lineno,
|
||||
column.zeroOriginValue());
|
||||
aUrl, protocolArray, nsDependentCString(file.get()), lineno, column);
|
||||
runnable->Dispatch(Canceling, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
@ -1611,13 +1608,12 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure,
|
||||
} else {
|
||||
MOZ_ASSERT(aCx);
|
||||
|
||||
uint32_t lineno;
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
unsigned lineno, column;
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) {
|
||||
mScriptFile = file.get();
|
||||
mScriptLine = lineno;
|
||||
mScriptColumn = column.zeroOriginValue();
|
||||
mScriptColumn = column;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <algorithm>
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/experimental/CTypes.h" // JS::CTypesActivityType, JS::SetCTypesActivityCallback
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
@ -519,7 +518,7 @@ bool ContentSecurityPolicyAllows(JSContext* aCx, JS::RuntimeCode aKind,
|
||||
if (reportViolation) {
|
||||
nsString fileName;
|
||||
uint32_t lineNum = 0;
|
||||
JS::ColumnNumberZeroOrigin columnNum;
|
||||
uint32_t columnNum = 0;
|
||||
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineNum, &columnNum) &&
|
||||
@ -531,8 +530,7 @@ bool ContentSecurityPolicyAllows(JSContext* aCx, JS::RuntimeCode aKind,
|
||||
|
||||
RefPtr<LogViolationDetailsRunnable> runnable =
|
||||
new LogViolationDetailsRunnable(worker, violationType, fileName,
|
||||
lineNum, columnNum.zeroOriginValue(),
|
||||
scriptSample);
|
||||
lineNum, columnNum, scriptSample);
|
||||
|
||||
ErrorResult rv;
|
||||
runnable->Dispatch(Killing, rv);
|
||||
|
@ -226,7 +226,7 @@ class ReportGenericErrorRunnable final : public WorkerDebuggeeRunnable {
|
||||
void WorkerErrorBase::AssignErrorBase(JSErrorBase* aReport) {
|
||||
CopyUTF8toUTF16(MakeStringSpan(aReport->filename.c_str()), mFilename);
|
||||
mLineNumber = aReport->lineno;
|
||||
mColumnNumber = aReport->column.oneOriginValue();
|
||||
mColumnNumber = aReport->column;
|
||||
mErrorNumber = aReport->errorNumber;
|
||||
}
|
||||
|
||||
|
@ -1803,8 +1803,7 @@ static void CheckErrorsAndWarnings(JS::FrontendContext* aFc,
|
||||
NS_WARNING(
|
||||
nsPrintfCString(
|
||||
"Had compilation error in ScriptCompileTask: %s at %s:%u:%u",
|
||||
message, filename, report->lineno,
|
||||
report->column.oneOriginValue())
|
||||
message, filename, report->lineno, report->column)
|
||||
.get());
|
||||
}
|
||||
|
||||
@ -1838,7 +1837,7 @@ static void CheckErrorsAndWarnings(JS::FrontendContext* aFc,
|
||||
NS_WARNING(
|
||||
nsPrintfCString(
|
||||
"Had compilation warning in ScriptCompileTask: %s at %s:%u:%u",
|
||||
message, filename, report->lineno, report->column.oneOriginValue())
|
||||
message, filename, report->lineno, report->column)
|
||||
.get());
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
#include "js/CompilationAndEvaluation.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ContextOptions.h" // JS::ContextOptionsRef
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
@ -223,8 +222,7 @@ JSString* ModuleLoaderBase::ImportMetaResolveImpl(
|
||||
if (result.isErr()) {
|
||||
JS::Rooted<JS::Value> error(aCx);
|
||||
nsresult rv = loader->HandleResolveFailure(
|
||||
aCx, script, specifier, result.unwrapErr(), 0,
|
||||
JS::ColumnNumberZeroOrigin::zero(), &error);
|
||||
aCx, script, specifier, result.unwrapErr(), 0, 0, &error);
|
||||
if (NS_FAILED(rv)) {
|
||||
JS_ReportOutOfMemory(aCx);
|
||||
return nullptr;
|
||||
@ -319,8 +317,7 @@ bool ModuleLoaderBase::HostImportModuleDynamically(
|
||||
if (result.isErr()) {
|
||||
JS::Rooted<JS::Value> error(aCx);
|
||||
nsresult rv = loader->HandleResolveFailure(
|
||||
aCx, script, specifier, result.unwrapErr(), 0,
|
||||
JS::ColumnNumberZeroOrigin::zero(), &error);
|
||||
aCx, script, specifier, result.unwrapErr(), 0, 0, &error);
|
||||
if (NS_FAILED(rv)) {
|
||||
JS_ReportOutOfMemory(aCx);
|
||||
return false;
|
||||
@ -702,8 +699,7 @@ nsresult ModuleLoaderBase::GetResolveFailureMessage(ResolveError aError,
|
||||
|
||||
nsresult ModuleLoaderBase::HandleResolveFailure(
|
||||
JSContext* aCx, LoadedScript* aScript, const nsAString& aSpecifier,
|
||||
ResolveError aError, uint32_t aLineNumber,
|
||||
JS::ColumnNumberZeroOrigin aColumnNumber,
|
||||
ResolveError aError, uint32_t aLineNumber, uint32_t aColumnNumber,
|
||||
JS::MutableHandle<JS::Value> aErrorOut) {
|
||||
JS::Rooted<JSString*> filename(aCx);
|
||||
if (aScript) {
|
||||
@ -728,8 +724,8 @@ nsresult ModuleLoaderBase::HandleResolveFailure(
|
||||
}
|
||||
|
||||
if (!JS::CreateError(aCx, JSEXN_TYPEERR, nullptr, filename, aLineNumber,
|
||||
JS::ColumnNumberOneOrigin(aColumnNumber), nullptr,
|
||||
string, JS::NothingHandleValue, aErrorOut)) {
|
||||
JSErrorBase::fromZeroOriginToOneOrigin(aColumnNumber),
|
||||
nullptr, string, JS::NothingHandleValue, aErrorOut)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -824,7 +820,7 @@ nsresult ModuleLoaderBase::ResolveRequestedModules(
|
||||
auto result = loader->ResolveModuleSpecifier(ms, specifier);
|
||||
if (result.isErr()) {
|
||||
uint32_t lineNumber = 0;
|
||||
JS::ColumnNumberZeroOrigin columnNumber;
|
||||
uint32_t columnNumber = 0;
|
||||
JS::GetRequestedModuleSourcePos(cx, moduleRecord, i, &lineNumber,
|
||||
&columnNumber);
|
||||
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include "ScriptLoadRequest.h"
|
||||
|
||||
#include "ImportMap.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/TypeDecls.h" // JS::MutableHandle, JS::Handle, JS::Root
|
||||
#include "js/TypeDecls.h" // JS::MutableHandle, JS::Handle, JS::Root
|
||||
#include "js/Modules.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsCOMArray.h"
|
||||
@ -356,10 +355,11 @@ class ModuleLoaderBase : public nsISupports {
|
||||
ResolveResult ResolveModuleSpecifier(LoadedScript* aScript,
|
||||
const nsAString& aSpecifier);
|
||||
|
||||
// aColumnNumber is 0-origin.
|
||||
nsresult HandleResolveFailure(JSContext* aCx, LoadedScript* aScript,
|
||||
const nsAString& aSpecifier,
|
||||
ResolveError aError, uint32_t aLineNumber,
|
||||
JS::ColumnNumberZeroOrigin aColumnNumber,
|
||||
uint32_t aColumnNumber,
|
||||
JS::MutableHandle<JS::Value> aErrorOut);
|
||||
|
||||
enum class RestartRequest { No, Yes };
|
||||
|
@ -1,523 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// [SMDOC] Column numbers
|
||||
//
|
||||
// Inside SpiderMonkey, column numbers are represented as 32-bit unsigned
|
||||
// integers, either with 0-origin or 1-origin. Also, some parts of the engine
|
||||
// use the highest bit of a column number as a tag to indicate Wasm frame.
|
||||
//
|
||||
// In a 0-origin context, column 0 is the first character of the line.
|
||||
// In a 1-origin context, column 1 is the first character of the line,
|
||||
// for example:
|
||||
//
|
||||
// function foo() { ... }
|
||||
// ^ ^
|
||||
// 0-origin: 0 15
|
||||
// 1-origin: 1 16
|
||||
//
|
||||
// The column 0 in 1-origin is an invalid sentinel value used in some places,
|
||||
// such as differential testing (bug 1848467).
|
||||
//
|
||||
// These classes help figuring out which origin and tag the column number
|
||||
// uses, and also help converting between them.
|
||||
//
|
||||
// Eventually all SpiderMonkey API and internal use should switch to 1-origin
|
||||
// (bug 1144340).
|
||||
|
||||
#ifndef js_ColumnNumber_h
|
||||
#define js_ColumnNumber_h
|
||||
|
||||
#include "mozilla/Assertions.h" // MOZ_ASSERT
|
||||
#include "mozilla/Attributes.h" // MOZ_IMPLICIT
|
||||
|
||||
#include <limits> // std::numeric_limits
|
||||
#include <stdint.h> // uint32_t
|
||||
|
||||
namespace JS {
|
||||
|
||||
// Wasm function index.
|
||||
//
|
||||
// This class is used as parameter or return type of
|
||||
// TaggedColumnNumberWithOrigin class below.
|
||||
struct WasmFunctionIndex {
|
||||
// TaggedColumnNumberWithOrigin uses the highest bit as a tag.
|
||||
static constexpr uint32_t Limit = std::numeric_limits<int32_t>::max() / 2;
|
||||
|
||||
// For wasm frames, the function index is returned as the column with the
|
||||
// high bit set. In paths that format error stacks into strings, this
|
||||
// information can be used to synthesize a proper wasm frame. But when raw
|
||||
// column numbers are handed out, we just fix them to the first column to
|
||||
// avoid confusion.
|
||||
static constexpr uint32_t DefaultBinarySourceColumnNumberZeroOrigin = 0;
|
||||
static constexpr uint32_t DefaultBinarySourceColumnNumberOneOrigin = 1;
|
||||
|
||||
private:
|
||||
uint32_t value_ = 0;
|
||||
|
||||
public:
|
||||
constexpr WasmFunctionIndex() = default;
|
||||
constexpr WasmFunctionIndex(const WasmFunctionIndex& other) = default;
|
||||
|
||||
inline explicit WasmFunctionIndex(uint32_t value) : value_(value) {
|
||||
MOZ_ASSERT(valid());
|
||||
}
|
||||
|
||||
uint32_t value() const { return value_; }
|
||||
|
||||
bool valid() const { return value_ <= Limit; }
|
||||
};
|
||||
|
||||
// The offset between 2 column numbers.
|
||||
struct ColumnNumberOffset {
|
||||
private:
|
||||
int32_t value_ = 0;
|
||||
|
||||
public:
|
||||
constexpr ColumnNumberOffset() = default;
|
||||
constexpr ColumnNumberOffset(const ColumnNumberOffset& other) = default;
|
||||
|
||||
inline explicit ColumnNumberOffset(int32_t value) : value_(value) {}
|
||||
|
||||
static constexpr ColumnNumberOffset zero() { return ColumnNumberOffset(); }
|
||||
|
||||
bool operator==(const ColumnNumberOffset& rhs) const {
|
||||
return value_ == rhs.value_;
|
||||
}
|
||||
|
||||
bool operator!=(const ColumnNumberOffset& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
int32_t value() const { return value_; }
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct TaggedColumnNumberWithOrigin;
|
||||
|
||||
// Shared implementation of {,Limited}ColumnNumber{Zero,One}Origin classes.
|
||||
//
|
||||
// Origin can be either 0 or 1.
|
||||
// LimitValue being 0 means there's no limit.
|
||||
template <uint32_t Origin, uint32_t LimitValue = 0>
|
||||
struct ColumnNumberWithOrigin {
|
||||
static_assert(Origin == 0 || Origin == 1);
|
||||
|
||||
protected:
|
||||
uint32_t value_ = Origin;
|
||||
|
||||
template <typename T>
|
||||
friend struct TaggedColumnNumberWithOrigin;
|
||||
|
||||
public:
|
||||
constexpr ColumnNumberWithOrigin() = default;
|
||||
ColumnNumberWithOrigin(
|
||||
const ColumnNumberWithOrigin<Origin, LimitValue>& other) = default;
|
||||
|
||||
explicit ColumnNumberWithOrigin(uint32_t value) : value_(value) {
|
||||
MOZ_ASSERT(valid());
|
||||
}
|
||||
|
||||
static constexpr ColumnNumberWithOrigin<Origin, LimitValue> zero() {
|
||||
return ColumnNumberWithOrigin<Origin, LimitValue>();
|
||||
}
|
||||
|
||||
bool operator==(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
return value_ == rhs.value_;
|
||||
}
|
||||
|
||||
bool operator!=(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
ColumnNumberWithOrigin<Origin, LimitValue> operator+(
|
||||
const ColumnNumberOffset& offset) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(ptrdiff_t(value_) + offset.value() >= 0);
|
||||
return ColumnNumberWithOrigin<Origin, LimitValue>(value_ + offset.value());
|
||||
}
|
||||
|
||||
ColumnNumberWithOrigin<Origin, LimitValue> operator-(
|
||||
const ColumnNumberOffset& offset) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(ptrdiff_t(value_) - offset.value() >= 0);
|
||||
return ColumnNumberWithOrigin<Origin, LimitValue>(value_ - offset.value());
|
||||
}
|
||||
ColumnNumberOffset operator-(
|
||||
const ColumnNumberWithOrigin<Origin, LimitValue>& other) const {
|
||||
MOZ_ASSERT(valid());
|
||||
return ColumnNumberOffset(int32_t(value_) -
|
||||
int32_t(other.zeroOriginValue()));
|
||||
}
|
||||
|
||||
ColumnNumberWithOrigin<Origin, LimitValue>& operator+=(
|
||||
const ColumnNumberOffset& offset) {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(ptrdiff_t(value_) + offset.value() >= 0);
|
||||
value_ += offset.value();
|
||||
MOZ_ASSERT(valid());
|
||||
return *this;
|
||||
}
|
||||
ColumnNumberWithOrigin<Origin, LimitValue>& operator-=(
|
||||
const ColumnNumberOffset& offset) {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(ptrdiff_t(value_) - offset.value() >= 0);
|
||||
value_ -= offset.value();
|
||||
MOZ_ASSERT(valid());
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator<(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(rhs.valid());
|
||||
return value_ < rhs.value_;
|
||||
}
|
||||
bool operator<=(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(rhs.valid());
|
||||
return value_ <= rhs.value_;
|
||||
}
|
||||
bool operator>(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(rhs.valid());
|
||||
return value_ > rhs.value_;
|
||||
}
|
||||
bool operator>=(const ColumnNumberWithOrigin<Origin, LimitValue>& rhs) const {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(rhs.valid());
|
||||
return value_ >= rhs.value_;
|
||||
}
|
||||
|
||||
// Convert between origins.
|
||||
uint32_t zeroOriginValue() const {
|
||||
MOZ_ASSERT(valid());
|
||||
|
||||
if constexpr (Origin == 0) {
|
||||
return value_;
|
||||
}
|
||||
|
||||
if (value_ == 0) {
|
||||
// 1-origin uses 0 as special value, but 0-origin doesn't have it.
|
||||
return 0;
|
||||
}
|
||||
return value_ - 1;
|
||||
}
|
||||
uint32_t oneOriginValue() const {
|
||||
MOZ_ASSERT(valid());
|
||||
|
||||
if constexpr (Origin == 0) {
|
||||
return value_ + 1;
|
||||
}
|
||||
|
||||
return value_;
|
||||
}
|
||||
|
||||
uint32_t* addressOfValueForTranscode() { return &value_; }
|
||||
|
||||
bool valid() const {
|
||||
if constexpr (LimitValue == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return value_ <= LimitValue;
|
||||
}
|
||||
};
|
||||
|
||||
// See the comment for LimitedColumnNumberZeroOrigin below
|
||||
static constexpr uint32_t ColumnNumberZeroOriginLimit =
|
||||
std::numeric_limits<int32_t>::max() / 2 - 1;
|
||||
static constexpr uint32_t ColumnNumberOneOriginLimit =
|
||||
std::numeric_limits<int32_t>::max() / 2;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Column number in 0-origin with 31-bit limit.
|
||||
//
|
||||
// Various parts of the engine requires the column number be represented in
|
||||
// 31 bits.
|
||||
//
|
||||
// See:
|
||||
// * TaggedColumnNumberWithOrigin
|
||||
// * TokenStreamAnyChars::checkOptions
|
||||
// * SourceNotes::isRepresentable
|
||||
// * WasmFrameIter::computeLine
|
||||
struct LimitedColumnNumberZeroOrigin
|
||||
: public detail::ColumnNumberWithOrigin<
|
||||
0, detail::ColumnNumberZeroOriginLimit> {
|
||||
private:
|
||||
using Base =
|
||||
detail::ColumnNumberWithOrigin<0, detail::ColumnNumberZeroOriginLimit>;
|
||||
|
||||
public:
|
||||
static constexpr uint32_t Limit = detail::ColumnNumberZeroOriginLimit;
|
||||
|
||||
static_assert(uint32_t(Limit + Limit) > Limit,
|
||||
"Adding Limit should not overflow");
|
||||
|
||||
using Base::Base;
|
||||
|
||||
LimitedColumnNumberZeroOrigin() = default;
|
||||
LimitedColumnNumberZeroOrigin(const LimitedColumnNumberZeroOrigin& other) =
|
||||
default;
|
||||
MOZ_IMPLICIT LimitedColumnNumberZeroOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit LimitedColumnNumberZeroOrigin(
|
||||
const detail::ColumnNumberWithOrigin<
|
||||
1, detail::ColumnNumberOneOriginLimit>& other)
|
||||
: Base(other.zeroOriginValue()) {}
|
||||
|
||||
static LimitedColumnNumberZeroOrigin limit() {
|
||||
return LimitedColumnNumberZeroOrigin(Limit);
|
||||
}
|
||||
|
||||
// Convert from column number without limit.
|
||||
// Column number above the limit is saturated to the limit.
|
||||
static LimitedColumnNumberZeroOrigin fromUnlimited(uint32_t value) {
|
||||
if (value > Limit) {
|
||||
return LimitedColumnNumberZeroOrigin(Limit);
|
||||
}
|
||||
return LimitedColumnNumberZeroOrigin(value);
|
||||
}
|
||||
static LimitedColumnNumberZeroOrigin fromUnlimited(
|
||||
const ColumnNumberWithOrigin<0, 0>& value) {
|
||||
return fromUnlimited(value.zeroOriginValue());
|
||||
}
|
||||
};
|
||||
|
||||
// Column number in 1-origin with 31-bit limit.
|
||||
struct LimitedColumnNumberOneOrigin
|
||||
: public detail::ColumnNumberWithOrigin<
|
||||
1, detail::ColumnNumberOneOriginLimit> {
|
||||
private:
|
||||
using Base =
|
||||
detail::ColumnNumberWithOrigin<1, detail::ColumnNumberOneOriginLimit>;
|
||||
|
||||
public:
|
||||
static constexpr uint32_t Limit = detail::ColumnNumberOneOriginLimit;
|
||||
|
||||
static_assert(uint32_t(Limit + Limit) > Limit,
|
||||
"Adding Limit should not overflow");
|
||||
|
||||
using Base::Base;
|
||||
|
||||
LimitedColumnNumberOneOrigin() = default;
|
||||
LimitedColumnNumberOneOrigin(const LimitedColumnNumberOneOrigin& other) =
|
||||
default;
|
||||
MOZ_IMPLICIT LimitedColumnNumberOneOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit LimitedColumnNumberOneOrigin(
|
||||
const detail::ColumnNumberWithOrigin<
|
||||
0, detail::ColumnNumberZeroOriginLimit>& other)
|
||||
: Base(other.oneOriginValue()) {}
|
||||
|
||||
static LimitedColumnNumberOneOrigin limit() {
|
||||
return LimitedColumnNumberOneOrigin(Limit);
|
||||
}
|
||||
|
||||
static LimitedColumnNumberOneOrigin fromUnlimited(uint32_t value) {
|
||||
if (value > Limit) {
|
||||
return LimitedColumnNumberOneOrigin(Limit);
|
||||
}
|
||||
return LimitedColumnNumberOneOrigin(value);
|
||||
}
|
||||
static LimitedColumnNumberOneOrigin fromUnlimited(
|
||||
const ColumnNumberWithOrigin<1, 0>& value) {
|
||||
return fromUnlimited(value.oneOriginValue());
|
||||
}
|
||||
};
|
||||
|
||||
// Column number in 0-origin.
|
||||
struct ColumnNumberZeroOrigin : public detail::ColumnNumberWithOrigin<0> {
|
||||
private:
|
||||
using Base = detail::ColumnNumberWithOrigin<0>;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
|
||||
ColumnNumberZeroOrigin() = default;
|
||||
ColumnNumberZeroOrigin(const ColumnNumberZeroOrigin& other) = default;
|
||||
MOZ_IMPLICIT ColumnNumberZeroOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit ColumnNumberZeroOrigin(
|
||||
const detail::ColumnNumberWithOrigin<1>& other)
|
||||
: Base(other.zeroOriginValue()) {}
|
||||
|
||||
explicit ColumnNumberZeroOrigin(const LimitedColumnNumberZeroOrigin& other)
|
||||
: Base(other.zeroOriginValue()) {}
|
||||
explicit ColumnNumberZeroOrigin(const LimitedColumnNumberOneOrigin& other)
|
||||
: Base(other.zeroOriginValue()) {}
|
||||
};
|
||||
|
||||
// Column number in 1-origin.
|
||||
struct ColumnNumberOneOrigin : public detail::ColumnNumberWithOrigin<1> {
|
||||
private:
|
||||
using Base = detail::ColumnNumberWithOrigin<1>;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
|
||||
ColumnNumberOneOrigin() = default;
|
||||
ColumnNumberOneOrigin(const ColumnNumberOneOrigin& other) = default;
|
||||
MOZ_IMPLICIT ColumnNumberOneOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit ColumnNumberOneOrigin(const detail::ColumnNumberWithOrigin<0>& other)
|
||||
: Base(other.oneOriginValue()) {}
|
||||
|
||||
explicit ColumnNumberOneOrigin(const LimitedColumnNumberZeroOrigin& other)
|
||||
: Base(other.oneOriginValue()) {}
|
||||
explicit ColumnNumberOneOrigin(const LimitedColumnNumberOneOrigin& other)
|
||||
: Base(other.oneOriginValue()) {}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Either column number with limit, or Wasm function index.
|
||||
//
|
||||
// In order to pass the Wasm frame's (url, bytecode-offset, func-index) tuple
|
||||
// through the existing (url, line, column) tuple, it tags the highest bit of
|
||||
// the column to indicate "this is a wasm frame".
|
||||
//
|
||||
// When knowing clients see this bit, they shall render the tuple
|
||||
// (url, line, column|bit) as "url:wasm-function[column]:0xline" according
|
||||
// to the WebAssembly Web API's Developer-Facing Display Conventions.
|
||||
// https://webassembly.github.io/spec/web-api/index.html#conventions
|
||||
// The wasm bytecode offset continues to be passed as the JS line to avoid
|
||||
// breaking existing devtools code written when this used to be the case.
|
||||
//
|
||||
// 0b0YYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY LimitedColumnNumberT
|
||||
// 0b1YYYYYYY_YYYYYYYY_YYYYYYYY_YYYYYYYY WasmFunctionIndex
|
||||
//
|
||||
// The tagged colum number shouldn't escape the JS engine except for the
|
||||
// following places:
|
||||
// * SavedFrame API which can directly access WASM frame's info
|
||||
// * ubi::Node API which can also directly access WASM frame's info
|
||||
template <typename LimitedColumnNumberT>
|
||||
struct TaggedColumnNumberWithOrigin {
|
||||
static constexpr uint32_t WasmFunctionTag = 1u << 31;
|
||||
|
||||
static_assert((WasmFunctionIndex::Limit & WasmFunctionTag) == 0);
|
||||
static_assert((LimitedColumnNumberT::Limit & WasmFunctionTag) == 0);
|
||||
|
||||
protected:
|
||||
uint32_t value_ = 0;
|
||||
|
||||
explicit TaggedColumnNumberWithOrigin(uint32_t value) : value_(value) {}
|
||||
|
||||
public:
|
||||
constexpr TaggedColumnNumberWithOrigin() = default;
|
||||
TaggedColumnNumberWithOrigin(
|
||||
const TaggedColumnNumberWithOrigin<LimitedColumnNumberT>& other) =
|
||||
default;
|
||||
|
||||
explicit TaggedColumnNumberWithOrigin(const LimitedColumnNumberT& other)
|
||||
: value_(other.value_) {
|
||||
MOZ_ASSERT(isLimitedColumnNumber());
|
||||
}
|
||||
explicit TaggedColumnNumberWithOrigin(const WasmFunctionIndex& other)
|
||||
: value_(other.value() | WasmFunctionTag) {
|
||||
MOZ_ASSERT(isWasmFunctionIndex());
|
||||
}
|
||||
|
||||
static TaggedColumnNumberWithOrigin<LimitedColumnNumberT> fromRaw(
|
||||
uint32_t value) {
|
||||
return TaggedColumnNumberWithOrigin<LimitedColumnNumberT>(value);
|
||||
}
|
||||
|
||||
bool operator==(
|
||||
const TaggedColumnNumberWithOrigin<LimitedColumnNumberT>& rhs) const {
|
||||
return value_ == rhs.value_;
|
||||
}
|
||||
|
||||
bool operator!=(
|
||||
const TaggedColumnNumberWithOrigin<LimitedColumnNumberT>& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool isLimitedColumnNumber() const { return !isWasmFunctionIndex(); }
|
||||
|
||||
bool isWasmFunctionIndex() const { return !!(value_ & WasmFunctionTag); }
|
||||
|
||||
LimitedColumnNumberT toLimitedColumnNumber() const {
|
||||
MOZ_ASSERT(isLimitedColumnNumber());
|
||||
return LimitedColumnNumberT(value_);
|
||||
}
|
||||
|
||||
WasmFunctionIndex toWasmFunctionIndex() const {
|
||||
MOZ_ASSERT(isWasmFunctionIndex());
|
||||
return WasmFunctionIndex(value_ & ~WasmFunctionTag);
|
||||
}
|
||||
|
||||
uint32_t zeroOriginValue() const {
|
||||
return isWasmFunctionIndex()
|
||||
? WasmFunctionIndex::DefaultBinarySourceColumnNumberZeroOrigin
|
||||
: toLimitedColumnNumber().zeroOriginValue();
|
||||
}
|
||||
uint32_t oneOriginValue() const {
|
||||
return isWasmFunctionIndex()
|
||||
? WasmFunctionIndex::DefaultBinarySourceColumnNumberOneOrigin
|
||||
: toLimitedColumnNumber().oneOriginValue();
|
||||
}
|
||||
|
||||
uint32_t rawValue() const { return value_; }
|
||||
|
||||
uint32_t* addressOfValueForTranscode() { return &value_; }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class TaggedColumnNumberZeroOrigin
|
||||
: public detail::TaggedColumnNumberWithOrigin<
|
||||
LimitedColumnNumberZeroOrigin> {
|
||||
private:
|
||||
using Base =
|
||||
detail::TaggedColumnNumberWithOrigin<LimitedColumnNumberZeroOrigin>;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
using Base::WasmFunctionTag;
|
||||
|
||||
TaggedColumnNumberZeroOrigin() = default;
|
||||
TaggedColumnNumberZeroOrigin(const TaggedColumnNumberZeroOrigin& other) =
|
||||
default;
|
||||
MOZ_IMPLICIT TaggedColumnNumberZeroOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit TaggedColumnNumberZeroOrigin(
|
||||
const detail::TaggedColumnNumberWithOrigin<LimitedColumnNumberOneOrigin>&
|
||||
other)
|
||||
: Base(other.isWasmFunctionIndex() ? other.rawValue()
|
||||
: other.zeroOriginValue()) {}
|
||||
};
|
||||
|
||||
class TaggedColumnNumberOneOrigin : public detail::TaggedColumnNumberWithOrigin<
|
||||
LimitedColumnNumberOneOrigin> {
|
||||
private:
|
||||
using Base =
|
||||
detail::TaggedColumnNumberWithOrigin<LimitedColumnNumberOneOrigin>;
|
||||
|
||||
public:
|
||||
using Base::Base;
|
||||
using Base::WasmFunctionTag;
|
||||
|
||||
TaggedColumnNumberOneOrigin() = default;
|
||||
TaggedColumnNumberOneOrigin(const TaggedColumnNumberOneOrigin& other) =
|
||||
default;
|
||||
MOZ_IMPLICIT TaggedColumnNumberOneOrigin(const Base& other) : Base(other) {}
|
||||
|
||||
explicit TaggedColumnNumberOneOrigin(
|
||||
const detail::TaggedColumnNumberWithOrigin<LimitedColumnNumberZeroOrigin>&
|
||||
other)
|
||||
: Base(other.isWasmFunctionIndex() ? other.rawValue()
|
||||
: other.oneOriginValue()) {}
|
||||
|
||||
static TaggedColumnNumberOneOrigin forDifferentialTesting() {
|
||||
return TaggedColumnNumberOneOrigin(LimitedColumnNumberOneOrigin(0));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif /* js_ColumnNumber_h */
|
@ -61,7 +61,6 @@
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/TypeDecls.h" // JS::MutableHandle (fwd)
|
||||
|
||||
namespace js {
|
||||
@ -455,9 +454,9 @@ class JS_PUBLIC_API ReadOnlyCompileOptions : public TransitiveCompileOptions {
|
||||
// POD options.
|
||||
|
||||
// Line number of the first character (1-origin).
|
||||
uint32_t lineno = 1;
|
||||
// Column number of the first character in UTF-16 code units.
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
unsigned lineno = 1;
|
||||
// Column number of the first character in UTF-16 code units (0-origin).
|
||||
unsigned column = 0;
|
||||
|
||||
// The offset within the ScriptSource's full uncompressed text of the first
|
||||
// character we're presenting for compilation with this CompileOptions.
|
||||
@ -491,7 +490,7 @@ class JS_PUBLIC_API ReadOnlyCompileOptions : public TransitiveCompileOptions {
|
||||
this->TransitiveCompileOptions::dumpWith(print);
|
||||
# define PrintFields_(Name) print(#Name, Name)
|
||||
PrintFields_(lineno);
|
||||
print("column", column.zeroOriginValue());
|
||||
PrintFields_(column);
|
||||
PrintFields_(scriptSourceOffset);
|
||||
PrintFields_(isRunOnce);
|
||||
PrintFields_(noScriptRval);
|
||||
@ -602,12 +601,12 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setLine(uint32_t l) {
|
||||
CompileOptions& setLine(unsigned l) {
|
||||
lineno = l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setFileAndLine(const char* f, uint32_t l) {
|
||||
CompileOptions& setFileAndLine(const char* f, unsigned l) {
|
||||
filename_ = JS::ConstUTF8CharsZ(f);
|
||||
lineno = l;
|
||||
return *this;
|
||||
@ -623,7 +622,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
return *this;
|
||||
}
|
||||
|
||||
CompileOptions& setColumn(JS::ColumnNumberZeroOrigin c) {
|
||||
CompileOptions& setColumn(unsigned c) {
|
||||
column = c;
|
||||
return *this;
|
||||
}
|
||||
@ -679,7 +678,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final
|
||||
}
|
||||
|
||||
CompileOptions& setIntroductionInfo(const char* introducerFn,
|
||||
const char* intro, uint32_t line,
|
||||
const char* intro, unsigned line,
|
||||
uint32_t offset) {
|
||||
introducerFilename_ = JS::ConstUTF8CharsZ(introducerFn);
|
||||
introductionType = intro;
|
||||
@ -788,7 +787,7 @@ class JS_PUBLIC_API ReadOnlyDecodeOptions {
|
||||
// See `TransitiveCompileOptions::introductionType` field for details.
|
||||
const char* introductionType = nullptr;
|
||||
|
||||
uint32_t introductionLineno = 0;
|
||||
unsigned introductionLineno = 0;
|
||||
uint32_t introductionOffset = 0;
|
||||
|
||||
protected:
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include "js/AllocPolicy.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/RootingAPI.h" // JS::HandleObject, JS::RootedObject
|
||||
#include "js/UniquePtr.h" // js::UniquePtr
|
||||
#include "js/Value.h" // JS::Value
|
||||
@ -119,10 +118,10 @@ class JSErrorBase {
|
||||
unsigned sourceId;
|
||||
|
||||
// Source line number (1-origin).
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
|
||||
// Column number in line in UTF-16 code units.
|
||||
JS::ColumnNumberOneOrigin column;
|
||||
// Column number in line in UTF-16 code units (1-origin).
|
||||
unsigned column;
|
||||
|
||||
// the error number, e.g. see js/public/friend/ErrorNumbers.msg.
|
||||
unsigned errorNumber;
|
||||
@ -139,6 +138,7 @@ class JSErrorBase {
|
||||
: filename(nullptr),
|
||||
sourceId(0),
|
||||
lineno(0),
|
||||
column(0),
|
||||
errorNumber(0),
|
||||
errorMessageName(nullptr),
|
||||
ownsMessage_(false) {}
|
||||
@ -172,6 +172,13 @@ class JSErrorBase {
|
||||
|
||||
JSString* newMessageString(JSContext* cx);
|
||||
|
||||
// JSErrorBase uses 1-origin column numbers.
|
||||
// If the caller uses 0-origin column numbers, this method should be used to
|
||||
// convert (bug 1144340).
|
||||
static uint32_t fromZeroOriginToOneOrigin(uint32_t column) {
|
||||
return column + 1;
|
||||
}
|
||||
|
||||
private:
|
||||
void freeMessage();
|
||||
};
|
||||
@ -188,8 +195,7 @@ class JSErrorNotes {
|
||||
js::Vector<js::UniquePtr<Note>, 1, js::SystemAllocPolicy> notes_;
|
||||
|
||||
bool addNoteVA(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
unsigned sourceId, unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber,
|
||||
js::ErrorArgumentsType argumentsType, va_list ap);
|
||||
@ -199,31 +205,29 @@ class JSErrorNotes {
|
||||
~JSErrorNotes();
|
||||
|
||||
// Add a note to the given position.
|
||||
// column is 1-origin.
|
||||
bool addNoteASCII(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteASCII(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
unsigned sourceId, unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteLatin1(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteLatin1(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
unsigned sourceId, unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteUTF8(JSContext* cx, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
bool addNoteUTF8(js::FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
unsigned sourceId, unsigned lineno, unsigned column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...);
|
||||
|
||||
@ -534,11 +538,12 @@ extern JS_PUBLIC_API void JS_ReportAllocationOverflow(JSContext* cx);
|
||||
|
||||
namespace JS {
|
||||
|
||||
// columnNumber is 1-origin.
|
||||
extern JS_PUBLIC_API bool CreateError(
|
||||
JSContext* cx, JSExnType type, HandleObject stack, HandleString fileName,
|
||||
uint32_t lineNumber, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorReport* report, HandleString message,
|
||||
Handle<mozilla::Maybe<Value>> cause, MutableHandleValue rval);
|
||||
uint32_t lineNumber, uint32_t columnNumber, JSErrorReport* report,
|
||||
HandleString message, Handle<mozilla::Maybe<Value>> cause,
|
||||
MutableHandleValue rval);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define js_JitCodeAPI_h
|
||||
|
||||
#include "js/AllocPolicy.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/Initialization.h"
|
||||
#include "js/Printf.h"
|
||||
#include "js/Vector.h"
|
||||
@ -40,8 +39,8 @@ struct JitCodeSourceInfo {
|
||||
|
||||
// Line number (1-origin).
|
||||
uint32_t lineno = 0;
|
||||
// Column number in UTF-16 code units.
|
||||
JS::LimitedColumnNumberZeroOrigin colno;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
uint32_t colno = 0;
|
||||
};
|
||||
|
||||
struct JitCodeIRInfo {
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/AllocPolicy.h" // js::SystemAllocPolicy
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/CompileOptions.h" // JS::ReadOnlyCompileOptions
|
||||
#include "js/RootingAPI.h" // JS::{Mutable,}Handle
|
||||
#include "js/Value.h" // JS::Value
|
||||
@ -266,10 +265,11 @@ extern JS_PUBLIC_API JSString* GetRequestedModuleSpecifier(
|
||||
|
||||
/*
|
||||
* Get the position of a requested module's name in the source.
|
||||
* lineNumber is 1-origin, and columnNumber is 0-origin.
|
||||
*/
|
||||
extern JS_PUBLIC_API void GetRequestedModuleSourcePos(
|
||||
JSContext* cx, Handle<JSObject*> moduleRecord, uint32_t index,
|
||||
uint32_t* lineNumber, JS::ColumnNumberZeroOrigin* columnNumber);
|
||||
uint32_t* lineNumber, uint32_t* columnNumber);
|
||||
|
||||
/*
|
||||
* Get the top-level script for a module which has not yet been executed.
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
struct JSPrincipals;
|
||||
@ -83,11 +82,12 @@ extern JS_PUBLIC_API SavedFrameResult GetSavedFrameLine(
|
||||
SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
|
||||
|
||||
/**
|
||||
* Given a SavedFrame JSObject, get its column property. Defaults to 0.
|
||||
* Given a SavedFrame JSObject, get its column property (1-origin).
|
||||
* Defaults to 0.
|
||||
*/
|
||||
extern JS_PUBLIC_API SavedFrameResult GetSavedFrameColumn(
|
||||
JSContext* cx, JSPrincipals* principals, Handle<JSObject*> savedFrame,
|
||||
JS::TaggedColumnNumberOneOrigin* columnp,
|
||||
uint32_t* columnp,
|
||||
SavedFrameSelfHosted selfHosted = SavedFrameSelfHosted::Include);
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "jspubtd.h"
|
||||
|
||||
#include "js/AllocPolicy.h"
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/HashTable.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/TypeDecls.h"
|
||||
@ -249,8 +248,8 @@ class BaseStackFrame {
|
||||
// Get this frame's line number (1-origin).
|
||||
virtual uint32_t line() const = 0;
|
||||
|
||||
// Get this frame's column number in UTF-16 code units.
|
||||
virtual JS::TaggedColumnNumberOneOrigin column() const = 0;
|
||||
// Get this frame's column number in UTF-16 code units (1-origin).
|
||||
virtual uint32_t column() const = 0;
|
||||
|
||||
// Get this frame's source name. Never null.
|
||||
virtual AtomOrTwoByteChars source() const = 0;
|
||||
@ -422,7 +421,7 @@ class StackFrame {
|
||||
return id;
|
||||
}
|
||||
uint32_t line() const { return base()->line(); }
|
||||
JS::TaggedColumnNumberOneOrigin column() const { return base()->column(); }
|
||||
uint32_t column() const { return base()->column(); }
|
||||
AtomOrTwoByteChars source() const { return base()->source(); }
|
||||
uint32_t sourceId() const { return base()->sourceId(); }
|
||||
AtomOrTwoByteChars functionDisplayName() const {
|
||||
@ -471,9 +470,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
|
||||
}
|
||||
|
||||
uint32_t line() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
|
||||
JS::TaggedColumnNumberOneOrigin column() const override {
|
||||
MOZ_CRASH("null JS::ubi::StackFrame");
|
||||
}
|
||||
uint32_t column() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
|
||||
AtomOrTwoByteChars source() const override {
|
||||
MOZ_CRASH("null JS::ubi::StackFrame");
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ static bool EvalKernel(JSContext* cx, HandleValue v, EvalType evalType,
|
||||
|
||||
if (!esg.foundScript()) {
|
||||
RootedScript maybeScript(cx);
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
const char* filename;
|
||||
bool mutedErrors;
|
||||
uint32_t pcOffset;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "frontend/Stencil.h"
|
||||
#include "gc/GCContext.h"
|
||||
#include "gc/Tracer.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/Modules.h" // JS::GetModulePrivate, JS::ModuleDynamicImportHook
|
||||
#include "vm/EqualityOperations.h" // js::SameValue
|
||||
@ -86,7 +85,7 @@ static Value StringOrNullValue(JSString* maybeString) {
|
||||
ImportEntry::ImportEntry(Handle<ModuleRequestObject*> moduleRequest,
|
||||
Handle<JSAtom*> maybeImportName,
|
||||
Handle<JSAtom*> localName, uint32_t lineNumber,
|
||||
JS::ColumnNumberZeroOrigin columnNumber)
|
||||
uint32_t columnNumber)
|
||||
: moduleRequest_(moduleRequest),
|
||||
importName_(maybeImportName),
|
||||
localName_(localName),
|
||||
@ -106,7 +105,7 @@ ExportEntry::ExportEntry(Handle<JSAtom*> maybeExportName,
|
||||
Handle<ModuleRequestObject*> moduleRequest,
|
||||
Handle<JSAtom*> maybeImportName,
|
||||
Handle<JSAtom*> maybeLocalName, uint32_t lineNumber,
|
||||
JS::ColumnNumberZeroOrigin columnNumber)
|
||||
uint32_t columnNumber)
|
||||
: exportName_(maybeExportName),
|
||||
moduleRequest_(moduleRequest),
|
||||
importName_(maybeImportName),
|
||||
@ -129,8 +128,7 @@ void ExportEntry::trace(JSTracer* trc) {
|
||||
|
||||
/* static */
|
||||
RequestedModule::RequestedModule(Handle<ModuleRequestObject*> moduleRequest,
|
||||
uint32_t lineNumber,
|
||||
JS::ColumnNumberZeroOrigin columnNumber)
|
||||
uint32_t lineNumber, uint32_t columnNumber)
|
||||
: moduleRequest_(moduleRequest),
|
||||
lineNumber_(lineNumber),
|
||||
columnNumber_(columnNumber) {}
|
||||
@ -1724,7 +1722,7 @@ bool ModuleBuilder::processImport(frontend::BinaryNode* importNode) {
|
||||
|
||||
for (ParseNode* item : specList->contents()) {
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t column;
|
||||
eitherParser_.computeLineAndColumn(item->pn_pos.begin, &line, &column);
|
||||
|
||||
StencilModuleEntry entry;
|
||||
@ -1740,9 +1738,8 @@ bool ModuleBuilder::processImport(frontend::BinaryNode* importNode) {
|
||||
|
||||
markUsedByStencil(localName);
|
||||
markUsedByStencil(importName);
|
||||
entry = StencilModuleEntry::importEntry(
|
||||
moduleRequestIndex, localName, importName, line,
|
||||
JS::ColumnNumberZeroOrigin(column));
|
||||
entry = StencilModuleEntry::importEntry(moduleRequestIndex, localName,
|
||||
importName, line, column);
|
||||
} else {
|
||||
MOZ_ASSERT(item->isKind(ParseNodeKind::ImportNamespaceSpec));
|
||||
auto* spec = &item->as<UnaryNode>();
|
||||
@ -1752,9 +1749,8 @@ bool ModuleBuilder::processImport(frontend::BinaryNode* importNode) {
|
||||
localName = localNameNode->atom();
|
||||
|
||||
markUsedByStencil(localName);
|
||||
entry = StencilModuleEntry::importNamespaceEntry(
|
||||
moduleRequestIndex, localName, line,
|
||||
JS::ColumnNumberZeroOrigin(column));
|
||||
entry = StencilModuleEntry::importNamespaceEntry(moduleRequestIndex,
|
||||
localName, line, column);
|
||||
}
|
||||
|
||||
if (!importEntries_.put(localName, entry)) {
|
||||
@ -1969,7 +1965,7 @@ bool ModuleBuilder::processExportFrom(frontend::BinaryNode* exportNode) {
|
||||
|
||||
for (ParseNode* spec : specList->contents()) {
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t column;
|
||||
eitherParser_.computeLineAndColumn(spec->pn_pos.begin, &line, &column);
|
||||
|
||||
StencilModuleEntry entry;
|
||||
@ -1984,8 +1980,7 @@ bool ModuleBuilder::processExportFrom(frontend::BinaryNode* exportNode) {
|
||||
markUsedByStencil(importName);
|
||||
markUsedByStencil(exportName);
|
||||
entry = StencilModuleEntry::exportFromEntry(
|
||||
moduleRequestIndex, importName, exportName, line,
|
||||
JS::ColumnNumberZeroOrigin(column));
|
||||
moduleRequestIndex, importName, exportName, line, column);
|
||||
} else if (spec->isKind(ParseNodeKind::ExportNamespaceSpec)) {
|
||||
auto* exportNameNode = &spec->as<UnaryNode>().kid()->as<NameNode>();
|
||||
|
||||
@ -1993,13 +1988,12 @@ bool ModuleBuilder::processExportFrom(frontend::BinaryNode* exportNode) {
|
||||
|
||||
markUsedByStencil(exportName);
|
||||
entry = StencilModuleEntry::exportNamespaceFromEntry(
|
||||
moduleRequestIndex, exportName, line,
|
||||
JS::ColumnNumberZeroOrigin(column));
|
||||
moduleRequestIndex, exportName, line, column);
|
||||
} else {
|
||||
MOZ_ASSERT(spec->isKind(ParseNodeKind::ExportBatchSpecStmt));
|
||||
|
||||
entry = StencilModuleEntry::exportBatchFromEntry(
|
||||
moduleRequestIndex, line, JS::ColumnNumberZeroOrigin(column));
|
||||
entry = StencilModuleEntry::exportBatchFromEntry(moduleRequestIndex, line,
|
||||
column);
|
||||
}
|
||||
|
||||
if (!exportEntries_.append(entry)) {
|
||||
@ -2034,7 +2028,7 @@ bool ModuleBuilder::appendExportEntry(
|
||||
frontend::TaggedParserAtomIndex exportName,
|
||||
frontend::TaggedParserAtomIndex localName, frontend::ParseNode* node) {
|
||||
uint32_t line = 0;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t column = 0;
|
||||
if (node) {
|
||||
eitherParser_.computeLineAndColumn(node->pn_pos.begin, &line, &column);
|
||||
}
|
||||
@ -2042,7 +2036,7 @@ bool ModuleBuilder::appendExportEntry(
|
||||
markUsedByStencil(localName);
|
||||
markUsedByStencil(exportName);
|
||||
auto entry = frontend::StencilModuleEntry::exportAsEntry(
|
||||
localName, exportName, line, JS::ColumnNumberZeroOrigin(column));
|
||||
localName, exportName, line, column);
|
||||
if (!exportEntries_.append(entry)) {
|
||||
return false;
|
||||
}
|
||||
@ -2081,11 +2075,11 @@ bool ModuleBuilder::maybeAppendRequestedModule(
|
||||
}
|
||||
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t column;
|
||||
eitherParser_.computeLineAndColumn(node->pn_pos.begin, &line, &column);
|
||||
|
||||
auto entry = frontend::StencilModuleEntry::requestedModule(
|
||||
moduleRequest, line, JS::ColumnNumberZeroOrigin(column));
|
||||
auto entry = frontend::StencilModuleEntry::requestedModule(moduleRequest,
|
||||
line, column);
|
||||
|
||||
if (!requestedModules_.append(entry)) {
|
||||
js::ReportOutOfMemory(fc_);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "gc/Barrier.h" // HeapPtr
|
||||
#include "gc/ZoneAllocator.h" // CellAllocPolicy
|
||||
#include "js/Class.h" // JSClass, ObjectOpResult
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/GCVector.h"
|
||||
#include "js/Id.h" // jsid
|
||||
#include "js/Modules.h"
|
||||
@ -74,19 +73,19 @@ class ImportEntry {
|
||||
// Line number (1-origin).
|
||||
const uint32_t lineNumber_;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
const JS::ColumnNumberZeroOrigin columnNumber_;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
const uint32_t columnNumber_;
|
||||
|
||||
public:
|
||||
ImportEntry(Handle<ModuleRequestObject*> moduleRequest,
|
||||
Handle<JSAtom*> maybeImportName, Handle<JSAtom*> localName,
|
||||
uint32_t lineNumber, JS::ColumnNumberZeroOrigin columnNumber);
|
||||
uint32_t lineNumber, uint32_t columnNumber);
|
||||
|
||||
ModuleRequestObject* moduleRequest() const { return moduleRequest_; }
|
||||
JSAtom* importName() const { return importName_; }
|
||||
JSAtom* localName() const { return localName_; }
|
||||
uint32_t lineNumber() const { return lineNumber_; }
|
||||
JS::ColumnNumberZeroOrigin columnNumber() const { return columnNumber_; }
|
||||
uint32_t columnNumber() const { return columnNumber_; }
|
||||
|
||||
void trace(JSTracer* trc);
|
||||
};
|
||||
@ -102,20 +101,20 @@ class ExportEntry {
|
||||
// Line number (1-origin).
|
||||
const uint32_t lineNumber_;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
const JS::ColumnNumberZeroOrigin columnNumber_;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
const uint32_t columnNumber_;
|
||||
|
||||
public:
|
||||
ExportEntry(Handle<JSAtom*> maybeExportName,
|
||||
Handle<ModuleRequestObject*> maybeModuleRequest,
|
||||
Handle<JSAtom*> maybeImportName, Handle<JSAtom*> maybeLocalName,
|
||||
uint32_t lineNumber, JS::ColumnNumberZeroOrigin columnNumber);
|
||||
uint32_t lineNumber, uint32_t columnNumber);
|
||||
JSAtom* exportName() const { return exportName_; }
|
||||
ModuleRequestObject* moduleRequest() const { return moduleRequest_; }
|
||||
JSAtom* importName() const { return importName_; }
|
||||
JSAtom* localName() const { return localName_; }
|
||||
uint32_t lineNumber() const { return lineNumber_; }
|
||||
JS::ColumnNumberZeroOrigin columnNumber() const { return columnNumber_; }
|
||||
uint32_t columnNumber() const { return columnNumber_; }
|
||||
|
||||
void trace(JSTracer* trc);
|
||||
};
|
||||
@ -128,15 +127,15 @@ class RequestedModule {
|
||||
// Line number (1-origin).
|
||||
const uint32_t lineNumber_;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
const JS::ColumnNumberZeroOrigin columnNumber_;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
const uint32_t columnNumber_;
|
||||
|
||||
public:
|
||||
RequestedModule(Handle<ModuleRequestObject*> moduleRequest,
|
||||
uint32_t lineNumber, JS::ColumnNumberZeroOrigin columnNumber);
|
||||
uint32_t lineNumber, uint32_t columnNumber);
|
||||
ModuleRequestObject* moduleRequest() const { return moduleRequest_; }
|
||||
uint32_t lineNumber() const { return lineNumber_; }
|
||||
JS::ColumnNumberZeroOrigin columnNumber() const { return columnNumber_; }
|
||||
uint32_t columnNumber() const { return columnNumber_; }
|
||||
|
||||
void trace(JSTracer* trc);
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "frontend/ModuleSharedContext.h"
|
||||
#include "frontend/ParseNode.h"
|
||||
#include "frontend/Parser.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/friend/StackLimits.h" // js::AutoCheckRecursionLimit
|
||||
#include "js/PropertyAndElement.h" // JS_DefineFunction
|
||||
@ -726,8 +725,8 @@ bool NodeBuilder::newNodeLoc(TokenPos* pos, MutableHandleValue dst) {
|
||||
|
||||
dst.setObject(*loc);
|
||||
|
||||
uint32_t startLineNum, endLineNum;
|
||||
JS::LimitedColumnNumberZeroOrigin startColumnIndex, endColumnIndex;
|
||||
uint32_t startLineNum, startColumnIndex;
|
||||
uint32_t endLineNum, endColumnIndex;
|
||||
parser->tokenStream.computeLineAndColumn(pos->begin, &startLineNum,
|
||||
&startColumnIndex);
|
||||
parser->tokenStream.computeLineAndColumn(pos->end, &endLineNum,
|
||||
@ -744,7 +743,7 @@ bool NodeBuilder::newNodeLoc(TokenPos* pos, MutableHandleValue dst) {
|
||||
if (!defineProperty(to, "line", val)) {
|
||||
return false;
|
||||
}
|
||||
val.setNumber(startColumnIndex.zeroOriginValue());
|
||||
val.setNumber(startColumnIndex);
|
||||
if (!defineProperty(to, "column", val)) {
|
||||
return false;
|
||||
}
|
||||
@ -760,7 +759,7 @@ bool NodeBuilder::newNodeLoc(TokenPos* pos, MutableHandleValue dst) {
|
||||
if (!defineProperty(to, "line", val)) {
|
||||
return false;
|
||||
}
|
||||
val.setNumber(endColumnIndex.zeroOriginValue());
|
||||
val.setNumber(endColumnIndex);
|
||||
if (!defineProperty(to, "column", val)) {
|
||||
return false;
|
||||
}
|
||||
@ -3764,9 +3763,8 @@ static bool reflect_parse(JSContext* cx, uint32_t argc, Value* vp) {
|
||||
ModuleBuilder builder(&fc, &parser);
|
||||
|
||||
uint32_t len = chars.length();
|
||||
SourceExtent extent = SourceExtent::makeGlobalExtent(
|
||||
len, options.lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(options.column));
|
||||
SourceExtent extent =
|
||||
SourceExtent::makeGlobalExtent(len, options.lineno, options.column);
|
||||
ModuleSharedContext modulesc(&fc, options, builder, extent);
|
||||
pn = parser.moduleBody(&modulesc);
|
||||
if (!pn) {
|
||||
|
@ -232,7 +232,7 @@ static bool PerformShadowRealmEval(JSContext* cx, Handle<JSString*> sourceText,
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1770017
|
||||
RootedScript callerScript(cx);
|
||||
const char* filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &callerScript, &filename, &lineno,
|
||||
@ -419,7 +419,7 @@ static JSObject* ShadowRealmImportValue(JSContext* cx,
|
||||
// Not Speced: Get referencing private to pass to importHook.
|
||||
RootedScript script(cx);
|
||||
const char* filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &script, &filename, &lineno,
|
||||
|
@ -6661,7 +6661,7 @@ static bool EvalReturningScope(JSContext* cx, unsigned argc, Value* vp) {
|
||||
}
|
||||
|
||||
JS::AutoFilename filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
|
||||
JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "jsapi.h" // JS_NewPlainObject, JS_WrapValue
|
||||
#include "js/CharacterEncoding.h" // JS_EncodeStringToUTF8
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/CompileOptions.h" // JS::CompileOptions
|
||||
#include "js/Conversions.h" // JS::ToBoolean, JS::ToString, JS::ToUint32, JS::ToInt32
|
||||
#include "js/PropertyAndElement.h" // JS_GetProperty, JS_DefineProperty
|
||||
@ -85,7 +84,7 @@ bool js::ParseCompileOptions(JSContext* cx, JS::CompileOptions& options,
|
||||
if (!JS::ToInt32(cx, v, &c)) {
|
||||
return false;
|
||||
}
|
||||
options.setColumn(JS::ColumnNumberZeroOrigin(c));
|
||||
options.setColumn(c);
|
||||
}
|
||||
|
||||
if (!JS_GetProperty(cx, opts, "sourceIsLazy", &v)) {
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include "debugger/NoExecute.h" // for LeaveDebuggeeNoExecute
|
||||
#include "debugger/Script.h" // for DebuggerScript
|
||||
#include "debugger/Source.h" // for DebuggerSource
|
||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||
#include "js/CompilationAndEvaluation.h" // for Compile
|
||||
#include "js/Conversions.h" // for ToObject
|
||||
#include "js/experimental/JitInfo.h" // for JSJitInfo
|
||||
@ -1261,7 +1260,7 @@ bool DebuggerObject::CallData::createSource() {
|
||||
|
||||
JS::CompileOptions compileOptions(cx);
|
||||
compileOptions.lineno = startLine;
|
||||
compileOptions.column = JS::ColumnNumberZeroOrigin(startColumn);
|
||||
compileOptions.column = startColumn;
|
||||
|
||||
if (!JS::StringHasLatin1Chars(url)) {
|
||||
JS_ReportErrorASCII(cx, "URL must be a narrow string");
|
||||
@ -1926,7 +1925,7 @@ bool DebuggerObject::getErrorColumnNumber(JSContext* cx,
|
||||
return true;
|
||||
}
|
||||
|
||||
result.setNumber(report->column.oneOriginValue());
|
||||
result.setNumber(report->column);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "mozilla/Vector.h" // for Vector
|
||||
|
||||
#include <stddef.h> // for ptrdiff_t
|
||||
#include <stdint.h> // for uint32_t, UINT32_MAX, SIZE_MAX, int32_t
|
||||
#include <stdint.h> // for uint32_t, SIZE_MAX, int32_t
|
||||
|
||||
#include "jsnum.h" // for ToNumber
|
||||
#include "NamespaceImports.h" // for CallArgs, RootedValue
|
||||
@ -25,7 +25,6 @@
|
||||
#include "gc/Zone.h" // for Zone
|
||||
#include "gc/ZoneAllocator.h" // for AddCellMemory
|
||||
#include "js/CallArgs.h" // for CallArgs, CallArgsFromVp
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::WasmFunctionIndex
|
||||
#include "js/friend/ErrorMessages.h" // for GetErrorMessage, JSMSG_*
|
||||
#include "js/GCVariant.h" // for GCVariant
|
||||
#include "js/HeapAPI.h" // for GCCellPtr
|
||||
@ -373,11 +372,9 @@ bool DebuggerScript::CallData::getStartLine() {
|
||||
}
|
||||
|
||||
bool DebuggerScript::CallData::getStartColumn() {
|
||||
args.rval().setNumber(referent.get().match(
|
||||
[](BaseScript*& s) { return s->column().zeroOriginValue(); },
|
||||
[](WasmInstanceObject*&) {
|
||||
return JS::WasmFunctionIndex::DefaultBinarySourceColumnNumberZeroOrigin;
|
||||
}));
|
||||
args.rval().setNumber(
|
||||
referent.get().match([](BaseScript*& s) { return s->column(); },
|
||||
[](WasmInstanceObject*&) { return (uint32_t)0; }));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -626,13 +623,12 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
Maybe<size_t> minOffset;
|
||||
Maybe<size_t> maxOffset;
|
||||
|
||||
Maybe<uint32_t> minLine;
|
||||
JS::LimitedColumnNumberZeroOrigin minColumn;
|
||||
Maybe<uint32_t> maxLine;
|
||||
JS::LimitedColumnNumberZeroOrigin maxColumn;
|
||||
Maybe<size_t> minLine;
|
||||
size_t minColumn;
|
||||
Maybe<size_t> maxLine;
|
||||
size_t maxColumn;
|
||||
|
||||
bool passesQuery(size_t offset, uint32_t lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin colno) {
|
||||
bool passesQuery(size_t offset, size_t lineno, size_t colno) {
|
||||
// [minOffset, maxOffset) - Inclusive minimum and exclusive maximum.
|
||||
if ((minOffset && offset < *minOffset) ||
|
||||
(maxOffset && offset >= *maxOffset)) {
|
||||
@ -654,8 +650,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool maybeAppendEntry(size_t offset, uint32_t lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin colno,
|
||||
bool maybeAppendEntry(size_t offset, size_t lineno, size_t colno,
|
||||
bool isStepStart) {
|
||||
if (!passesQuery(offset, lineno, colno)) {
|
||||
return true;
|
||||
@ -684,7 +679,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(colno.zeroOriginValue());
|
||||
value = NumberValue(colno);
|
||||
if (!DefineDataProperty(cx_, entry, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -700,8 +695,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool parseIntValueImpl(HandleValue value, T* result) {
|
||||
bool parseIntValue(HandleValue value, size_t* result) {
|
||||
if (!value.isNumber()) {
|
||||
return false;
|
||||
}
|
||||
@ -715,21 +709,9 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseIntValue(HandleValue value, uint32_t* result) {
|
||||
return parseIntValueImpl(value, result);
|
||||
}
|
||||
bool parseIntValue(HandleValue value,
|
||||
JS::LimitedColumnNumberZeroOrigin* result) {
|
||||
return parseIntValueImpl(value, result->addressOfValueForTranscode());
|
||||
}
|
||||
bool parseIntValue(HandleValue value, size_t* result) {
|
||||
return parseIntValueImpl(value, result);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool parseIntValueMaybeImpl(HandleValue value, Maybe<T>* result) {
|
||||
T result_;
|
||||
if (!parseIntValueImpl(value, &result_)) {
|
||||
bool parseIntValue(HandleValue value, Maybe<size_t>* result) {
|
||||
size_t result_;
|
||||
if (!parseIntValue(value, &result_)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -737,13 +719,6 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseIntValue(HandleValue value, Maybe<uint32_t>* result) {
|
||||
return parseIntValueMaybeImpl(value, result);
|
||||
}
|
||||
bool parseIntValue(HandleValue value, Maybe<size_t>* result) {
|
||||
return parseIntValueMaybeImpl(value, result);
|
||||
}
|
||||
|
||||
public:
|
||||
explicit GetPossibleBreakpointsMatcher(JSContext* cx,
|
||||
MutableHandleObject result)
|
||||
@ -752,7 +727,9 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
minOffset(),
|
||||
maxOffset(),
|
||||
minLine(),
|
||||
maxLine() {}
|
||||
minColumn(0),
|
||||
maxLine(),
|
||||
maxColumn(0) {}
|
||||
|
||||
bool parseQuery(HandleObject query) {
|
||||
RootedValue lineValue(cx_);
|
||||
@ -820,7 +797,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t line;
|
||||
size_t line;
|
||||
if (!parseIntValue(lineValue, &line)) {
|
||||
JS_ReportErrorNumberASCII(
|
||||
cx_, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||
@ -908,8 +885,8 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
}
|
||||
|
||||
size_t offset = r.frontOffset();
|
||||
uint32_t lineno = r.frontLineNumber();
|
||||
JS::LimitedColumnNumberZeroOrigin colno = r.frontColumnNumber();
|
||||
size_t lineno = r.frontLineNumber();
|
||||
size_t colno = r.frontColumnNumber();
|
||||
|
||||
if (!maybeAppendEntry(offset, lineno, colno,
|
||||
r.frontIsBreakableStepPoint())) {
|
||||
@ -934,8 +911,8 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < offsets.length(); i++) {
|
||||
uint32_t lineno = offsets[i].lineno;
|
||||
JS::LimitedColumnNumberZeroOrigin column(offsets[i].column);
|
||||
size_t lineno = offsets[i].lineno;
|
||||
size_t column = offsets[i].column;
|
||||
size_t offset = offsets[i].offset;
|
||||
if (!maybeAppendEntry(offset, lineno, column, true)) {
|
||||
return false;
|
||||
@ -1014,7 +991,7 @@ class DebuggerScript::GetOffsetMetadataMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(r.frontColumnNumber().zeroOriginValue());
|
||||
value = NumberValue(r.frontColumnNumber());
|
||||
if (!DefineDataProperty(cx_, result_, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -1039,8 +1016,8 @@ class DebuggerScript::GetOffsetMetadataMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t lineno;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
size_t lineno;
|
||||
size_t column;
|
||||
if (!instance.debug().getOffsetLocation(offset_, &lineno, &column)) {
|
||||
JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr,
|
||||
JSMSG_DEBUG_BAD_OFFSET);
|
||||
@ -1057,7 +1034,7 @@ class DebuggerScript::GetOffsetMetadataMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(column.zeroOriginValue());
|
||||
value = NumberValue(column);
|
||||
if (!DefineDataProperty(cx_, result_, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -1127,43 +1104,40 @@ class FlowGraphSummary {
|
||||
public:
|
||||
class Entry {
|
||||
public:
|
||||
static Entry createWithSingleEdge(uint32_t lineno, uint32_t column) {
|
||||
static Entry createWithSingleEdge(size_t lineno, size_t column) {
|
||||
return Entry(lineno, column);
|
||||
}
|
||||
|
||||
static Entry createWithMultipleEdgesFromSingleLine(uint32_t lineno) {
|
||||
return Entry(lineno, UINT32_MAX);
|
||||
static Entry createWithMultipleEdgesFromSingleLine(size_t lineno) {
|
||||
return Entry(lineno, SIZE_MAX);
|
||||
}
|
||||
|
||||
static Entry createWithMultipleEdgesFromMultipleLines() {
|
||||
return Entry(UINT32_MAX, UINT32_MAX);
|
||||
return Entry(SIZE_MAX, SIZE_MAX);
|
||||
}
|
||||
|
||||
Entry() : lineno_(UINT32_MAX), column_(0) {}
|
||||
Entry() : lineno_(SIZE_MAX), column_(0) {}
|
||||
|
||||
bool hasNoEdges() const {
|
||||
return lineno_ == UINT32_MAX && column_ != UINT32_MAX;
|
||||
return lineno_ == SIZE_MAX && column_ != SIZE_MAX;
|
||||
}
|
||||
|
||||
bool hasSingleEdge() const {
|
||||
return lineno_ != UINT32_MAX && column_ != UINT32_MAX;
|
||||
return lineno_ != SIZE_MAX && column_ != SIZE_MAX;
|
||||
}
|
||||
|
||||
uint32_t lineno() const { return lineno_; }
|
||||
size_t lineno() const { return lineno_; }
|
||||
|
||||
uint32_t column() const { return column_; }
|
||||
size_t column() const { return column_; }
|
||||
|
||||
private:
|
||||
Entry(uint32_t lineno, uint32_t column)
|
||||
: lineno_(lineno), column_(column) {}
|
||||
Entry(size_t lineno, size_t column) : lineno_(lineno), column_(column) {}
|
||||
|
||||
// Line number (1-origin).
|
||||
// UINT32_MAX for no edge.
|
||||
uint32_t lineno_;
|
||||
size_t lineno_;
|
||||
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
// UINT32_MAX for multiple edge.
|
||||
uint32_t column_;
|
||||
size_t column_;
|
||||
};
|
||||
|
||||
explicit FlowGraphSummary(JSContext* cx) : entries_(cx) {}
|
||||
@ -1177,12 +1151,12 @@ class FlowGraphSummary {
|
||||
unsigned mainOffset = script->pcToOffset(script->main());
|
||||
entries_[mainOffset] = Entry::createWithMultipleEdgesFromMultipleLines();
|
||||
|
||||
uint32_t prevLineno = script->lineno();
|
||||
uint32_t prevColumn = 0;
|
||||
size_t prevLineno = script->lineno();
|
||||
size_t prevColumn = 0;
|
||||
JSOp prevOp = JSOp::Nop;
|
||||
for (BytecodeRangeWithPosition r(cx, script); !r.empty(); r.popFront()) {
|
||||
uint32_t lineno = prevLineno;
|
||||
uint32_t column = prevColumn;
|
||||
size_t lineno = prevLineno;
|
||||
size_t column = prevColumn;
|
||||
JSOp op = r.frontOpcode();
|
||||
|
||||
if (BytecodeFallsThrough(prevOp)) {
|
||||
@ -1201,7 +1175,7 @@ class FlowGraphSummary {
|
||||
|
||||
if (r.frontIsEntryPoint()) {
|
||||
lineno = r.frontLineNumber();
|
||||
column = r.frontColumnNumber().zeroOriginValue();
|
||||
column = r.frontColumnNumber();
|
||||
}
|
||||
|
||||
if (IsJumpOpcode(op)) {
|
||||
@ -1250,8 +1224,7 @@ class FlowGraphSummary {
|
||||
}
|
||||
|
||||
private:
|
||||
void addEdge(uint32_t sourceLineno, uint32_t sourceColumn,
|
||||
size_t targetOffset) {
|
||||
void addEdge(size_t sourceLineno, size_t sourceColumn, size_t targetOffset) {
|
||||
if (entries_[targetOffset].hasNoEdges()) {
|
||||
entries_[targetOffset] =
|
||||
Entry::createWithSingleEdge(sourceLineno, sourceColumn);
|
||||
@ -1319,16 +1292,15 @@ class DebuggerScript::GetOffsetLocationMatcher {
|
||||
// If this is an entry point, take the line number associated with the entry
|
||||
// point, otherwise settle on the next instruction and take the incoming
|
||||
// edge position.
|
||||
uint32_t lineno;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
size_t lineno;
|
||||
size_t column;
|
||||
if (r.frontIsEntryPoint()) {
|
||||
lineno = r.frontLineNumber();
|
||||
column = r.frontColumnNumber();
|
||||
} else {
|
||||
MOZ_ASSERT(flowData[r.frontOffset()].hasSingleEdge());
|
||||
lineno = flowData[r.frontOffset()].lineno();
|
||||
column =
|
||||
JS::LimitedColumnNumberZeroOrigin(flowData[r.frontOffset()].column());
|
||||
column = flowData[r.frontOffset()].column();
|
||||
}
|
||||
|
||||
RootedValue value(cx_, NumberValue(lineno));
|
||||
@ -1336,7 +1308,7 @@ class DebuggerScript::GetOffsetLocationMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(column.zeroOriginValue());
|
||||
value = NumberValue(column);
|
||||
if (!DefineDataProperty(cx_, result_, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -1344,8 +1316,7 @@ class DebuggerScript::GetOffsetLocationMatcher {
|
||||
// The same entry point test that is used by getAllColumnOffsets.
|
||||
isEntryPoint = (isEntryPoint && !flowData[offset].hasNoEdges() &&
|
||||
(flowData[offset].lineno() != r.frontLineNumber() ||
|
||||
flowData[offset].column() !=
|
||||
r.frontColumnNumber().zeroOriginValue()));
|
||||
flowData[offset].column() != r.frontColumnNumber()));
|
||||
value.setBoolean(isEntryPoint);
|
||||
if (!DefineDataProperty(cx_, result_, cx_->names().isEntryPoint, value)) {
|
||||
return false;
|
||||
@ -1361,8 +1332,8 @@ class DebuggerScript::GetOffsetLocationMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t lineno;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
size_t lineno;
|
||||
size_t column;
|
||||
if (!instance.debug().getOffsetLocation(offset_, &lineno, &column)) {
|
||||
JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr,
|
||||
JSMSG_DEBUG_BAD_OFFSET);
|
||||
@ -1379,7 +1350,7 @@ class DebuggerScript::GetOffsetLocationMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(column.zeroOriginValue());
|
||||
value = NumberValue(column);
|
||||
if (!DefineDataProperty(cx_, result_, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -1735,7 +1706,7 @@ bool DebuggerScript::CallData::getAllOffsets() {
|
||||
}
|
||||
|
||||
size_t offset = r.frontOffset();
|
||||
uint32_t lineno = r.frontLineNumber();
|
||||
size_t lineno = r.frontLineNumber();
|
||||
|
||||
// Make a note, if the current instruction is an entry point for the current
|
||||
// line.
|
||||
@ -1789,9 +1760,7 @@ class DebuggerScript::GetAllColumnOffsetsMatcher {
|
||||
JSContext* cx_;
|
||||
MutableHandleObject result_;
|
||||
|
||||
bool appendColumnOffsetEntry(uint32_t lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin column,
|
||||
size_t offset) {
|
||||
bool appendColumnOffsetEntry(size_t lineno, size_t column, size_t offset) {
|
||||
Rooted<PlainObject*> entry(cx_, NewPlainObject(cx_));
|
||||
if (!entry) {
|
||||
return false;
|
||||
@ -1802,7 +1771,7 @@ class DebuggerScript::GetAllColumnOffsetsMatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = NumberValue(column.zeroOriginValue());
|
||||
value = NumberValue(column);
|
||||
if (!DefineDataProperty(cx_, entry, cx_->names().columnNumber, value)) {
|
||||
return false;
|
||||
}
|
||||
@ -1839,15 +1808,15 @@ class DebuggerScript::GetAllColumnOffsetsMatcher {
|
||||
}
|
||||
|
||||
for (BytecodeRangeWithPosition r(cx_, script); !r.empty(); r.popFront()) {
|
||||
uint32_t lineno = r.frontLineNumber();
|
||||
JS::LimitedColumnNumberZeroOrigin column = r.frontColumnNumber();
|
||||
size_t lineno = r.frontLineNumber();
|
||||
size_t column = r.frontColumnNumber();
|
||||
size_t offset = r.frontOffset();
|
||||
|
||||
// Make a note, if the current instruction is an entry point for
|
||||
// the current position.
|
||||
if (r.frontIsEntryPoint() && !flowData[offset].hasNoEdges() &&
|
||||
(flowData[offset].lineno() != lineno ||
|
||||
flowData[offset].column() != column.zeroOriginValue())) {
|
||||
flowData[offset].column() != column)) {
|
||||
if (!appendColumnOffsetEntry(lineno, column, offset)) {
|
||||
return false;
|
||||
}
|
||||
@ -1870,8 +1839,8 @@ class DebuggerScript::GetAllColumnOffsetsMatcher {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < offsets.length(); i++) {
|
||||
uint32_t lineno = offsets[i].lineno;
|
||||
JS::LimitedColumnNumberZeroOrigin column(offsets[i].column);
|
||||
size_t lineno = offsets[i].lineno;
|
||||
size_t column = offsets[i].column;
|
||||
size_t offset = offsets[i].offset;
|
||||
if (!appendColumnOffsetEntry(lineno, column, offset)) {
|
||||
return false;
|
||||
@ -1894,11 +1863,11 @@ bool DebuggerScript::CallData::getAllColumnOffsets() {
|
||||
|
||||
class DebuggerScript::GetLineOffsetsMatcher {
|
||||
JSContext* cx_;
|
||||
uint32_t lineno_;
|
||||
size_t lineno_;
|
||||
MutableHandleObject result_;
|
||||
|
||||
public:
|
||||
explicit GetLineOffsetsMatcher(JSContext* cx, uint32_t lineno,
|
||||
explicit GetLineOffsetsMatcher(JSContext* cx, size_t lineno,
|
||||
MutableHandleObject result)
|
||||
: cx_(cx), lineno_(lineno), result_(result) {}
|
||||
using ReturnType = bool;
|
||||
@ -1969,13 +1938,13 @@ bool DebuggerScript::CallData::getLineOffsets() {
|
||||
|
||||
// Parse lineno argument.
|
||||
RootedValue linenoValue(cx, args[0]);
|
||||
uint32_t lineno;
|
||||
size_t lineno;
|
||||
if (!ToNumber(cx, &linenoValue)) {
|
||||
return false;
|
||||
}
|
||||
{
|
||||
double d = linenoValue.toNumber();
|
||||
lineno = uint32_t(d);
|
||||
lineno = size_t(d);
|
||||
if (lineno != d) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_DEBUG_BAD_LINE);
|
||||
@ -2392,8 +2361,7 @@ bool DebuggerScript::CallData::getOffsetsCoverage() {
|
||||
|
||||
offsetValue.setNumber(double(offset));
|
||||
lineNumberValue.setNumber(double(r.frontLineNumber()));
|
||||
columnNumberValue.setNumber(
|
||||
double(r.frontColumnNumber().zeroOriginValue()));
|
||||
columnNumberValue.setNumber(double(r.frontColumnNumber()));
|
||||
countValue.setNumber(double(hits));
|
||||
|
||||
// Create a new object with the offset, line number, column number, the
|
||||
|
@ -17,8 +17,7 @@
|
||||
#include "debugger/Debugger.h" // for DebuggerSourceReferent, Debugger
|
||||
#include "debugger/Script.h" // for DebuggerScript
|
||||
#include "frontend/FrontendContext.h" // for AutoReportFrontendContext
|
||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||
#include "js/ColumnNumber.h" // JS::WasmFunctionIndex, JS::ColumnNumberZeroOrigin
|
||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||
#include "js/CompilationAndEvaluation.h" // for Compile
|
||||
#include "js/ErrorReport.h" // for JS_ReportErrorASCII, JS_ReportErrorNumberASCII
|
||||
#include "js/experimental/TypedData.h" // for JS_NewUint8Array
|
||||
@ -352,11 +351,9 @@ class DebuggerSourceGetStartColumnMatcher {
|
||||
|
||||
ReturnType match(Handle<ScriptSourceObject*> sourceObject) {
|
||||
ScriptSource* ss = sourceObject->source();
|
||||
return ss->startColumn().zeroOriginValue();
|
||||
}
|
||||
ReturnType match(Handle<WasmInstanceObject*> instanceObj) {
|
||||
return JS::WasmFunctionIndex::DefaultBinarySourceColumnNumberZeroOrigin;
|
||||
return ss->startColumn();
|
||||
}
|
||||
ReturnType match(Handle<WasmInstanceObject*> instanceObj) { return 0; }
|
||||
};
|
||||
|
||||
bool DebuggerSource::CallData::getStartColumn() {
|
||||
@ -623,7 +620,7 @@ static JSScript* ReparseSource(JSContext* cx, Handle<ScriptSourceObject*> sso) {
|
||||
JS::CompileOptions options(cx);
|
||||
options.setHideScriptFromDebugger(true);
|
||||
options.setFileAndLine(ss->filename(), ss->startLine());
|
||||
options.setColumn(JS::ColumnNumberZeroOrigin(ss->startColumn()));
|
||||
options.setColumn(ss->startColumn());
|
||||
|
||||
UncompressedSourceCache::AutoHoldEntry holder;
|
||||
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include "frontend/UsedNameTracker.h" // UsedNameTracker, UsedNameMap
|
||||
#include "js/AllocPolicy.h" // js::SystemAllocPolicy, ReportOutOfMemory
|
||||
#include "js/CharacterEncoding.h" // JS_EncodeStringToUTF8
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JS_ReportErrorASCII
|
||||
#include "js/ErrorReport.h" // JS_ReportErrorASCII
|
||||
#include "js/experimental/JSStencil.h"
|
||||
#include "js/GCVector.h" // JS::StackGCVector
|
||||
#include "js/Id.h" // JS::PropertyKey
|
||||
@ -326,8 +325,7 @@ template <typename Unit>
|
||||
}
|
||||
|
||||
SourceExtent extent = SourceExtent::makeGlobalExtent(
|
||||
srcBuf.length(), input.options.lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(input.options.column));
|
||||
srcBuf.length(), input.options.lineno, input.options.column);
|
||||
|
||||
GlobalSharedContext globalsc(fc, scopeKind, input.options,
|
||||
compiler.compilationState().directives, extent);
|
||||
@ -698,9 +696,8 @@ static JSScript* CompileEvalScriptImpl(
|
||||
}
|
||||
|
||||
uint32_t len = srcBuf.length();
|
||||
SourceExtent extent = SourceExtent::makeGlobalExtent(
|
||||
len, options.lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(options.column));
|
||||
SourceExtent extent =
|
||||
SourceExtent::makeGlobalExtent(len, options.lineno, options.column);
|
||||
EvalSharedContext evalsc(&fc, compiler.compilationState(), extent);
|
||||
if (!compiler.compile(cx, &evalsc)) {
|
||||
return nullptr;
|
||||
@ -1015,9 +1012,8 @@ bool ModuleCompiler<Unit>::compile(JSContext* maybeCx, FrontendContext* fc) {
|
||||
const auto& options = compilationState_.input.options;
|
||||
|
||||
uint32_t len = this->sourceBuffer_.length();
|
||||
SourceExtent extent = SourceExtent::makeGlobalExtent(
|
||||
len, options.lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(options.column));
|
||||
SourceExtent extent =
|
||||
SourceExtent::makeGlobalExtent(len, options.lineno, options.column);
|
||||
ModuleSharedContext modulesc(fc, options, builder, extent);
|
||||
|
||||
ParseNode* pn = parser->moduleBody(&modulesc);
|
||||
@ -1110,13 +1106,12 @@ bool StandaloneFunctionCompiler<Unit>::compile(
|
||||
// line and column.
|
||||
const auto& options = compilationState_.input.options;
|
||||
compilationState_.scriptExtra[CompilationStencil::TopLevelIndex].extent =
|
||||
SourceExtent{
|
||||
/* sourceStart = */ 0,
|
||||
sourceBuffer_.length(),
|
||||
funbox->extent().toStringStart,
|
||||
funbox->extent().toStringEnd,
|
||||
options.lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(options.column)};
|
||||
SourceExtent{/* sourceStart = */ 0,
|
||||
sourceBuffer_.length(),
|
||||
funbox->extent().toStringStart,
|
||||
funbox->extent().toStringEnd,
|
||||
options.lineno,
|
||||
options.column};
|
||||
} else {
|
||||
// The asm.js module was created by parser. Instantiation below will
|
||||
// allocate the JSFunction that wraps it.
|
||||
@ -1573,7 +1568,7 @@ static bool DelazifyCanonicalScriptedFunctionImpl(JSContext* cx,
|
||||
JS::CompileOptions options(cx);
|
||||
options.setMutedErrors(lazy->mutedErrors())
|
||||
.setFileAndLine(lazy->filename(), lazy->lineno())
|
||||
.setColumn(JS::ColumnNumberZeroOrigin(lazy->column()))
|
||||
.setColumn(lazy->column())
|
||||
.setScriptSourceOffset(lazy->sourceStart())
|
||||
.setNoScriptRval(false)
|
||||
.setSelfHostingMode(false)
|
||||
@ -1649,7 +1644,7 @@ DelazifyCanonicalScriptedFunctionImpl(
|
||||
JS::CompileOptions options(prefableOptions);
|
||||
options.setMutedErrors(ss->mutedErrors())
|
||||
.setFileAndLine(ss->filename(), extra.extent.lineno)
|
||||
.setColumn(JS::ColumnNumberZeroOrigin(extra.extent.column))
|
||||
.setColumn(extra.extent.column)
|
||||
.setScriptSourceOffset(sourceStart)
|
||||
.setNoScriptRval(false)
|
||||
.setSelfHostingMode(false);
|
||||
|
@ -58,10 +58,9 @@
|
||||
#include "frontend/TDZCheckCache.h" // TDZCheckCache
|
||||
#include "frontend/TryEmitter.h" // TryEmitter
|
||||
#include "frontend/WhileEmitter.h" // WhileEmitter
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberOffset
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/friend/StackLimits.h" // AutoCheckRecursionLimit
|
||||
#include "util/StringBuffer.h" // StringBuffer
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/friend/StackLimits.h" // AutoCheckRecursionLimit
|
||||
#include "util/StringBuffer.h" // StringBuffer
|
||||
#include "vm/BytecodeUtil.h" // JOF_*, IsArgOp, IsLocalOp, SET_UINT24, SET_ICINDEX, BytecodeFallsThrough, BytecodeIsJumpTarget
|
||||
#include "vm/CompletionKind.h" // CompletionKind
|
||||
#include "vm/FunctionPrefixKind.h" // FunctionPrefixKind
|
||||
@ -609,18 +608,17 @@ bool BytecodeEmitter::updateSourceCoordNotes(uint32_t offset) {
|
||||
return true;
|
||||
}
|
||||
|
||||
JS::LimitedColumnNumberZeroOrigin columnIndex =
|
||||
errorReporter().columnAt(offset);
|
||||
uint32_t columnIndex = errorReporter().columnAt(offset);
|
||||
MOZ_ASSERT(columnIndex <= ColumnLimit);
|
||||
|
||||
// Assert colspan is always representable.
|
||||
static_assert((0 - ptrdiff_t(JS::LimitedColumnNumberZeroOrigin::Limit)) >=
|
||||
SrcNote::ColSpan::MinColSpan);
|
||||
static_assert((ptrdiff_t(JS::LimitedColumnNumberZeroOrigin::Limit) - 0) <=
|
||||
SrcNote::ColSpan::MaxColSpan);
|
||||
static_assert((0 - ptrdiff_t(ColumnLimit)) >= SrcNote::ColSpan::MinColSpan);
|
||||
static_assert((ptrdiff_t(ColumnLimit) - 0) <= SrcNote::ColSpan::MaxColSpan);
|
||||
|
||||
JS::ColumnNumberOffset colspan = columnIndex - bytecodeSection().lastColumn();
|
||||
ptrdiff_t colspan =
|
||||
ptrdiff_t(columnIndex) - ptrdiff_t(bytecodeSection().lastColumn());
|
||||
|
||||
if (colspan != JS::ColumnNumberOffset::zero()) {
|
||||
if (colspan != 0) {
|
||||
if (!newSrcNote2(SrcNoteType::ColSpan,
|
||||
SrcNote::ColSpan::toOperand(colspan))) {
|
||||
return false;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "frontend/CompilationStencil.h" // CompilationStencil
|
||||
#include "frontend/FrontendContext.h" // FrontendContext
|
||||
#include "frontend/SharedContext.h" // FunctionBox
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "vm/BytecodeUtil.h" // INDEX_LIMIT, StackUses, StackDefs
|
||||
#include "vm/GlobalObject.h"
|
||||
#include "vm/JSContext.h" // JSContext
|
||||
@ -161,7 +160,7 @@ void CGScopeNoteList::recordEndImpl(uint32_t index, uint32_t offset) {
|
||||
}
|
||||
|
||||
BytecodeSection::BytecodeSection(FrontendContext* fc, uint32_t lineNum,
|
||||
JS::LimitedColumnNumberZeroOrigin column)
|
||||
uint32_t column)
|
||||
: code_(fc),
|
||||
notes_(fc),
|
||||
lastNoteOffset_(0),
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "frontend/ParserAtom.h" // ParserAtomsTable, TaggedParserAtomIndex, ParserAtom
|
||||
#include "frontend/SourceNotes.h" // SrcNote
|
||||
#include "frontend/Stencil.h" // Stencils
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/TypeDecls.h" // jsbytecode, JSContext
|
||||
#include "js/Vector.h" // Vector
|
||||
#include "vm/SharedStencil.h" // TryNote, ScopeNote, GCThingIndex
|
||||
@ -179,8 +178,7 @@ typedef Vector<js::SrcNote, 64> SrcNotesVector;
|
||||
// bytecode is stored in this class.
|
||||
class BytecodeSection {
|
||||
public:
|
||||
BytecodeSection(FrontendContext* fc, uint32_t lineNum,
|
||||
JS::LimitedColumnNumberZeroOrigin column);
|
||||
BytecodeSection(FrontendContext* fc, uint32_t lineNum, uint32_t column);
|
||||
|
||||
// ---- Bytecode ----
|
||||
|
||||
@ -241,15 +239,14 @@ class BytecodeSection {
|
||||
// ---- Line and column ----
|
||||
|
||||
uint32_t currentLine() const { return currentLine_; }
|
||||
JS::LimitedColumnNumberZeroOrigin lastColumn() const { return lastColumn_; }
|
||||
uint32_t lastColumn() const { return lastColumn_; }
|
||||
void setCurrentLine(uint32_t line, uint32_t sourceOffset) {
|
||||
currentLine_ = line;
|
||||
lastColumn_ = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
lastColumn_ = 0;
|
||||
lastSourceOffset_ = sourceOffset;
|
||||
}
|
||||
|
||||
void setLastColumn(JS::LimitedColumnNumberZeroOrigin column,
|
||||
uint32_t offset) {
|
||||
void setLastColumn(uint32_t column, uint32_t offset) {
|
||||
lastColumn_ = column;
|
||||
lastSourceOffset_ = offset;
|
||||
}
|
||||
@ -343,12 +340,12 @@ class BytecodeSection {
|
||||
// we can get undefined behavior.
|
||||
uint32_t currentLine_;
|
||||
|
||||
// Column index in UTF-16 code units on currentLine_ of last
|
||||
// 0-origin column index in UTF-16 code units on currentLine_ of last
|
||||
// SrcNoteType::ColSpan-annotated opcode.
|
||||
//
|
||||
// WARNING: If this becomes out of sync with already-emitted srcnotes,
|
||||
// we can get undefined behavior.
|
||||
JS::LimitedColumnNumberZeroOrigin lastColumn_;
|
||||
uint32_t lastColumn_ = 0;
|
||||
|
||||
// The last code unit used for srcnotes.
|
||||
uint32_t lastSourceOffset_ = 0;
|
||||
@ -358,7 +355,7 @@ class BytecodeSection {
|
||||
uint32_t lastSeparatorCodeOffset_ = 0;
|
||||
uint32_t lastSeparatorSourceOffset_ = 0;
|
||||
uint32_t lastSeparatorLine_ = 0;
|
||||
JS::LimitedColumnNumberZeroOrigin lastSeparatorColumn_;
|
||||
uint32_t lastSeparatorColumn_ = 0; // 0-origin
|
||||
|
||||
// ---- JIT ----
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "frontend/Parser.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
|
||||
namespace js::frontend {
|
||||
|
||||
@ -41,7 +40,7 @@ class EitherParser final {
|
||||
}
|
||||
|
||||
void computeLineAndColumn(uint32_t offset, uint32_t* line,
|
||||
JS::LimitedColumnNumberZeroOrigin* column) const {
|
||||
uint32_t* column) const {
|
||||
return parser.match([offset, line, column](auto* parser) -> void {
|
||||
parser->tokenStream.computeLineAndColumn(offset, line, column);
|
||||
});
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/UniquePtr.h"
|
||||
#include "vm/ErrorReporting.h" // ErrorMetadata, ReportCompile{Error,Warning}
|
||||
|
||||
@ -335,7 +334,7 @@ class ErrorReporter : public ErrorReportMixin {
|
||||
virtual uint32_t lineAt(size_t offset) const = 0;
|
||||
|
||||
// Returns the column number for given offset.
|
||||
virtual JS::LimitedColumnNumberZeroOrigin columnAt(size_t offset) const = 0;
|
||||
virtual uint32_t columnAt(size_t offset) const = 0;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "frontend/TokenStream.h" // TokenStreamAnyChars
|
||||
#include "irregexp/RegExpAPI.h" // irregexp::CheckPatternSyntax
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, UTF8CharsToNewTwoByteCharsZ, JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/GCAPI.h" // JS::AutoCheckCannotGC
|
||||
#include "js/HeapAPI.h" // JS::GCCellPtr
|
||||
@ -493,8 +492,7 @@ bool ConvertScriptStencil(JSContext* cx, FrontendContext* fc,
|
||||
scriptExtra.extent.toStringStart = smooshScript.extent.to_string_start;
|
||||
scriptExtra.extent.toStringEnd = smooshScript.extent.to_string_end;
|
||||
scriptExtra.extent.lineno = smooshScript.extent.lineno;
|
||||
scriptExtra.extent.column =
|
||||
JS::LimitedColumnNumberZeroOrigin(smooshScript.extent.column);
|
||||
scriptExtra.extent.column = smooshScript.extent.column;
|
||||
|
||||
if (isFunction) {
|
||||
if (smooshScript.fun_name.IsSome()) {
|
||||
@ -582,7 +580,7 @@ bool Smoosh::tryCompileGlobalScriptToExtensibleStencil(
|
||||
ErrorMetadata metadata;
|
||||
metadata.filename = JS::ConstUTF8CharsZ("<unknown>");
|
||||
metadata.lineNumber = 1;
|
||||
metadata.columnNumber = JS::ColumnNumberZeroOrigin::zero();
|
||||
metadata.columnNumber = 0;
|
||||
metadata.isMuted = false;
|
||||
ReportSmooshCompileError(cx, fc, std::move(metadata),
|
||||
JSMSG_SMOOSH_COMPILE_ERROR,
|
||||
|
@ -43,8 +43,7 @@
|
||||
#include "frontend/ScriptIndex.h" // ScriptIndex
|
||||
#include "frontend/TokenStream.h" // IsKeyword, ReservedWordTokenKind, ReservedWordToCharZ, DeprecatedContent, *TokenStream*, CharBuffer, TokenKindToDesc
|
||||
#include "irregexp/RegExpAPI.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/HashTable.h"
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlags
|
||||
@ -375,8 +374,7 @@ typename ParseHandler::ListNodeType GeneralParser<ParseHandler, Unit>::parse() {
|
||||
MOZ_ASSERT(checkOptionsCalled_);
|
||||
|
||||
SourceExtent extent = SourceExtent::makeGlobalExtent(
|
||||
/* len = */ 0, options().lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::fromUnlimited(options().column));
|
||||
/* len = */ 0, options().lineno, options().column);
|
||||
Directives directives(options().forceStrictMode());
|
||||
GlobalSharedContext globalsc(this->fc_, ScopeKind::Global, options(),
|
||||
directives, extent);
|
||||
@ -467,19 +465,20 @@ void GeneralParser<ParseHandler, Unit>::reportMissingClosing(
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t line, column;
|
||||
tokenStream.computeLineAndColumn(openedPos, &line, &column);
|
||||
|
||||
column = JSErrorBase::fromZeroOriginToOneOrigin(column);
|
||||
|
||||
const size_t MaxWidth = sizeof("4294967295");
|
||||
char columnNumber[MaxWidth];
|
||||
SprintfLiteral(columnNumber, "%" PRIu32, column.oneOriginValue());
|
||||
SprintfLiteral(columnNumber, "%" PRIu32, column);
|
||||
char lineNumber[MaxWidth];
|
||||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line,
|
||||
JS::ColumnNumberOneOrigin(column), GetErrorMessage,
|
||||
nullptr, noteNumber, lineNumber, columnNumber)) {
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line, column,
|
||||
GetErrorMessage, nullptr, noteNumber, lineNumber,
|
||||
columnNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -509,20 +508,20 @@ void GeneralParser<ParseHandler, Unit>::reportRedeclarationHelper(
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t line, column;
|
||||
tokenStream.computeLineAndColumn(prevPos, &line, &column);
|
||||
|
||||
column = JSErrorBase::fromZeroOriginToOneOrigin(column);
|
||||
|
||||
const size_t MaxWidth = sizeof("4294967295");
|
||||
char columnNumber[MaxWidth];
|
||||
SprintfLiteral(columnNumber, "%" PRIu32, column.oneOriginValue());
|
||||
SprintfLiteral(columnNumber, "%" PRIu32, column);
|
||||
char lineNumber[MaxWidth];
|
||||
SprintfLiteral(lineNumber, "%" PRIu32, line);
|
||||
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line,
|
||||
JS::ColumnNumberOneOrigin(column), GetErrorMessage,
|
||||
nullptr, noteErrorNumber, lineNumber,
|
||||
columnNumber)) {
|
||||
if (!notes->addNoteASCII(this->fc_, getFilename().c_str(), 0, line, column,
|
||||
GetErrorMessage, nullptr, noteErrorNumber,
|
||||
lineNumber, columnNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2610,8 +2609,7 @@ TaggedParserAtomIndex ParserBase::prefixAccessorName(
|
||||
template <class ParseHandler, typename Unit>
|
||||
void GeneralParser<ParseHandler, Unit>::setFunctionStartAtPosition(
|
||||
FunctionBox* funbox, TokenPos pos) const {
|
||||
uint32_t startLine;
|
||||
JS::LimitedColumnNumberZeroOrigin startColumn;
|
||||
uint32_t startLine, startColumn;
|
||||
tokenStream.computeLineAndColumn(pos.begin, &startLine, &startColumn);
|
||||
|
||||
// NOTE: `Debugger::CallData::findScripts` relies on sourceStart and
|
||||
@ -11543,17 +11541,16 @@ RegExpLiteral* Parser<FullParseHandler, Unit>::newRegExp() {
|
||||
RegExpFlags flags = anyChars.currentToken().regExpFlags();
|
||||
|
||||
uint32_t offset = anyChars.currentToken().pos.begin;
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t line, column;
|
||||
tokenStream.computeLineAndColumn(offset, &line, &column);
|
||||
|
||||
if (!handler_.reuseRegexpSyntaxParse()) {
|
||||
// Verify that the Regexp will syntax parse when the time comes to
|
||||
// instantiate it. If we have already done a syntax parse, we can
|
||||
// skip this.
|
||||
if (!irregexp::CheckPatternSyntax(
|
||||
this->alloc_, this->fc_->stackLimit(), anyChars, range, flags,
|
||||
Some(line), Some(JS::ColumnNumberZeroOrigin(column)))) {
|
||||
if (!irregexp::CheckPatternSyntax(this->alloc_, this->fc_->stackLimit(),
|
||||
anyChars, range, flags, Some(line),
|
||||
Some(column))) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -11589,14 +11586,13 @@ Parser<SyntaxParseHandler, Unit>::newRegExp() {
|
||||
RegExpFlags flags = anyChars.currentToken().regExpFlags();
|
||||
|
||||
uint32_t offset = anyChars.currentToken().pos.begin;
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t line, column;
|
||||
tokenStream.computeLineAndColumn(offset, &line, &column);
|
||||
|
||||
mozilla::Range<const char16_t> source(chars.begin(), chars.length());
|
||||
if (!irregexp::CheckPatternSyntax(this->alloc_, this->fc_->stackLimit(),
|
||||
anyChars, source, flags, Some(line),
|
||||
Some(JS::ColumnNumberZeroOrigin(column)))) {
|
||||
Some(column))) {
|
||||
return null();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "frontend/ParserAtom.h" // TaggedParserAtomIndex
|
||||
#include "frontend/ScopeIndex.h" // ScopeIndex
|
||||
#include "frontend/ScriptIndex.h" // ScriptIndex
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "vm/FunctionFlags.h" // js::FunctionFlags
|
||||
#include "vm/GeneratorAndAsyncKind.h" // js::GeneratorKind, js::FunctionAsyncKind
|
||||
#include "vm/Scope.h"
|
||||
@ -627,8 +626,7 @@ class FunctionBox : public SuspendableContext {
|
||||
// for validated asm.js.
|
||||
bool useAsmOrInsideUseAsm() const { return useAsm; }
|
||||
|
||||
void setStart(uint32_t offset, uint32_t line,
|
||||
JS::LimitedColumnNumberZeroOrigin column) {
|
||||
void setStart(uint32_t offset, uint32_t line, uint32_t column) {
|
||||
MOZ_ASSERT(!isScriptExtraFieldCopiedToStencil);
|
||||
extent_.sourceStart = offset;
|
||||
extent_.lineno = line;
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include <stddef.h> // ptrdiff_t, size_t
|
||||
#include <stdint.h> // int8_t, uint8_t, uint32_t
|
||||
|
||||
#include "jstypes.h" // js::{Bit, BitMask}
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOffset
|
||||
#include "jstypes.h" // js::{Bit, BitMask}
|
||||
|
||||
namespace js {
|
||||
|
||||
@ -211,30 +210,29 @@ class SrcNote {
|
||||
*/
|
||||
static constexpr ptrdiff_t ColSpanSignBit = 1 << (OperandBits - 1);
|
||||
|
||||
static inline JS::ColumnNumberOffset fromOperand(ptrdiff_t operand) {
|
||||
static inline ptrdiff_t fromOperand(ptrdiff_t operand) {
|
||||
// There should be no bits set outside the field we're going to
|
||||
// sign-extend.
|
||||
MOZ_ASSERT(!(operand & ~((1U << OperandBits) - 1)));
|
||||
|
||||
// Sign-extend the least significant OperandBits bits.
|
||||
return JS::ColumnNumberOffset((operand ^ ColSpanSignBit) -
|
||||
ColSpanSignBit);
|
||||
return (operand ^ ColSpanSignBit) - ColSpanSignBit;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr ptrdiff_t MinColSpan = -ColSpanSignBit;
|
||||
static constexpr ptrdiff_t MaxColSpan = ColSpanSignBit - 1;
|
||||
|
||||
static inline ptrdiff_t toOperand(JS::ColumnNumberOffset colspan) {
|
||||
static inline ptrdiff_t toOperand(ptrdiff_t colspan) {
|
||||
// Truncate the two's complement colspan, for storage as an operand.
|
||||
ptrdiff_t operand = colspan.value() & ((1U << OperandBits) - 1);
|
||||
ptrdiff_t operand = colspan & ((1U << OperandBits) - 1);
|
||||
|
||||
// When we read this back, we'd better get the value we stored.
|
||||
MOZ_ASSERT(fromOperand(operand) == colspan);
|
||||
return operand;
|
||||
}
|
||||
|
||||
static inline JS::ColumnNumberOffset getSpan(const SrcNote* sn);
|
||||
static inline ptrdiff_t getSpan(const SrcNote* sn);
|
||||
};
|
||||
|
||||
class SetLine {
|
||||
@ -367,7 +365,7 @@ class SrcNoteReader {
|
||||
};
|
||||
|
||||
/* static */
|
||||
inline JS::ColumnNumberOffset SrcNote::ColSpan::getSpan(const SrcNote* sn) {
|
||||
inline ptrdiff_t SrcNote::ColSpan::getSpan(const SrcNote* sn) {
|
||||
return fromOperand(SrcNoteReader::getOperand(sn, unsigned(Operands::Span)));
|
||||
}
|
||||
|
||||
|
@ -4421,7 +4421,7 @@ void ScriptStencilExtra::dumpFields(js::JSONPrinter& json) const {
|
||||
json.property("toStringStart", extent.toStringStart);
|
||||
json.property("toStringEnd", extent.toStringEnd);
|
||||
json.property("lineno", extent.lineno);
|
||||
json.property("column", extent.column.zeroOriginValue());
|
||||
json.property("column", extent.column);
|
||||
json.endObject();
|
||||
|
||||
json.property("memberInitializers", memberInitializers_);
|
||||
@ -4584,7 +4584,7 @@ static void DumpInputScriptFields(js::JSONPrinter& json,
|
||||
json.property("toStringStart", extent.toStringStart);
|
||||
json.property("toStringEnd", extent.toStringEnd);
|
||||
json.property("lineno", extent.lineno);
|
||||
json.property("column", extent.column.zeroOriginValue());
|
||||
json.property("column", extent.column);
|
||||
}
|
||||
json.endObject();
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "frontend/ScriptIndex.h" // ScriptIndex
|
||||
#include "frontend/TypedIndex.h" // TypedIndex
|
||||
#include "js/AllocPolicy.h" // SystemAllocPolicy
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/RefCounted.h" // AtomicRefCounted
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlags
|
||||
#include "js/RootingAPI.h" // Handle
|
||||
@ -612,11 +611,11 @@ class StencilModuleEntry {
|
||||
// Line number (1-origin).
|
||||
uint32_t lineno = 0;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
JS::ColumnNumberZeroOrigin column;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
uint32_t column = 0;
|
||||
|
||||
private:
|
||||
StencilModuleEntry(uint32_t lineno, JS::ColumnNumberZeroOrigin column)
|
||||
StencilModuleEntry(uint32_t lineno, uint32_t column)
|
||||
: lineno(lineno), column(column) {}
|
||||
|
||||
public:
|
||||
@ -660,8 +659,7 @@ class StencilModuleEntry {
|
||||
}
|
||||
|
||||
static StencilModuleEntry requestedModule(
|
||||
MaybeModuleRequestIndex moduleRequest, uint32_t lineno,
|
||||
JS::ColumnNumberZeroOrigin column) {
|
||||
MaybeModuleRequestIndex moduleRequest, uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
entry.moduleRequest = moduleRequest;
|
||||
@ -671,8 +669,7 @@ class StencilModuleEntry {
|
||||
static StencilModuleEntry importEntry(MaybeModuleRequestIndex moduleRequest,
|
||||
TaggedParserAtomIndex localName,
|
||||
TaggedParserAtomIndex importName,
|
||||
uint32_t lineno,
|
||||
JS::ColumnNumberZeroOrigin column) {
|
||||
uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
MOZ_ASSERT(localName && importName);
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
@ -684,7 +681,7 @@ class StencilModuleEntry {
|
||||
|
||||
static StencilModuleEntry importNamespaceEntry(
|
||||
MaybeModuleRequestIndex moduleRequest, TaggedParserAtomIndex localName,
|
||||
uint32_t lineno, JS::ColumnNumberZeroOrigin column) {
|
||||
uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
MOZ_ASSERT(localName);
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
@ -695,8 +692,7 @@ class StencilModuleEntry {
|
||||
|
||||
static StencilModuleEntry exportAsEntry(TaggedParserAtomIndex localName,
|
||||
TaggedParserAtomIndex exportName,
|
||||
uint32_t lineno,
|
||||
JS::ColumnNumberZeroOrigin column) {
|
||||
uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(localName && exportName);
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
entry.localName = localName;
|
||||
@ -706,8 +702,7 @@ class StencilModuleEntry {
|
||||
|
||||
static StencilModuleEntry exportFromEntry(
|
||||
MaybeModuleRequestIndex moduleRequest, TaggedParserAtomIndex importName,
|
||||
TaggedParserAtomIndex exportName, uint32_t lineno,
|
||||
JS::ColumnNumberZeroOrigin column) {
|
||||
TaggedParserAtomIndex exportName, uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
MOZ_ASSERT(importName && exportName);
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
@ -719,7 +714,7 @@ class StencilModuleEntry {
|
||||
|
||||
static StencilModuleEntry exportNamespaceFromEntry(
|
||||
MaybeModuleRequestIndex moduleRequest, TaggedParserAtomIndex exportName,
|
||||
uint32_t lineno, JS::ColumnNumberZeroOrigin column) {
|
||||
uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
MOZ_ASSERT(exportName);
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
@ -729,8 +724,7 @@ class StencilModuleEntry {
|
||||
}
|
||||
|
||||
static StencilModuleEntry exportBatchFromEntry(
|
||||
MaybeModuleRequestIndex moduleRequest, uint32_t lineno,
|
||||
JS::ColumnNumberZeroOrigin column) {
|
||||
MaybeModuleRequestIndex moduleRequest, uint32_t lineno, uint32_t column) {
|
||||
MOZ_ASSERT(moduleRequest.isSome());
|
||||
StencilModuleEntry entry(lineno, column);
|
||||
entry.moduleRequest = MaybeModuleRequestIndex(moduleRequest);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ds/LifoAlloc.h" // LifoAlloc
|
||||
#include "frontend/CompilationStencil.h" // CompilationStencil, ExtensibleCompilationStencil
|
||||
#include "frontend/ScriptIndex.h" // ScriptIndex
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "vm/Scope.h" // SizeOfParserScopeData
|
||||
#include "vm/StencilEnums.h" // js::ImmutableScriptFlagsEnum
|
||||
|
||||
@ -602,7 +601,7 @@ template <XDRMode mode>
|
||||
MOZ_TRY(xdr->codeUint32(stencil.importName.rawDataRef()));
|
||||
MOZ_TRY(xdr->codeUint32(stencil.exportName.rawDataRef()));
|
||||
MOZ_TRY(xdr->codeUint32(&stencil.lineno));
|
||||
MOZ_TRY(xdr->codeUint32(stencil.column.addressOfValueForTranscode()));
|
||||
MOZ_TRY(xdr->codeUint32(&stencil.column));
|
||||
|
||||
return Ok();
|
||||
}
|
||||
@ -1305,7 +1304,7 @@ XDRResult StencilXDR::codeSource(XDRState<mode>* xdr,
|
||||
}
|
||||
|
||||
MOZ_TRY(xdr->codeUint32(&source->startLine_));
|
||||
MOZ_TRY(xdr->codeUint32(source->startColumn_.addressOfValueForTranscode()));
|
||||
MOZ_TRY(xdr->codeUint32(&source->startColumn_));
|
||||
|
||||
// The introduction info doesn't persist across encode/decode.
|
||||
if (mode == XDR_DECODE) {
|
||||
|
@ -34,9 +34,8 @@
|
||||
#include "frontend/Parser.h"
|
||||
#include "frontend/ParserAtom.h"
|
||||
#include "frontend/ReservedWords.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_smprintf
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlags
|
||||
@ -454,8 +453,7 @@ TokenStreamSpecific<Unit, AnyCharsAccess>::TokenStreamSpecific(
|
||||
|
||||
bool TokenStreamAnyChars::checkOptions() {
|
||||
// Constrain starting columns to where they will saturate.
|
||||
if (options().column.zeroOriginValue() >
|
||||
JS::LimitedColumnNumberZeroOrigin::Limit) {
|
||||
if (options().column > ColumnLimit) {
|
||||
reportErrorNoOffset(JSMSG_BAD_COLUMN_NUMBER);
|
||||
return false;
|
||||
}
|
||||
@ -592,7 +590,7 @@ static MOZ_ALWAYS_INLINE void RetractPointerToCodePointBoundary(
|
||||
}
|
||||
|
||||
template <typename Unit>
|
||||
JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumn(
|
||||
uint32_t TokenStreamAnyChars::computePartialColumn(
|
||||
const LineToken lineToken, const uint32_t offset,
|
||||
const SourceUnits<Unit>& sourceUnits) const {
|
||||
lineToken.assertConsistentOffset(offset);
|
||||
@ -602,7 +600,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumn(
|
||||
|
||||
if constexpr (std::is_same_v<Unit, char16_t>) {
|
||||
// Column number is in UTF-16 code units.
|
||||
return JS::ColumnNumberZeroOrigin(offsetInLine);
|
||||
return offsetInLine;
|
||||
}
|
||||
|
||||
return computePartialColumnForUTF8(lineToken, offset, start, offsetInLine,
|
||||
@ -610,7 +608,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumn(
|
||||
}
|
||||
|
||||
template <typename Unit>
|
||||
JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
uint32_t TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
const LineToken lineToken, const uint32_t offset, const uint32_t start,
|
||||
const uint32_t offsetInLine, const SourceUnits<Unit>& sourceUnits) const {
|
||||
const uint32_t line = lineNumber(lineToken);
|
||||
@ -621,15 +619,14 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
lineOfLastColumnComputation_ = line;
|
||||
lastChunkVectorForLine_ = nullptr;
|
||||
lastOffsetOfComputedColumn_ = start;
|
||||
lastComputedColumn_ = JS::ColumnNumberZeroOrigin::zero();
|
||||
lastComputedColumn_ = 0;
|
||||
}
|
||||
|
||||
// Compute and return the final column number from a partial offset/column,
|
||||
// using the last-cached offset/column if they're more optimal.
|
||||
auto ColumnFromPartial = [this, offset, &sourceUnits](
|
||||
uint32_t partialOffset,
|
||||
JS::ColumnNumberZeroOrigin partialCols,
|
||||
UnitsType unitsType) {
|
||||
auto ColumnFromPartial = [this, offset, &sourceUnits](uint32_t partialOffset,
|
||||
uint32_t partialCols,
|
||||
UnitsType unitsType) {
|
||||
MOZ_ASSERT(partialOffset <= offset);
|
||||
|
||||
// If the last lookup on this line was closer to |offset|, use it.
|
||||
@ -649,10 +646,10 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
MOZ_ASSERT(unicode::CountUTF16CodeUnits(begin, end) == offsetDelta,
|
||||
"guaranteed-single-units also guarantee pointer distance "
|
||||
"equals UTF-16 code unit count");
|
||||
partialCols += JS::ColumnNumberOffset(offsetDelta);
|
||||
partialCols += offsetDelta;
|
||||
} else {
|
||||
partialCols += JS::ColumnNumberOffset(
|
||||
AssertedCast<uint32_t>(unicode::CountUTF16CodeUnits(begin, end)));
|
||||
partialCols +=
|
||||
AssertedCast<uint32_t>(unicode::CountUTF16CodeUnits(begin, end));
|
||||
}
|
||||
|
||||
this->lastOffsetOfComputedColumn_ = partialOffset;
|
||||
@ -677,15 +674,13 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
// not *always* worst-case.)
|
||||
UnitsType unitsType;
|
||||
if (lastChunkVectorForLine_ && lastChunkVectorForLine_->length() > 0) {
|
||||
MOZ_ASSERT((*lastChunkVectorForLine_)[0].column() ==
|
||||
JS::ColumnNumberZeroOrigin::zero());
|
||||
MOZ_ASSERT((*lastChunkVectorForLine_)[0].column() == 0);
|
||||
unitsType = (*lastChunkVectorForLine_)[0].unitsType();
|
||||
} else {
|
||||
unitsType = UnitsType::PossiblyMultiUnit;
|
||||
}
|
||||
|
||||
return ColumnFromPartial(start, JS::ColumnNumberZeroOrigin::zero(),
|
||||
unitsType);
|
||||
return ColumnFromPartial(start, 0, unitsType);
|
||||
}
|
||||
|
||||
// If this line has no chunk vector yet, insert one in the hash map. (The
|
||||
@ -698,8 +693,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
if (!longLineColumnInfo_.add(ptr, line, Vector<ChunkInfo>(fc))) {
|
||||
// In case of OOM, just count columns from the start of the line.
|
||||
fc->recoverFromOutOfMemory();
|
||||
return ColumnFromPartial(start, JS::ColumnNumberZeroOrigin::zero(),
|
||||
UnitsType::PossiblyMultiUnit);
|
||||
return ColumnFromPartial(start, 0, UnitsType::PossiblyMultiUnit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -734,7 +728,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
};
|
||||
|
||||
uint32_t partialOffset;
|
||||
JS::ColumnNumberZeroOrigin partialColumn;
|
||||
uint32_t partialColumn;
|
||||
UnitsType unitsType;
|
||||
|
||||
auto entriesLen = AssertedCast<uint32_t>(lastChunkVectorForLine_->length());
|
||||
@ -762,7 +756,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
partialColumn = (*lastChunkVectorForLine_)[entriesLen - 1].column();
|
||||
} else {
|
||||
partialOffset = start;
|
||||
partialColumn = JS::ColumnNumberZeroOrigin::zero();
|
||||
partialColumn = 0;
|
||||
}
|
||||
|
||||
if (!lastChunkVectorForLine_->reserve(chunkIndex + 1)) {
|
||||
@ -777,8 +771,8 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
// The vector always begins with the column of the line start, i.e. zero,
|
||||
// with chunk units pessimally assumed not single-unit.
|
||||
if (entriesLen == 0) {
|
||||
lastChunkVectorForLine_->infallibleAppend(ChunkInfo(
|
||||
JS::ColumnNumberZeroOrigin::zero(), UnitsType::PossiblyMultiUnit));
|
||||
lastChunkVectorForLine_->infallibleAppend(
|
||||
ChunkInfo(0, UnitsType::PossiblyMultiUnit));
|
||||
entriesLen++;
|
||||
}
|
||||
|
||||
@ -813,7 +807,7 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
}
|
||||
|
||||
partialOffset += numUnits;
|
||||
partialColumn += JS::ColumnNumberOffset(numUTF16CodeUnits);
|
||||
partialColumn += numUTF16CodeUnits;
|
||||
|
||||
lastChunkVectorForLine_->infallibleEmplaceBack(
|
||||
partialColumn, UnitsType::PossiblyMultiUnit);
|
||||
@ -828,32 +822,37 @@ JS::ColumnNumberZeroOrigin TokenStreamAnyChars::computePartialColumnForUTF8(
|
||||
}
|
||||
|
||||
template <typename Unit, class AnyCharsAccess>
|
||||
JS::LimitedColumnNumberZeroOrigin
|
||||
GeneralTokenStreamChars<Unit, AnyCharsAccess>::computeColumn(
|
||||
uint32_t GeneralTokenStreamChars<Unit, AnyCharsAccess>::computeColumn(
|
||||
LineToken lineToken, uint32_t offset) const {
|
||||
lineToken.assertConsistentOffset(offset);
|
||||
|
||||
const TokenStreamAnyChars& anyChars = anyCharsAccess();
|
||||
|
||||
JS::ColumnNumberZeroOrigin column =
|
||||
uint32_t column =
|
||||
anyChars.computePartialColumn(lineToken, offset, this->sourceUnits);
|
||||
|
||||
if (lineToken.isFirstLine()) {
|
||||
if (column.zeroOriginValue() > JS::LimitedColumnNumberZeroOrigin::Limit) {
|
||||
return JS::LimitedColumnNumberZeroOrigin::limit();
|
||||
if (column > ColumnLimit) {
|
||||
return ColumnLimit;
|
||||
}
|
||||
|
||||
uint32_t firstLineOffset = anyChars.options_.column.zeroOriginValue();
|
||||
column += JS::ColumnNumberOffset(firstLineOffset);
|
||||
static_assert(uint32_t(ColumnLimit + ColumnLimit) > ColumnLimit,
|
||||
"Adding ColumnLimit should not overflow");
|
||||
|
||||
uint32_t firstLineOffset = anyChars.options_.column;
|
||||
column += firstLineOffset;
|
||||
}
|
||||
|
||||
return JS::LimitedColumnNumberZeroOrigin::fromUnlimited(column);
|
||||
if (column > ColumnLimit) {
|
||||
return ColumnLimit;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
template <typename Unit, class AnyCharsAccess>
|
||||
void GeneralTokenStreamChars<Unit, AnyCharsAccess>::computeLineAndColumn(
|
||||
uint32_t offset, uint32_t* line,
|
||||
JS::LimitedColumnNumberZeroOrigin* column) const {
|
||||
uint32_t offset, uint32_t* line, uint32_t* column) const {
|
||||
const TokenStreamAnyChars& anyChars = anyCharsAccess();
|
||||
|
||||
auto lineToken = anyChars.lineToken(offset);
|
||||
@ -912,14 +911,14 @@ MOZ_COLD void TokenStreamChars<Utf8Unit, AnyCharsAccess>::internalEncodingError(
|
||||
|
||||
ptr[-1] = '\0';
|
||||
|
||||
uint32_t line;
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
uint32_t line, column;
|
||||
computeLineAndColumn(offset, &line, &column);
|
||||
|
||||
column = JSErrorBase::fromZeroOriginToOneOrigin(column);
|
||||
|
||||
if (!notes->addNoteASCII(anyChars.fc, anyChars.getFilename().c_str(), 0,
|
||||
line, JS::ColumnNumberOneOrigin(column),
|
||||
GetErrorMessage, nullptr, JSMSG_BAD_CODE_UNITS,
|
||||
badUnitsStr)) {
|
||||
line, column, GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_CODE_UNITS, badUnitsStr)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1460,7 +1459,7 @@ void TokenStreamAnyChars::computeErrorMetadataNoOffset(
|
||||
err->isMuted = mutedErrors;
|
||||
err->filename = filename_;
|
||||
err->lineNumber = 0;
|
||||
err->columnNumber = JS::ColumnNumberZeroOrigin::zero();
|
||||
err->columnNumber = 0;
|
||||
|
||||
MOZ_ASSERT(err->lineOfContext == nullptr);
|
||||
}
|
||||
@ -1479,11 +1478,7 @@ bool TokenStreamAnyChars::fillExceptingContext(ErrorMetadata* err,
|
||||
maybeCx->realm()->principals());
|
||||
if (!iter.done() && iter.filename()) {
|
||||
err->filename = JS::ConstUTF8CharsZ(iter.filename());
|
||||
JS::TaggedColumnNumberZeroOrigin columnNumber;
|
||||
err->lineNumber = iter.computeLine(&columnNumber);
|
||||
// NOTE: Wasm frame cannot appear here.
|
||||
err->columnNumber =
|
||||
JS::ColumnNumberZeroOrigin(columnNumber.toLimitedColumnNumber());
|
||||
err->lineNumber = iter.computeLine(&err->columnNumber);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,6 @@
|
||||
#include "frontend/Token.h"
|
||||
#include "frontend/TokenKind.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin
|
||||
#include "js/CompileOptions.h"
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/HashTable.h" // js::HashMap
|
||||
@ -223,6 +222,16 @@ class FrontendContext;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
// Saturate column number at a limit that can be represented in various parts of
|
||||
// the engine. Source locations beyond this point will report at the limit
|
||||
// column instead.
|
||||
//
|
||||
// See:
|
||||
// - TokenStreamAnyChars::checkOptions
|
||||
// - ColSpan::isRepresentable
|
||||
// - WasmFrameIter::computeLine
|
||||
static constexpr uint32_t ColumnLimit = std::numeric_limits<int32_t>::max() / 2;
|
||||
|
||||
// True if str is a keyword.
|
||||
bool IsKeyword(TaggedParserAtomIndex atom);
|
||||
|
||||
@ -512,14 +521,14 @@ class ChunkInfo {
|
||||
unsigned char unitsType_;
|
||||
|
||||
public:
|
||||
ChunkInfo(JS::ColumnNumberZeroOrigin col, UnitsType type)
|
||||
ChunkInfo(uint32_t col, UnitsType type)
|
||||
: unitsType_(static_cast<unsigned char>(type)) {
|
||||
memcpy(column_, col.addressOfValueForTranscode(), sizeof(col));
|
||||
memcpy(column_, &col, sizeof(col));
|
||||
}
|
||||
|
||||
JS::ColumnNumberZeroOrigin column() const {
|
||||
JS::ColumnNumberZeroOrigin col;
|
||||
memcpy(col.addressOfValueForTranscode(), column_, sizeof(uint32_t));
|
||||
uint32_t column() const {
|
||||
uint32_t col;
|
||||
memcpy(&col, column_, sizeof(uint32_t));
|
||||
return col;
|
||||
}
|
||||
|
||||
@ -625,7 +634,7 @@ class TokenStreamAnyChars : public TokenStreamShared {
|
||||
* The column number for the offset (in code units) of the last column
|
||||
* computation performed, relative to source start.
|
||||
*/
|
||||
mutable JS::ColumnNumberZeroOrigin lastComputedColumn_;
|
||||
mutable uint32_t lastComputedColumn_ = 0;
|
||||
|
||||
// Intra-token fields.
|
||||
|
||||
@ -950,12 +959,12 @@ class TokenStreamAnyChars : public TokenStreamShared {
|
||||
* And this is the best place to do that.
|
||||
*/
|
||||
template <typename Unit>
|
||||
JS::ColumnNumberZeroOrigin computePartialColumn(
|
||||
const LineToken lineToken, const uint32_t offset,
|
||||
const SourceUnits<Unit>& sourceUnits) const;
|
||||
uint32_t computePartialColumn(const LineToken lineToken,
|
||||
const uint32_t offset,
|
||||
const SourceUnits<Unit>& sourceUnits) const;
|
||||
|
||||
template <typename Unit>
|
||||
JS::ColumnNumberZeroOrigin computePartialColumnForUTF8(
|
||||
uint32_t computePartialColumnForUTF8(
|
||||
const LineToken lineToken, const uint32_t offset, const uint32_t start,
|
||||
const uint32_t offsetInLine, const SourceUnits<Unit>& sourceUnits) const;
|
||||
|
||||
@ -1984,10 +1993,9 @@ class GeneralTokenStreamChars : public SpecializedTokenStreamCharsBase<Unit> {
|
||||
* |offset| must be a code point boundary, preceded only by validly-encoded
|
||||
* source units. (It doesn't have to be *followed* by valid source units.)
|
||||
*/
|
||||
JS::LimitedColumnNumberZeroOrigin computeColumn(LineToken lineToken,
|
||||
uint32_t offset) const;
|
||||
uint32_t computeColumn(LineToken lineToken, uint32_t offset) const;
|
||||
void computeLineAndColumn(uint32_t offset, uint32_t* line,
|
||||
JS::LimitedColumnNumberZeroOrigin* column) const;
|
||||
uint32_t* column) const;
|
||||
|
||||
/**
|
||||
* Fill in |err| completely, except for line-of-context information.
|
||||
@ -1998,9 +2006,7 @@ class GeneralTokenStreamChars : public SpecializedTokenStreamCharsBase<Unit> {
|
||||
[[nodiscard]] bool fillExceptingContext(ErrorMetadata* err,
|
||||
uint32_t offset) const {
|
||||
if (anyCharsAccess().fillExceptingContext(err, offset)) {
|
||||
JS::LimitedColumnNumberZeroOrigin columnNumber;
|
||||
computeLineAndColumn(offset, &err->lineNumber, &columnNumber);
|
||||
err->columnNumber = JS::ColumnNumberZeroOrigin(columnNumber);
|
||||
computeLineAndColumn(offset, &err->lineNumber, &err->columnNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -2537,7 +2543,7 @@ class MOZ_STACK_CLASS TokenStreamSpecific
|
||||
return anyChars.lineNumber(lineToken);
|
||||
}
|
||||
|
||||
JS::LimitedColumnNumberZeroOrigin columnAt(size_t offset) const final {
|
||||
uint32_t columnAt(size_t offset) const final {
|
||||
return computeColumn(anyCharsAccess().lineToken(offset), offset);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "irregexp/RegExpNativeMacroAssembler.h"
|
||||
#include "irregexp/RegExpShim.h"
|
||||
#include "jit/JitCommon.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOffset
|
||||
#include "js/friend/ErrorMessages.h" // JSMSG_*
|
||||
#include "js/friend/StackLimits.h" // js::ReportOverRecursed
|
||||
#include "util/StringBuffer.h"
|
||||
@ -175,16 +174,12 @@ size_t IsolateSizeOfIncludingThis(Isolate* isolate,
|
||||
return isolate->sizeOfIncludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
static JS::ColumnNumberZeroOrigin ComputeColumn(const Latin1Char* begin,
|
||||
const Latin1Char* end) {
|
||||
return JS::ColumnNumberZeroOrigin(
|
||||
AssertedCast<uint32_t>(PointerRangeSize(begin, end)));
|
||||
static size_t ComputeColumn(const Latin1Char* begin, const Latin1Char* end) {
|
||||
return PointerRangeSize(begin, end);
|
||||
}
|
||||
|
||||
static JS::ColumnNumberZeroOrigin ComputeColumn(const char16_t* begin,
|
||||
const char16_t* end) {
|
||||
return JS::ColumnNumberZeroOrigin(
|
||||
AssertedCast<uint32_t>(unicode::CountUTF16CodeUnits(begin, end)));
|
||||
static size_t ComputeColumn(const char16_t* begin, const char16_t* end) {
|
||||
return unicode::CountUTF16CodeUnits(begin, end);
|
||||
}
|
||||
|
||||
// This function is varargs purely so it can call ReportCompileErrorLatin1.
|
||||
@ -192,7 +187,7 @@ static JS::ColumnNumberZeroOrigin ComputeColumn(const char16_t* begin,
|
||||
template <typename CharT>
|
||||
static void ReportSyntaxError(TokenStreamAnyChars& ts,
|
||||
mozilla::Maybe<uint32_t> line,
|
||||
mozilla::Maybe<JS::ColumnNumberZeroOrigin> column,
|
||||
mozilla::Maybe<uint32_t> column,
|
||||
RegExpCompileData& result, CharT* start,
|
||||
size_t length, ...) {
|
||||
MOZ_ASSERT(line.isSome() == column.isSome());
|
||||
@ -218,8 +213,8 @@ static void ReportSyntaxError(TokenStreamAnyChars& ts,
|
||||
// a line of context based on the expression source.
|
||||
uint32_t location = ts.currentToken().pos.begin;
|
||||
if (ts.fillExceptingContext(&err, location)) {
|
||||
JS::ColumnNumberZeroOrigin columnNumber =
|
||||
ComputeColumn(start, start + offset);
|
||||
uint32_t columnNumber =
|
||||
AssertedCast<uint32_t>(ComputeColumn(start, start + offset));
|
||||
if (line.isSome()) {
|
||||
// If this pattern is being checked by the frontend Parser instead
|
||||
// of other API entry points like |new RegExp|, then the parser will
|
||||
@ -228,8 +223,7 @@ static void ReportSyntaxError(TokenStreamAnyChars& ts,
|
||||
// We adjust the columnNumber to point to the actual syntax error
|
||||
// inside the literal.
|
||||
err.lineNumber = *line;
|
||||
auto offset = JS::ColumnNumberOffset(columnNumber.zeroOriginValue());
|
||||
err.columnNumber = *column + offset;
|
||||
err.columnNumber = *column + columnNumber;
|
||||
} else {
|
||||
// Line breaks are not significant in pattern text in the same way as
|
||||
// in source text, so act as though pattern text is a single line, then
|
||||
@ -318,7 +312,7 @@ bool CheckPatternSyntax(js::LifoAlloc& alloc, JS::NativeStackLimit stackLimit,
|
||||
TokenStreamAnyChars& ts,
|
||||
const mozilla::Range<const char16_t> chars,
|
||||
JS::RegExpFlags flags, mozilla::Maybe<uint32_t> line,
|
||||
mozilla::Maybe<JS::ColumnNumberZeroOrigin> column) {
|
||||
mozilla::Maybe<uint32_t> column) {
|
||||
RegExpCompileData result;
|
||||
JS::AutoAssertNoGC nogc;
|
||||
if (!CheckPatternSyntaxImpl(alloc, stackLimit, chars.begin().get(),
|
||||
|
@ -19,8 +19,7 @@
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "irregexp/RegExpTypes.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/Stack.h" // JS::NativeStackLimit
|
||||
#include "js/Stack.h" // JS::NativeStackLimit
|
||||
#include "vm/RegExpShared.h"
|
||||
|
||||
struct JS_PUBLIC_API JSContext;
|
||||
@ -52,12 +51,12 @@ void DestroyIsolate(Isolate* isolate);
|
||||
size_t IsolateSizeOfIncludingThis(Isolate* isolate,
|
||||
mozilla::MallocSizeOf mallocSizeOf);
|
||||
|
||||
bool CheckPatternSyntax(
|
||||
js::LifoAlloc& alloc, JS::NativeStackLimit stackLimit,
|
||||
frontend::TokenStreamAnyChars& ts,
|
||||
const mozilla::Range<const char16_t> chars, JS::RegExpFlags flags,
|
||||
mozilla::Maybe<uint32_t> line = mozilla::Nothing(),
|
||||
mozilla::Maybe<JS::ColumnNumberZeroOrigin> column = mozilla::Nothing());
|
||||
bool CheckPatternSyntax(js::LifoAlloc& alloc, JS::NativeStackLimit stackLimit,
|
||||
frontend::TokenStreamAnyChars& ts,
|
||||
const mozilla::Range<const char16_t> chars,
|
||||
JS::RegExpFlags flags,
|
||||
mozilla::Maybe<uint32_t> line = mozilla::Nothing(),
|
||||
mozilla::Maybe<uint32_t> column = mozilla::Nothing());
|
||||
bool CheckPatternSyntax(JSContext* cx, JS::NativeStackLimit stackLimit,
|
||||
frontend::TokenStreamAnyChars& ts,
|
||||
Handle<JSAtom*> pattern, JS::RegExpFlags flags);
|
||||
|
@ -35,7 +35,7 @@ if (helperThreadCount() > 0) {
|
||||
// Check handling of columns near the limit of our ability to represent them.
|
||||
// (This is hardly thorough, but since web content can't set column numbers,
|
||||
// it's probably not worth it to be thorough.)
|
||||
const maxColumn = Math.pow(2, 30) - 2;
|
||||
const maxColumn = Math.pow(2, 30) - 1;
|
||||
assertEq(evaluate("saveStack().column", { columnNumber: maxColumn }),
|
||||
maxColumn + 1);
|
||||
|
||||
|
@ -477,8 +477,7 @@ bool BaselineStackBuilder::initFrame() {
|
||||
}
|
||||
|
||||
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%u:%u",
|
||||
script_->filename(), script_->lineno(),
|
||||
script_->column().zeroOriginValue());
|
||||
script_->filename(), script_->lineno(), script_->column());
|
||||
JitSpew(JitSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
|
||||
|
||||
// Write the previous frame pointer value. For the outermost frame we reuse
|
||||
@ -1495,7 +1494,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().zeroOriginValue());
|
||||
script_->column());
|
||||
JitSpew(JitSpew_BaselineBailouts, " Bailout kind: %s",
|
||||
BailoutKindString(bailoutKind()));
|
||||
#endif
|
||||
@ -1581,8 +1580,7 @@ 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().zeroOriginValue(), (void*)iter.ionScript(),
|
||||
(int)prevFrameType);
|
||||
iter.script()->column(), (void*)iter.ionScript(), (int)prevFrameType);
|
||||
|
||||
if (excInfo) {
|
||||
if (excInfo->catchingException()) {
|
||||
@ -1627,7 +1625,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().zeroOriginValue());
|
||||
iter.script()->column());
|
||||
} else {
|
||||
JitSpew(JitSpew_BaselineBailouts, " No callee!");
|
||||
}
|
||||
@ -1731,9 +1729,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().zeroOriginValue(), outerScript->filename(),
|
||||
outerScript->lineno(), outerScript->column().zeroOriginValue());
|
||||
innerScript->filename(), innerScript->lineno(), innerScript->column(),
|
||||
outerScript->filename(), outerScript->lineno(),
|
||||
outerScript->column());
|
||||
|
||||
if (!innerScript->failedLexicalCheck()) {
|
||||
innerScript->setFailedLexicalCheck();
|
||||
@ -1960,10 +1958,9 @@ 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().zeroOriginValue(),
|
||||
outerScript->filename(), outerScript->lineno(), outerScript->column(),
|
||||
outerScript->getWarmUpCount(), innerScript->filename(),
|
||||
innerScript->lineno(), innerScript->column().zeroOriginValue(),
|
||||
innerScript->lineno(), innerScript->column(),
|
||||
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().zeroOriginValue());
|
||||
outerScript->column());
|
||||
return ICAttachResult::DuplicateStub;
|
||||
}
|
||||
|
||||
|
@ -201,12 +201,10 @@ 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().zeroOriginValue(), script.get());
|
||||
script->filename(), script->lineno(), script->column(), script.get());
|
||||
|
||||
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%u:%u",
|
||||
script->filename(), script->lineno(),
|
||||
script->column().zeroOriginValue());
|
||||
script->filename(), script->lineno(), script->column());
|
||||
|
||||
AutoIncrementalTimer timer(cx->realm()->timers.baselineCompileTime);
|
||||
|
||||
@ -287,7 +285,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().zeroOriginValue());
|
||||
script->lineno(), script->column());
|
||||
|
||||
baselineScript->copyRetAddrEntries(handler.retAddrEntries().begin());
|
||||
baselineScript->copyOSREntries(handler.osrEntries().begin());
|
||||
@ -312,8 +310,8 @@ MethodStatus BaselineCompiler::compile() {
|
||||
{
|
||||
JitSpew(JitSpew_Profiling,
|
||||
"Added JitcodeGlobalEntry for baseline script %s:%u:%u (%p)",
|
||||
script->filename(), script->lineno(),
|
||||
script->column().zeroOriginValue(), baselineScript.get());
|
||||
script->filename(), script->lineno(), script->column(),
|
||||
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().zeroOriginValue(),
|
||||
script->lineno(), script->column(),
|
||||
RetAddrEntryKindToString(frameKind), CodeName(JSOp(*pc)));
|
||||
}
|
||||
|
||||
@ -411,8 +411,7 @@ static bool RecompileBaselineScriptForDebugMode(
|
||||
}
|
||||
|
||||
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%u:%u) for %s",
|
||||
script->filename(), script->lineno(),
|
||||
script->column().zeroOriginValue(),
|
||||
script->filename(), script->lineno(), script->column(),
|
||||
observing ? "DEBUGGING" : "NORMAL EXECUTION");
|
||||
|
||||
AutoKeepJitScripts keepJitScripts(cx);
|
||||
|
@ -158,10 +158,9 @@ 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().zeroOriginValue(), script->pcToOffset(pc),
|
||||
PCToLineNumber(script, pc), script->getWarmUpCount(),
|
||||
stub->numOptimizedStubs(), fmtbuf);
|
||||
script->filename(), script->lineno(), script->column(),
|
||||
script->pcToOffset(pc), PCToLineNumber(script, pc),
|
||||
script->getWarmUpCount(), stub->numOptimizedStubs(), fmtbuf);
|
||||
}
|
||||
}
|
||||
#endif // JS_JITSPEW
|
||||
|
@ -320,8 +320,7 @@ 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().zeroOriginValue());
|
||||
script_->filename(), script_->lineno(), script_->column());
|
||||
script_->disableIon();
|
||||
}
|
||||
}
|
||||
@ -336,8 +335,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().zeroOriginValue(), CodeName(op));
|
||||
script_->filename(), script_->lineno(), script_->column(),
|
||||
CodeName(op));
|
||||
script_->disableIon();
|
||||
}
|
||||
break;
|
||||
|
@ -13,7 +13,6 @@
|
||||
# include "jit/BaselineIC.h"
|
||||
# include "jit/CacheIRCompiler.h"
|
||||
# include "jit/JitScript.h"
|
||||
# include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
# include "vm/JSScript.h"
|
||||
|
||||
# include "vm/JSObject-inl.h"
|
||||
@ -142,8 +141,7 @@ void CacheIRHealth::spewShapeInformation(AutoStructuredSpewer& spew,
|
||||
{
|
||||
spew->property("filename", baseScript->filename());
|
||||
spew->property("line", baseScript->lineno());
|
||||
spew->property("column",
|
||||
baseScript->column().zeroOriginValue());
|
||||
spew->property("column", baseScript->column());
|
||||
}
|
||||
spew->endObject();
|
||||
}
|
||||
@ -272,9 +270,9 @@ bool CacheIRHealth::spewICEntryHealth(AutoStructuredSpewer& spew, JSContext* cx,
|
||||
|
||||
// TODO: If a perf issue arises, look into improving the SrcNotes
|
||||
// API call below.
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
unsigned column;
|
||||
spew->property("lineno", PCToLineNumber(script, pc, &column));
|
||||
spew->property("column", column.zeroOriginValue());
|
||||
spew->property("column", column);
|
||||
|
||||
ICStub* firstStub = entry->firstStub();
|
||||
if (!firstStub->isFallback()) {
|
||||
@ -307,7 +305,7 @@ void CacheIRHealth::spewScriptFinalWarmUpCount(JSContext* cx,
|
||||
|
||||
spew->property("filename", filename);
|
||||
spew->property("line", script->lineno());
|
||||
spew->property("column", script->column().zeroOriginValue());
|
||||
spew->property("column", script->column());
|
||||
spew->property("finalWarmUpCount", warmUpCount);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
# include "jsapi.h"
|
||||
# include "jsmath.h"
|
||||
|
||||
# include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
# include "js/ScalarType.h" // js::Scalar::Type
|
||||
# include "js/ScalarType.h" // js::Scalar::Type
|
||||
# include "util/GetPidProvider.h"
|
||||
# include "util/Text.h"
|
||||
# include "vm/JSFunction.h"
|
||||
@ -341,9 +340,9 @@ void CacheIRSpewer::beginCache(const IRGenerator& gen) {
|
||||
j.property("file", filename ? filename : "null");
|
||||
j.property("mode", int(gen.mode_));
|
||||
if (jsbytecode* pc = gen.pc_) {
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
unsigned column;
|
||||
j.property("line", PCToLineNumber(gen.script_, pc, &column));
|
||||
j.property("column", column.zeroOriginValue());
|
||||
j.property("column", column);
|
||||
j.formatProperty("pc", "%p", pc);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "jit/SharedICRegisters.h"
|
||||
#include "jit/VMFunctions.h"
|
||||
#include "jit/WarpSnapshot.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/experimental/JitInfo.h" // JSJit{Getter,Setter}CallArgs, JSJitMethodCallArgsTraits, JSJitInfo
|
||||
#include "js/friend/DOMProxy.h" // JS::ExpandoAndGeneration
|
||||
#include "js/RegExpFlags.h" // JS::RegExpFlag
|
||||
@ -7273,18 +7272,22 @@ bool CodeGenerator::generateBody() {
|
||||
#ifdef JS_JITSPEW
|
||||
const char* filename = nullptr;
|
||||
size_t lineNumber = 0;
|
||||
JS::LimitedColumnNumberZeroOrigin columnNumber;
|
||||
unsigned columnNumber = 0;
|
||||
if (current->mir()->info().script()) {
|
||||
filename = current->mir()->info().script()->filename();
|
||||
if (current->mir()->pc()) {
|
||||
lineNumber = PCToLineNumber(current->mir()->info().script(),
|
||||
current->mir()->pc(), &columnNumber);
|
||||
}
|
||||
} else {
|
||||
# ifdef DEBUG
|
||||
lineNumber = current->mir()->lineno();
|
||||
columnNumber = current->mir()->columnIndex();
|
||||
# endif
|
||||
}
|
||||
JitSpew(JitSpew_Codegen, "--------------------------------");
|
||||
JitSpew(JitSpew_Codegen, "# block%zu %s:%zu:%u%s:", i,
|
||||
filename ? filename : "?", lineNumber,
|
||||
columnNumber.zeroOriginValue(),
|
||||
filename ? filename : "?", lineNumber, columnNumber,
|
||||
current->mir()->isLoopHeader() ? " (loop header)" : "");
|
||||
#endif
|
||||
|
||||
@ -14099,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().zeroOriginValue());
|
||||
gen->outerInfo().script()->column());
|
||||
|
||||
// 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().zeroOriginValue());
|
||||
script->column());
|
||||
}
|
||||
|
||||
TempAllocator temp(&cx->tempLifoAlloc());
|
||||
|
@ -1670,8 +1670,7 @@ 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().zeroOriginValue());
|
||||
script->filename(), script->lineno(), script->column());
|
||||
|
||||
IonCompileTask* task = alloc->new_<IonCompileTask>(cx, *mirGen, snapshot);
|
||||
if (!task) {
|
||||
@ -1787,7 +1786,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().zeroOriginValue());
|
||||
script->lineno(), script->column());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1832,8 +1831,7 @@ 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().zeroOriginValue());
|
||||
script->filename(), script->lineno(), script->column());
|
||||
return Method_CantCompile;
|
||||
}
|
||||
|
||||
@ -2098,9 +2096,8 @@ 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().zeroOriginValue(), (int)script->getWarmUpCount(),
|
||||
(void*)pc);
|
||||
script->filename(), script->lineno(), script->column(),
|
||||
(int)script->getWarmUpCount(), (void*)pc);
|
||||
|
||||
MethodStatus stat;
|
||||
if (isLoopHead) {
|
||||
@ -2294,8 +2291,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().zeroOriginValue(),
|
||||
frame.maybeCallee(), script, frame.resumePCinCurrentFrame());
|
||||
script->lineno(), script->column(), frame.maybeCallee(), script,
|
||||
frame.resumePCinCurrentFrame());
|
||||
break;
|
||||
}
|
||||
case FrameType::BaselineStub:
|
||||
@ -2469,7 +2466,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().zeroOriginValue(), ionScript);
|
||||
info.script()->column(), ionScript);
|
||||
|
||||
// Keep the ion script alive during the invalidation and flag this
|
||||
// ionScript as being invalidated. This increment is removed by the
|
||||
@ -2555,8 +2552,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().zeroOriginValue());
|
||||
UniqueChars buf =
|
||||
JS_smprintf("%s:%u:%u", filename, script->lineno(), script->column());
|
||||
|
||||
// Ignore the event on allocation failure.
|
||||
if (buf) {
|
||||
@ -2590,8 +2587,7 @@ 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().zeroOriginValue());
|
||||
script->filename(), script->lineno(), script->column());
|
||||
|
||||
CancelOffThreadIonCompile(script);
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "jit/JitSpewer.h"
|
||||
#include "jit/ScriptFromCalleeToken.h"
|
||||
#include "jit/TrialInlining.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "vm/BytecodeUtil.h"
|
||||
#include "vm/Compartment.h"
|
||||
#include "vm/FrameIter.h" // js::OnlyJSJitFrameIter
|
||||
@ -597,14 +596,14 @@ void jit::JitSpewBaselineICStats(JSScript* script, const char* dumpReason) {
|
||||
uint32_t pcOffset = fallback->pcOffset();
|
||||
jsbytecode* pc = script->offsetToPC(pcOffset);
|
||||
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
unsigned column;
|
||||
unsigned int line = PCToLineNumber(script, pc, &column);
|
||||
|
||||
spew->beginObject();
|
||||
spew->property("op", CodeName(JSOp(*pc)));
|
||||
spew->property("pc", pcOffset);
|
||||
spew->property("line", line);
|
||||
spew->property("column", column.zeroOriginValue());
|
||||
spew->property("column", column);
|
||||
|
||||
spew->beginListProperty("counts");
|
||||
ICStub* stub = entry.firstStub();
|
||||
|
@ -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().zeroOriginValue(),
|
||||
scriptList[0].script->column(),
|
||||
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().zeroOriginValue());
|
||||
scriptList[i].script->column());
|
||||
}
|
||||
|
||||
// Write out runs first. Keep a vector tracking the positive offsets from
|
||||
|
@ -575,7 +575,9 @@ MBasicBlock::MBasicBlock(MIRGraph& graph, const CompileInfo& info,
|
||||
mark_(false),
|
||||
immediatelyDominated_(graph.alloc()),
|
||||
immediateDominator_(nullptr),
|
||||
trackedSite_(site) {
|
||||
trackedSite_(site),
|
||||
lineno_(0u),
|
||||
columnIndex_(0u) {
|
||||
MOZ_ASSERT(trackedSite_, "trackedSite_ is non-nullptr");
|
||||
}
|
||||
|
||||
|
@ -638,6 +638,18 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> {
|
||||
// this cycle. This is also used for tracking calls and optimizations when
|
||||
// profiling.
|
||||
BytecodeSite* trackedSite_;
|
||||
|
||||
// Line number (1-origin).
|
||||
unsigned lineno_;
|
||||
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
unsigned columnIndex_;
|
||||
|
||||
public:
|
||||
void setLineno(unsigned l) { lineno_ = l; }
|
||||
unsigned lineno() const { return lineno_; }
|
||||
void setColumnIndex(unsigned c) { columnIndex_ = c; }
|
||||
unsigned columnIndex() const { return columnIndex_; }
|
||||
};
|
||||
|
||||
using MBasicBlockIterator = InlineListIterator<MBasicBlock>;
|
||||
|
@ -67,7 +67,6 @@ 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"
|
||||
@ -155,10 +154,9 @@ static void WriteToJitDumpFile(const void* addr, uint32_t size,
|
||||
}
|
||||
|
||||
static void WriteJitDumpDebugEntry(uint64_t addr, const char* filename,
|
||||
uint32_t lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin colno,
|
||||
uint32_t lineno, uint32_t colno,
|
||||
AutoLockPerfSpewer& lock) {
|
||||
JitDumpDebugEntry entry = {addr, lineno, colno.zeroOriginValue()};
|
||||
JitDumpDebugEntry entry = {addr, lineno, colno};
|
||||
WriteToJitDumpFile(&entry, sizeof(entry), lock);
|
||||
WriteToJitDumpFile(filename, strlen(filename) + 1, lock);
|
||||
}
|
||||
@ -793,8 +791,7 @@ void PerfSpewer::saveJitCodeIRInfo(JitCode* code,
|
||||
}
|
||||
uint64_t addr = uint64_t(code->raw()) + entry.offset;
|
||||
uint64_t lineno = i + 1;
|
||||
WriteJitDumpDebugEntry(addr, scriptFilename.get(), lineno,
|
||||
JS::LimitedColumnNumberZeroOrigin::zero(), lock);
|
||||
WriteJitDumpDebugEntry(addr, scriptFilename.get(), lineno, 0, lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -866,7 +863,7 @@ void BaselinePerfSpewer::saveJitCodeSourceInfo(
|
||||
#endif
|
||||
|
||||
uint32_t lineno = script->lineno();
|
||||
JS::LimitedColumnNumberZeroOrigin colno = script->column();
|
||||
uint32_t colno = script->column();
|
||||
uint64_t offset = 0;
|
||||
for (SrcNoteIterator iter(script->notes()); !iter.atEnd(); ++iter) {
|
||||
const auto* sn = *iter;
|
||||
@ -875,10 +872,10 @@ void BaselinePerfSpewer::saveJitCodeSourceInfo(
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
colno = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
colno = 0;
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
colno = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
colno = 0;
|
||||
} else if (type == SrcNoteType::ColSpan) {
|
||||
colno += SrcNote::ColSpan::getSpan(sn);
|
||||
} else {
|
||||
@ -940,7 +937,7 @@ void IonPerfSpewer::saveJitCodeSourceInfo(JSScript* script, JitCode* code,
|
||||
}
|
||||
#endif
|
||||
uint32_t lineno = 0;
|
||||
JS::LimitedColumnNumberZeroOrigin colno;
|
||||
uint32_t colno = 0;
|
||||
|
||||
for (OpcodeEntry& entry : opcodes_) {
|
||||
jsbytecode* pc = entry.bytecodepc;
|
||||
@ -980,11 +977,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().zeroOriginValue());
|
||||
script->lineno(), script->column());
|
||||
}
|
||||
return JS_smprintf("%s: %s (%s:%u:%u)", tierName,
|
||||
funName ? funName.get() : "*", script->filename(),
|
||||
script->lineno(), script->column().zeroOriginValue());
|
||||
script->lineno(), script->column());
|
||||
}
|
||||
|
||||
void PerfSpewer::saveDebugInfo(JSScript* script, JitCode* code,
|
||||
|
@ -91,8 +91,7 @@ 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().zeroOriginValue(), frame->script(),
|
||||
root);
|
||||
script->lineno(), script->column(), frame->script(), root);
|
||||
JitSpewIndent spewIndent(JitSpew_WarpTrialInlining);
|
||||
}
|
||||
|
||||
@ -546,7 +545,7 @@ TrialInliningDecision TrialInliner::getInliningDecision(JSFunction* target,
|
||||
funName ? funName.get() : "<unnamed>",
|
||||
baseScript ? baseScript->filename() : "<not-scripted>",
|
||||
baseScript ? baseScript->lineno() : 0,
|
||||
baseScript ? baseScript->column().zeroOriginValue() : 0);
|
||||
baseScript ? baseScript->column() : 0);
|
||||
JitSpewIndent spewIndent(JitSpew_WarpTrialInlining);
|
||||
}
|
||||
#endif
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "jit/TrialInlining.h"
|
||||
#include "jit/TypeData.h"
|
||||
#include "jit/WarpBuilder.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "util/DifferentialTesting.h"
|
||||
#include "vm/BuiltinObjectKind.h"
|
||||
#include "vm/BytecodeIterator.h"
|
||||
@ -138,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().zeroOriginValue(),
|
||||
static_cast<JSScript*>(outerScript_), outerScript_->getWarmUpCount(),
|
||||
outerScript_->column(), static_cast<JSScript*>(outerScript_),
|
||||
outerScript_->getWarmUpCount(),
|
||||
outerScript_->isGenerator() ? " isGenerator" : "",
|
||||
outerScript_->isAsync() ? " isAsync" : "");
|
||||
#endif
|
||||
@ -731,8 +730,7 @@ AbortReasonOr<WarpScriptSnapshot*> WarpScriptOracle::createScriptSnapshot() {
|
||||
}
|
||||
|
||||
static void LineNumberAndColumn(HandleScript script, BytecodeLocation loc,
|
||||
unsigned* line,
|
||||
JS::LimitedColumnNumberZeroOrigin* column) {
|
||||
unsigned* line, unsigned* column) {
|
||||
#ifdef DEBUG
|
||||
*line = PCToLineNumber(script, loc.toRawBytecode(), column);
|
||||
#else
|
||||
@ -775,8 +773,7 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
fallbackStub->clearUsedByTranspiler();
|
||||
|
||||
if (firstStub == fallbackStub) {
|
||||
[[maybe_unused]] unsigned line;
|
||||
[[maybe_unused]] JS::LimitedColumnNumberZeroOrigin column;
|
||||
[[maybe_unused]] unsigned line, column;
|
||||
LineNumberAndColumn(script_, loc, &line, &column);
|
||||
|
||||
// No optimized stubs.
|
||||
@ -784,7 +781,7 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
"fallback stub (entered-count: %" PRIu32
|
||||
") for JSOp::%s @ %s:%u:%u",
|
||||
fallbackStub->enteredCount(), CodeName(loc.getOp()),
|
||||
script_->filename(), line, column.zeroOriginValue());
|
||||
script_->filename(), line, column);
|
||||
|
||||
// If the fallback stub was used but there's no optimized stub, use an IC.
|
||||
if (fallbackStub->enteredCount() != 0) {
|
||||
@ -803,13 +800,11 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
// Don't transpile if this IC ever encountered a case where it had
|
||||
// no stub to attach.
|
||||
if (fallbackStub->state().hasFailures()) {
|
||||
[[maybe_unused]] unsigned line;
|
||||
[[maybe_unused]] JS::LimitedColumnNumberZeroOrigin column;
|
||||
[[maybe_unused]] unsigned line, column;
|
||||
LineNumberAndColumn(script_, loc, &line, &column);
|
||||
|
||||
JitSpew(JitSpew_WarpTranspiler, "Failed to attach for JSOp::%s @ %s:%u:%u",
|
||||
CodeName(loc.getOp()), script_->filename(), line,
|
||||
column.zeroOriginValue());
|
||||
CodeName(loc.getOp()), script_->filename(), line, column);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@ -840,14 +835,12 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
}
|
||||
}
|
||||
|
||||
[[maybe_unused]] unsigned line;
|
||||
[[maybe_unused]] JS::LimitedColumnNumberZeroOrigin column;
|
||||
[[maybe_unused]] unsigned line, column;
|
||||
LineNumberAndColumn(script_, loc, &line, &column);
|
||||
|
||||
JitSpew(JitSpew_WarpTranspiler,
|
||||
"multiple active stubs for JSOp::%s @ %s:%u:%u",
|
||||
CodeName(loc.getOp()), script_->filename(), line,
|
||||
column.zeroOriginValue());
|
||||
CodeName(loc.getOp()), script_->filename(), line, column);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@ -862,8 +855,7 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
reader.skip(opInfo.argLength);
|
||||
|
||||
if (!opInfo.transpile) {
|
||||
[[maybe_unused]] unsigned line;
|
||||
[[maybe_unused]] JS::LimitedColumnNumberZeroOrigin column;
|
||||
[[maybe_unused]] unsigned line, column;
|
||||
LineNumberAndColumn(script_, loc, &line, &column);
|
||||
|
||||
MOZ_ASSERT(
|
||||
@ -874,7 +866,7 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
|
||||
JitSpew(JitSpew_WarpTranspiler,
|
||||
"unsupported CacheIR opcode %s for JSOp::%s @ %s:%u:%u",
|
||||
CacheIROpNames[size_t(op)], CodeName(loc.getOp()),
|
||||
script_->filename(), line, column.zeroOriginValue());
|
||||
script_->filename(), line, column);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
@ -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().zeroOriginValue(),
|
||||
script_->lineno(), script_->column(),
|
||||
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().zeroOriginValue());
|
||||
topTree->script()->column());
|
||||
for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++) {
|
||||
dumpNativeToBytecodeEntry(i);
|
||||
}
|
||||
@ -332,12 +332,11 @@ 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().zeroOriginValue());
|
||||
script->column());
|
||||
|
||||
for (tree = tree->caller(); tree; tree = tree->caller()) {
|
||||
JitSpewCont(JitSpew_Profiling, " <= %s:%u:%u", tree->script()->filename(),
|
||||
tree->script()->lineno(),
|
||||
tree->script()->column().zeroOriginValue());
|
||||
tree->script()->lineno(), tree->script()->column());
|
||||
}
|
||||
JitSpewCont(JitSpew_Profiling, ")");
|
||||
JitSpewFin(JitSpew_Profiling);
|
||||
|
@ -98,7 +98,7 @@ bool testCompile() {
|
||||
const js::CompileError& error = fc->maybeError().ref();
|
||||
CHECK(JSEXN_SYNTAXERR == error.exnType);
|
||||
CHECK(error.lineno == 1);
|
||||
CHECK(error.column.oneOriginValue() == 10);
|
||||
CHECK(error.column == 10);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -199,7 +199,7 @@ bool testCompileModule() {
|
||||
const js::CompileError& error = fc->maybeError().ref();
|
||||
CHECK(JSEXN_SYNTAXERR == error.exnType);
|
||||
CHECK(error.lineno == 1);
|
||||
CHECK(error.column.oneOriginValue() == 10);
|
||||
CHECK(error.column == 10);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -26,7 +26,7 @@ BEGIN_TEST(testErrorCopying_columnCopied) {
|
||||
JS::ErrorReportBuilder report(cx);
|
||||
CHECK(report.init(cx, exnStack, JS::ErrorReportBuilder::WithSideEffects));
|
||||
|
||||
CHECK_EQUAL(report.report()->column.oneOriginValue(), 28u);
|
||||
CHECK_EQUAL(report.report()->column, 28u);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "js/CallAndConstruct.h" // JS_CallFunctionValue
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/PropertyAndElement.h" // JS_GetProperty
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
@ -74,17 +73,15 @@ BEGIN_TEST(testException_createErrorWithCause) {
|
||||
JS::Rooted<mozilla::Maybe<JS::Value>> cause(
|
||||
cx, mozilla::Some(JS::Int32Value(-1)));
|
||||
JS::RootedValue err(cx);
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1,
|
||||
JS::ColumnNumberOneOrigin(1), nullptr, empty, cause,
|
||||
&err));
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1, 1, nullptr, empty,
|
||||
cause, &err));
|
||||
CHECK(err.isObject());
|
||||
JS::Rooted<mozilla::Maybe<JS::Value>> maybeCause(
|
||||
cx, JS::GetExceptionCause(&err.toObject()));
|
||||
CHECK(maybeCause.isSome());
|
||||
CHECK_SAME(*cause, *maybeCause);
|
||||
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1,
|
||||
JS::ColumnNumberOneOrigin(1), nullptr, empty,
|
||||
CHECK(JS::CreateError(cx, JSEXN_ERR, nullptr, empty, 1, 1, nullptr, empty,
|
||||
JS::NothingHandleValue, &err));
|
||||
CHECK(err.isObject());
|
||||
maybeCause = JS::GetExceptionCause(&err.toObject());
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
|
||||
|
||||
#include "builtin/TestingFunctions.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberOneOrigin, JS::TaggedColumnNumberOneOrigin
|
||||
#include "js/CompilationAndEvaluation.h" // JS::Evaluate
|
||||
#include "js/Exception.h"
|
||||
#include "js/SavedFrameAPI.h"
|
||||
@ -47,10 +46,10 @@ BEGIN_TEST(testSavedStacks_ApiDefaultValues) {
|
||||
CHECK(line == 0);
|
||||
|
||||
// Column
|
||||
JS::TaggedColumnNumberOneOrigin column(JS::LimitedColumnNumberOneOrigin(123));
|
||||
uint32_t column = 123;
|
||||
result = JS::GetSavedFrameColumn(cx, principals, savedFrame, &column);
|
||||
CHECK(result == JS::SavedFrameResult::AccessDenied);
|
||||
CHECK(column == JS::TaggedColumnNumberOneOrigin());
|
||||
CHECK(column == 0);
|
||||
|
||||
// Function display name
|
||||
result =
|
||||
@ -257,11 +256,11 @@ BEGIN_TEST(testSavedStacks_selfHostedFrames) {
|
||||
CHECK_EQUAL(line, 3U);
|
||||
|
||||
// Column
|
||||
JS::TaggedColumnNumberOneOrigin column(JS::LimitedColumnNumberOneOrigin(123));
|
||||
uint32_t column = 123;
|
||||
result = JS::GetSavedFrameColumn(cx, principals, selfHostedFrame, &column,
|
||||
JS::SavedFrameSelfHosted::Exclude);
|
||||
CHECK(result == JS::SavedFrameResult::Ok);
|
||||
CHECK_EQUAL(column.oneOriginValue(), 9U);
|
||||
CHECK_EQUAL(column, 9U);
|
||||
|
||||
// Function display name
|
||||
result = JS::GetSavedFrameFunctionDisplayName(
|
||||
@ -361,12 +360,11 @@ BEGIN_TEST(test_GetPendingExceptionStack) {
|
||||
CHECK_EQUAL(line, expected[i].line);
|
||||
|
||||
// Column
|
||||
JS::TaggedColumnNumberOneOrigin column(
|
||||
JS::LimitedColumnNumberOneOrigin(123));
|
||||
uint32_t column = 123;
|
||||
result = JS::GetSavedFrameColumn(cx, principals, frame, &column,
|
||||
JS::SavedFrameSelfHosted::Exclude);
|
||||
CHECK(result == JS::SavedFrameResult::Ok);
|
||||
CHECK_EQUAL(column.oneOriginValue(), expected[i].column);
|
||||
CHECK_EQUAL(column, expected[i].column);
|
||||
|
||||
// Source
|
||||
JS::RootedString str(cx);
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "jit/JitSpewer.h"
|
||||
#include "js/CallAndConstruct.h" // JS::IsCallable
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberZeroOrigin, JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/CompileOptions.h"
|
||||
#include "js/ContextOptions.h" // JS::ContextOptions{,Ref}
|
||||
#include "js/Conversions.h"
|
||||
@ -2462,7 +2461,7 @@ CompileOptions& CompileOptions::setIntroductionInfoToCaller(
|
||||
MutableHandle<JSScript*> introductionScript) {
|
||||
RootedScript maybeScript(cx);
|
||||
const char* filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno,
|
||||
@ -3933,11 +3932,12 @@ JSErrorNotes::JSErrorNotes() : notes_() {}
|
||||
|
||||
JSErrorNotes::~JSErrorNotes() = default;
|
||||
|
||||
// column is 1-origin.
|
||||
static UniquePtr<JSErrorNotes::Note> CreateErrorNoteVA(
|
||||
FrontendContext* fc, const char* filename, unsigned sourceId,
|
||||
uint32_t lineno, JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef, const unsigned errorNumber,
|
||||
ErrorArgumentsType argumentsType, va_list ap) {
|
||||
unsigned lineno, unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ErrorArgumentsType argumentsType,
|
||||
va_list ap) {
|
||||
auto note = MakeUnique<JSErrorNotes::Note>();
|
||||
if (!note) {
|
||||
ReportOutOfMemory(fc);
|
||||
@ -3959,10 +3959,9 @@ static UniquePtr<JSErrorNotes::Note> CreateErrorNoteVA(
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteVA(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber,
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
ErrorArgumentsType argumentsType, va_list ap) {
|
||||
auto note =
|
||||
CreateErrorNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
@ -3979,10 +3978,10 @@ bool JSErrorNotes::addNoteVA(FrontendContext* fc, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteASCII(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
@ -3993,10 +3992,10 @@ bool JSErrorNotes::addNoteASCII(JSContext* cx, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteASCII(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
@ -4006,10 +4005,10 @@ bool JSErrorNotes::addNoteASCII(FrontendContext* fc, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteLatin1(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
@ -4020,10 +4019,10 @@ bool JSErrorNotes::addNoteLatin1(JSContext* cx, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteLatin1(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber,
|
||||
...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
@ -4033,10 +4032,9 @@ bool JSErrorNotes::addNoteLatin1(FrontendContext* fc, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteUTF8(JSContext* cx, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ...) {
|
||||
AutoReportFrontendContext fc(cx);
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
@ -4047,10 +4045,9 @@ bool JSErrorNotes::addNoteUTF8(JSContext* cx, const char* filename,
|
||||
}
|
||||
|
||||
bool JSErrorNotes::addNoteUTF8(FrontendContext* fc, const char* filename,
|
||||
unsigned sourceId, uint32_t lineno,
|
||||
JS::ColumnNumberOneOrigin column,
|
||||
JSErrorCallback errorCallback, void* userRef,
|
||||
const unsigned errorNumber, ...) {
|
||||
unsigned sourceId, unsigned lineno,
|
||||
unsigned column, JSErrorCallback errorCallback,
|
||||
void* userRef, const unsigned errorNumber, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, errorNumber);
|
||||
bool ok = addNoteVA(fc, filename, sourceId, lineno, column, errorCallback,
|
||||
@ -4524,8 +4521,7 @@ const char* AutoFilename::get() const {
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool DescribeScriptedCaller(JSContext* cx, AutoFilename* filename,
|
||||
uint32_t* lineno,
|
||||
JS::ColumnNumberZeroOrigin* column) {
|
||||
unsigned* lineno, unsigned* column) {
|
||||
if (filename) {
|
||||
filename->reset();
|
||||
}
|
||||
@ -4533,7 +4529,7 @@ JS_PUBLIC_API bool DescribeScriptedCaller(JSContext* cx, AutoFilename* filename,
|
||||
*lineno = 0;
|
||||
}
|
||||
if (column) {
|
||||
*column = JS::ColumnNumberZeroOrigin::zero();
|
||||
*column = 0;
|
||||
}
|
||||
|
||||
if (!cx->compartment()) {
|
||||
@ -4567,15 +4563,9 @@ JS_PUBLIC_API bool DescribeScriptedCaller(JSContext* cx, AutoFilename* filename,
|
||||
}
|
||||
|
||||
if (lineno) {
|
||||
JS::TaggedColumnNumberZeroOrigin columnNumber;
|
||||
*lineno = i.computeLine(&columnNumber);
|
||||
if (column) {
|
||||
*column = JS::ColumnNumberZeroOrigin(columnNumber.zeroOriginValue());
|
||||
}
|
||||
*lineno = i.computeLine(column);
|
||||
} else if (column) {
|
||||
JS::TaggedColumnNumberZeroOrigin columnNumber;
|
||||
i.computeLine(&columnNumber);
|
||||
*column = JS::ColumnNumberZeroOrigin(columnNumber.zeroOriginValue());
|
||||
i.computeLine(column);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -933,8 +933,8 @@ class MOZ_RAII JS_PUBLIC_API AutoFilename {
|
||||
* record, this will also return false.
|
||||
*/
|
||||
extern JS_PUBLIC_API bool DescribeScriptedCaller(
|
||||
JSContext* cx, AutoFilename* filename = nullptr, uint32_t* lineno = nullptr,
|
||||
JS::ColumnNumberZeroOrigin* column = nullptr);
|
||||
JSContext* cx, AutoFilename* filename = nullptr, unsigned* lineno = nullptr,
|
||||
unsigned* column = nullptr);
|
||||
|
||||
extern JS_PUBLIC_API JSObject* GetScriptedCallerGlobal(JSContext* cx);
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::ConstUTF8CharsZ
|
||||
#include "js/Class.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/Conversions.h"
|
||||
#include "js/ErrorReport.h" // JS::PrintError
|
||||
#include "js/Exception.h" // JS::ExceptionStack
|
||||
@ -337,7 +336,7 @@ bool js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
|
||||
|
||||
uint32_t sourceId = reportp->sourceId;
|
||||
uint32_t lineNumber = reportp->lineno;
|
||||
JS::ColumnNumberOneOrigin columnNumber = reportp->column;
|
||||
uint32_t columnNumber = reportp->column;
|
||||
|
||||
// Error reports don't provide a |cause|, so we default to |Nothing| here.
|
||||
auto cause = JS::NothingHandleValue;
|
||||
@ -594,7 +593,7 @@ bool JS::ErrorReportBuilder::init(JSContext* cx,
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.lineno = lineno;
|
||||
ownedReport.exnType = JSEXN_INTERNALERR;
|
||||
ownedReport.column = JS::ColumnNumberOneOrigin(column);
|
||||
ownedReport.column = column;
|
||||
|
||||
if (str) {
|
||||
// Note that using |str| for |message_| here is kind of wrong,
|
||||
@ -675,8 +674,8 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(filename.get());
|
||||
ownedReport.sourceId = frame->getSourceId();
|
||||
ownedReport.lineno = frame->getLine();
|
||||
ownedReport.column =
|
||||
JS::ColumnNumberOneOrigin(frame->getColumn().oneOriginValue());
|
||||
// Follow FixupMaybeWASMColumnForDisplay and set column to 1 for WASM.
|
||||
ownedReport.column = frame->isWasm() ? 1 : frame->getColumn();
|
||||
ownedReport.isMuted = frame->getMutedErrors();
|
||||
} else {
|
||||
// XXXbz this assumes the stack we have right now is still
|
||||
@ -684,11 +683,11 @@ bool JS::ErrorReportBuilder::populateUncaughtExceptionReportUTF8VA(
|
||||
NonBuiltinFrameIter iter(cx, cx->realm()->principals());
|
||||
if (!iter.done()) {
|
||||
ownedReport.filename = JS::ConstUTF8CharsZ(iter.filename());
|
||||
JS::TaggedColumnNumberZeroOrigin column;
|
||||
uint32_t column;
|
||||
ownedReport.sourceId =
|
||||
iter.hasScript() ? iter.script()->scriptSource()->id() : 0;
|
||||
ownedReport.lineno = iter.computeLine(&column);
|
||||
ownedReport.column = JS::ColumnNumberOneOrigin(column.oneOriginValue());
|
||||
ownedReport.column = FixupMaybeWASMColumnForDisplay(column);
|
||||
ownedReport.isMuted = iter.mutedErrors();
|
||||
}
|
||||
}
|
||||
@ -741,7 +740,7 @@ JSObject* js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err) {
|
||||
}
|
||||
uint32_t sourceId = err->sourceId();
|
||||
uint32_t lineNumber = err->lineNumber();
|
||||
JS::ColumnNumberOneOrigin columnNumber = err->columnNumber();
|
||||
uint32_t columnNumber = err->columnNumber();
|
||||
JSExnType errorType = err->type();
|
||||
|
||||
// Create the Error object.
|
||||
@ -752,8 +751,7 @@ JSObject* js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err) {
|
||||
|
||||
JS_PUBLIC_API bool JS::CreateError(JSContext* cx, JSExnType type,
|
||||
HandleObject stack, HandleString fileName,
|
||||
uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber,
|
||||
uint32_t lineNumber, uint32_t columnNumber,
|
||||
JSErrorReport* report, HandleString message,
|
||||
Handle<mozilla::Maybe<Value>> cause,
|
||||
MutableHandleValue rval) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "frontend/FrontendContext.h" // FrontendContext
|
||||
#include "gc/PublicIterators.h"
|
||||
#include "gc/WeakMap.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/experimental/CodeCoverage.h"
|
||||
#include "js/experimental/CTypes.h" // JS::AutoCTypesActivityCallback, JS::SetCTypesActivityCallback
|
||||
#include "js/experimental/Intl.h" // JS::AddMoz{DateTimeFormat,DisplayNames}Constructor
|
||||
@ -479,9 +478,8 @@ void js::SetPreserveWrapperCallbacks(
|
||||
cx->runtime()->hasReleasedWrapperCallback = hasReleasedWrapper;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API unsigned JS_PCToLineNumber(
|
||||
JSScript* script, jsbytecode* pc,
|
||||
JS::LimitedColumnNumberZeroOrigin* columnp) {
|
||||
JS_PUBLIC_API unsigned JS_PCToLineNumber(JSScript* script, jsbytecode* pc,
|
||||
unsigned* columnp) {
|
||||
return PCToLineNumber(script, pc, columnp);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "js/CallArgs.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/GCAPI.h"
|
||||
#include "js/HeapAPI.h"
|
||||
#include "js/Object.h" // JS::GetClass
|
||||
@ -56,9 +55,9 @@ extern JS_PUBLIC_API bool JS_NondeterministicGetWeakSetKeys(
|
||||
JSContext* cx, JS::HandleObject obj, JS::MutableHandleObject ret);
|
||||
|
||||
// Raw JSScript* because this needs to be callable from a signal handler.
|
||||
extern JS_PUBLIC_API unsigned JS_PCToLineNumber(
|
||||
JSScript* script, jsbytecode* pc,
|
||||
JS::LimitedColumnNumberZeroOrigin* columnp = nullptr);
|
||||
extern JS_PUBLIC_API unsigned JS_PCToLineNumber(JSScript* script,
|
||||
jsbytecode* pc,
|
||||
unsigned* columnp = nullptr);
|
||||
|
||||
/**
|
||||
* Determine whether the given object is backed by a DeadObjectProxy.
|
||||
|
@ -132,7 +132,6 @@ EXPORTS.js += [
|
||||
"../public/CallNonGenericMethod.h",
|
||||
"../public/CharacterEncoding.h",
|
||||
"../public/Class.h",
|
||||
"../public/ColumnNumber.h",
|
||||
"../public/ComparisonOperators.h",
|
||||
"../public/CompilationAndEvaluation.h",
|
||||
"../public/CompileOptions.h",
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "js/CallArgs.h" // JS::CallArgs
|
||||
#include "js/CallNonGenericMethod.h" // CallNonGenericMethod
|
||||
#include "js/Class.h" // JSClass, JSCLASS_*
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JS_ReportErrorASCII
|
||||
#include "js/PropertyAndElement.h" // JS_GetProperty
|
||||
#include "js/PropertySpec.h" // JSPropertySpec, JS_PSG, JS_PS_END, JSFunctionSpec, JS_FN, JS_FN_END
|
||||
@ -206,12 +205,6 @@ static Value Uint32OrUndefinedValue(mozilla::Maybe<uint32_t> x) {
|
||||
return Uint32Value(x.value());
|
||||
}
|
||||
|
||||
static Value ColumnNumberZeroOriginValue(JS::ColumnNumberZeroOrigin x) {
|
||||
uint32_t column = x.zeroOriginValue();
|
||||
MOZ_ASSERT(column <= INT32_MAX);
|
||||
return Int32Value(column);
|
||||
}
|
||||
|
||||
static Value StatusValue(ModuleStatus status) {
|
||||
return Int32Value(int32_t(status));
|
||||
}
|
||||
@ -328,8 +321,7 @@ DEFINE_GETTER_FUNCTIONS(ImportEntry, moduleRequest, ObjectOrNullValue,
|
||||
DEFINE_GETTER_FUNCTIONS(ImportEntry, importName, StringOrNullValue, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ImportEntry, localName, StringValue, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ImportEntry, lineNumber, Uint32Value, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ImportEntry, columnNumber, ColumnNumberZeroOriginValue,
|
||||
IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ImportEntry, columnNumber, Uint32Value, IdentFilter)
|
||||
|
||||
static const JSPropertySpec ShellImportEntryWrapper_accessors[] = {
|
||||
JS_PSG("moduleRequest", ShellImportEntryWrapper_moduleRequestGetter, 0),
|
||||
@ -345,8 +337,7 @@ DEFINE_GETTER_FUNCTIONS(ExportEntry, moduleRequest, ObjectOrNullValue,
|
||||
DEFINE_GETTER_FUNCTIONS(ExportEntry, importName, StringOrNullValue, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ExportEntry, localName, StringOrNullValue, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ExportEntry, lineNumber, Uint32Value, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ExportEntry, columnNumber, ColumnNumberZeroOriginValue,
|
||||
IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(ExportEntry, columnNumber, Uint32Value, IdentFilter)
|
||||
|
||||
static const JSPropertySpec ShellExportEntryWrapper_accessors[] = {
|
||||
JS_PSG("exportName", ShellExportEntryWrapper_exportNameGetter, 0),
|
||||
@ -360,8 +351,7 @@ static const JSPropertySpec ShellExportEntryWrapper_accessors[] = {
|
||||
DEFINE_GETTER_FUNCTIONS(RequestedModule, moduleRequest, ObjectOrNullValue,
|
||||
SingleFilter<ShellModuleRequestObjectWrapper>)
|
||||
DEFINE_GETTER_FUNCTIONS(RequestedModule, lineNumber, Uint32Value, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(RequestedModule, columnNumber,
|
||||
ColumnNumberZeroOriginValue, IdentFilter)
|
||||
DEFINE_GETTER_FUNCTIONS(RequestedModule, columnNumber, Uint32Value, IdentFilter)
|
||||
|
||||
static const JSPropertySpec ShellRequestedModuleWrapper_accessors[] = {
|
||||
JS_PSG("moduleRequest", ShellRequestedModuleWrapper_moduleRequestGetter, 0),
|
||||
|
@ -3895,7 +3895,7 @@ static bool CopyErrorReportToObject(JSContext* cx, JSErrorReport* report,
|
||||
return false;
|
||||
}
|
||||
|
||||
RootedValue columnVal(cx, Int32Value(report->column.oneOriginValue()));
|
||||
RootedValue columnVal(cx, Int32Value(report->column));
|
||||
if (!DefineDataProperty(cx, obj, cx->names().columnNumber, columnVal)) {
|
||||
return false;
|
||||
}
|
||||
@ -4144,7 +4144,7 @@ static bool EvalInContext(JSContext* cx, unsigned argc, Value* vp) {
|
||||
}
|
||||
|
||||
JS::AutoFilename filename;
|
||||
uint32_t lineno;
|
||||
unsigned lineno;
|
||||
|
||||
DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
{
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "gc/Tracer.h" // js::TraceChildren
|
||||
#include "gc/WeakMap.h" // js::IterateHeapUnbarriered, js::WeakMapBase
|
||||
#include "js/CallAndConstruct.h" // JS::IsCallable
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/GCAPI.h" // JS::GCReason
|
||||
#include "js/GCVector.h" // JS::RootedVector
|
||||
#include "js/HeapAPI.h" // JS::GCCellPtr, js::gc::IsInsideNursery
|
||||
@ -263,7 +262,7 @@ static bool FormatFrame(JSContext* cx, const FrameIter& iter, Sprinter& sp,
|
||||
JSAutoRealm ar(cx, envChain);
|
||||
|
||||
const char* filename = script->filename();
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
unsigned column = 0;
|
||||
unsigned lineno = PCToLineNumber(script, pc, &column);
|
||||
Rooted<JSFunction*> fun(cx, iter.maybeCallee(cx));
|
||||
Rooted<JSString*> funname(cx);
|
||||
@ -364,8 +363,7 @@ static bool FormatFrame(JSContext* cx, const FrameIter& iter, Sprinter& sp,
|
||||
|
||||
// print filename, line number and column
|
||||
if (!sp.printf("%s [\"%s\":%u:%u]\n", fun ? ")" : "",
|
||||
filename ? filename : "<unknown>", lineno,
|
||||
column.zeroOriginValue())) {
|
||||
filename ? filename : "<unknown>", lineno, column)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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().zeroOriginValue());
|
||||
script->column());
|
||||
|
||||
// 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().zeroOriginValue());
|
||||
json.property("column", script->column());
|
||||
json.endObject();
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "vm/BytecodeUtil.h"
|
||||
|
||||
#include "frontend/SourceNotes.h" // SrcNote, SrcNoteType, SrcNoteIterator
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::ColumnNumberOffset
|
||||
#include "vm/JSScript.h"
|
||||
|
||||
namespace js {
|
||||
@ -163,8 +162,8 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t frontLineNumber() const { return lineno; }
|
||||
JS::LimitedColumnNumberZeroOrigin frontColumnNumber() const { return column; }
|
||||
size_t frontLineNumber() const { return lineno; }
|
||||
size_t frontColumnNumber() const { return column; }
|
||||
|
||||
// Entry points are restricted to bytecode offsets that have an
|
||||
// explicit mention in the line table. This restriction avoids a
|
||||
@ -202,15 +201,17 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
||||
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::ColSpan) {
|
||||
column += SrcNote::ColSpan::getSpan(sn);
|
||||
ptrdiff_t colspan = SrcNote::ColSpan::getSpan(sn);
|
||||
MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
|
||||
column += colspan;
|
||||
lastLinePC = snpc;
|
||||
} else if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, initialLine);
|
||||
column = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
column = 0;
|
||||
lastLinePC = snpc;
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
column = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
column = 0;
|
||||
lastLinePC = snpc;
|
||||
} else if (type == SrcNoteType::Breakpoint) {
|
||||
isBreakpoint = true;
|
||||
@ -225,13 +226,13 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
||||
isEntryPoint = lastLinePC == frontPC();
|
||||
}
|
||||
|
||||
uint32_t initialLine;
|
||||
size_t initialLine;
|
||||
|
||||
// Line number (1-origin).
|
||||
uint32_t lineno;
|
||||
size_t lineno;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
JS::LimitedColumnNumberZeroOrigin column;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
size_t column;
|
||||
|
||||
const SrcNote* sn;
|
||||
jsbytecode* snpc;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "gc/PublicIterators.h"
|
||||
#include "jit/IonScript.h" // IonBlockCounts
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin
|
||||
#include "js/experimental/CodeCoverage.h"
|
||||
#include "js/experimental/PCCountProfiling.h" // JS::{Start,Stop}PCCountProfiling, JS::PurgePCCounts, JS::GetPCCountScript{Count,Summary,Contents}
|
||||
#include "js/friend/DumpFunctions.h" // js::DumpPC, js::DumpScript
|
||||
@ -111,13 +110,11 @@ static bool DecompileArgumentFromStack(JSContext* cx, int formalIndex,
|
||||
|
||||
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
|
||||
const jit::IonBlockCounts& block = ionCounts->block(i);
|
||||
unsigned lineNumber = 0;
|
||||
JS::LimitedColumnNumberZeroOrigin columnNumber;
|
||||
unsigned lineNumber = 0, columnNumber = 0;
|
||||
lineNumber = PCToLineNumber(script, script->offsetToPC(block.offset()),
|
||||
&columnNumber);
|
||||
if (!sp->jsprintf("BB #%" PRIu32 " [%05u,%u,%u]", block.id(),
|
||||
block.offset(), lineNumber,
|
||||
columnNumber.zeroOriginValue())) {
|
||||
block.offset(), lineNumber, columnNumber)) {
|
||||
return false;
|
||||
}
|
||||
if (block.description()) {
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "frontend/FrontendContext.h" // js::AutoReportFrontendContext
|
||||
#include "frontend/Parser.h" // frontend::Parser, frontend::ParseGoal
|
||||
#include "js/CharacterEncoding.h" // JS::UTF8Chars, JS::ConstUTF8CharsZ, JS::UTF8CharsToNewTwoByteCharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/experimental/JSStencil.h" // JS::Stencil
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/RootingAPI.h" // JS::Rooted
|
||||
@ -65,7 +64,7 @@ static void ReportSourceTooLongImpl(JS::FrontendContext* fc, ...) {
|
||||
js::ErrorMetadata metadata;
|
||||
metadata.filename = JS::ConstUTF8CharsZ("<unknown>");
|
||||
metadata.lineNumber = 0;
|
||||
metadata.columnNumber = JS::ColumnNumberZeroOrigin::zero();
|
||||
metadata.columnNumber = 0;
|
||||
metadata.lineLength = 0;
|
||||
metadata.tokenOffset = 0;
|
||||
metadata.isMuted = false;
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "vm/ErrorObject.h"
|
||||
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
|
||||
#include "vm/JSAtomState.h"
|
||||
#include "vm/JSContext.h"
|
||||
|
||||
@ -29,10 +27,9 @@ inline uint32_t js::ErrorObject::lineNumber() const {
|
||||
return val.isInt32() ? val.toInt32() : 0;
|
||||
}
|
||||
|
||||
inline JS::ColumnNumberOneOrigin js::ErrorObject::columnNumber() const {
|
||||
inline uint32_t js::ErrorObject::columnNumber() const {
|
||||
Value val = getReservedSlot(COLUMNNUMBER_SLOT);
|
||||
return val.isInt32() ? JS::ColumnNumberOneOrigin(val.toInt32())
|
||||
: JS::ColumnNumberOneOrigin::zero();
|
||||
return val.isInt32() ? val.toInt32() : 0;
|
||||
}
|
||||
|
||||
inline JSObject* js::ErrorObject::stack() const {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "js/CallNonGenericMethod.h"
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/Class.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/Conversions.h"
|
||||
#include "js/ErrorReport.h"
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
@ -259,16 +258,14 @@ static ErrorObject* CreateErrorObject(JSContext* cx, const CallArgs& args,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t lineNumber;
|
||||
JS::ColumnNumberOneOrigin columnNumber;
|
||||
uint32_t lineNumber, columnNumber = 0;
|
||||
if (!hasOptions && args.length() > messageArg + 2) {
|
||||
if (!ToUint32(cx, args[messageArg + 2], &lineNumber)) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
JS::TaggedColumnNumberZeroOrigin tmp;
|
||||
lineNumber = iter.done() ? 0 : iter.computeLine(&tmp);
|
||||
columnNumber = JS::ColumnNumberOneOrigin(tmp.oneOriginValue());
|
||||
lineNumber = iter.done() ? 0 : iter.computeLine(&columnNumber);
|
||||
columnNumber = FixupMaybeWASMColumnForDisplay(columnNumber);
|
||||
}
|
||||
|
||||
RootedObject stack(cx);
|
||||
@ -447,8 +444,7 @@ bool js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj,
|
||||
JSExnType type, UniquePtr<JSErrorReport> errorReport,
|
||||
HandleString fileName, HandleObject stack,
|
||||
uint32_t sourceId, uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber,
|
||||
HandleString message,
|
||||
uint32_t columnNumber, HandleString message,
|
||||
Handle<mozilla::Maybe<JS::Value>> cause) {
|
||||
MOZ_ASSERT(JSEXN_ERR <= type && type < JSEXN_ERROR_LIMIT);
|
||||
AssertObjectIsSavedFrameOrWrapper(cx, stack);
|
||||
@ -504,8 +500,7 @@ bool js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj,
|
||||
obj->setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(report));
|
||||
obj->initReservedSlot(FILENAME_SLOT, StringValue(fileName));
|
||||
obj->initReservedSlot(LINENUMBER_SLOT, Int32Value(lineNumber));
|
||||
obj->initReservedSlot(COLUMNNUMBER_SLOT,
|
||||
Int32Value(columnNumber.oneOriginValue()));
|
||||
obj->initReservedSlot(COLUMNNUMBER_SLOT, Int32Value(columnNumber));
|
||||
if (message) {
|
||||
obj->initReservedSlot(MESSAGE_SLOT, StringValue(message));
|
||||
}
|
||||
@ -527,7 +522,7 @@ bool js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj,
|
||||
ErrorObject* js::ErrorObject::create(JSContext* cx, JSExnType errorType,
|
||||
HandleObject stack, HandleString fileName,
|
||||
uint32_t sourceId, uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber,
|
||||
uint32_t columnNumber,
|
||||
UniquePtr<JSErrorReport> report,
|
||||
HandleString message,
|
||||
Handle<mozilla::Maybe<JS::Value>> cause,
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "NamespaceImports.h"
|
||||
|
||||
#include "js/Class.h"
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/ErrorReport.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/TypeDecls.h"
|
||||
@ -36,7 +35,7 @@ class ErrorObject : public NativeObject {
|
||||
static bool init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
||||
UniquePtr<JSErrorReport> errorReport, HandleString fileName,
|
||||
HandleObject stack, uint32_t sourceId, uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber, HandleString message,
|
||||
uint32_t columnNumber, HandleString message,
|
||||
Handle<mozilla::Maybe<JS::Value>> cause);
|
||||
|
||||
static const ClassSpec classSpecs[JSEXN_ERROR_LIMIT];
|
||||
@ -74,10 +73,10 @@ class ErrorObject : public NativeObject {
|
||||
// info. If |message| is non-null, then the error will have a .message
|
||||
// property with that value; otherwise the error will have no .message
|
||||
// property.
|
||||
// columnNumber is 1-origin.
|
||||
static ErrorObject* create(JSContext* cx, JSExnType type, HandleObject stack,
|
||||
HandleString fileName, uint32_t sourceId,
|
||||
uint32_t lineNumber,
|
||||
JS::ColumnNumberOneOrigin columnNumber,
|
||||
uint32_t lineNumber, uint32_t columnNumber,
|
||||
UniquePtr<JSErrorReport> report,
|
||||
HandleString message,
|
||||
Handle<mozilla::Maybe<JS::Value>> cause,
|
||||
@ -112,8 +111,8 @@ class ErrorObject : public NativeObject {
|
||||
// Line number (1-origin).
|
||||
inline uint32_t lineNumber() const;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
inline JS::ColumnNumberOneOrigin columnNumber() const;
|
||||
// Column number in UTF-16 code units (1-origin).
|
||||
inline uint32_t columnNumber() const;
|
||||
|
||||
inline JSObject* stack() const;
|
||||
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
#include "frontend/FrontendContext.h" // AutoReportFrontendContext
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_vsmprintf
|
||||
#include "js/Warnings.h" // JS::WarningReporter
|
||||
#include "js/ErrorReport.h" // JSErrorBase
|
||||
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
|
||||
#include "js/Printf.h" // JS_vsmprintf
|
||||
#include "js/Warnings.h" // JS::WarningReporter
|
||||
#include "vm/FrameIter.h"
|
||||
#include "vm/GlobalObject.h"
|
||||
#include "vm/JSContext.h"
|
||||
#include "vm/SavedStacks.h" // FixupMaybeWASMColumnForDisplay
|
||||
|
||||
using namespace js;
|
||||
|
||||
@ -68,7 +68,7 @@ bool js::ReportCompileWarning(FrontendContext* fc, ErrorMetadata&& metadata,
|
||||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = JS::ColumnNumberOneOrigin(metadata.columnNumber);
|
||||
err.column = JSErrorBase::fromZeroOriginToOneOrigin(metadata.columnNumber);
|
||||
err.isMuted = metadata.isMuted;
|
||||
|
||||
if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
|
||||
@ -97,7 +97,7 @@ static void ReportCompileErrorImpl(FrontendContext* fc,
|
||||
|
||||
err.filename = JS::ConstUTF8CharsZ(metadata.filename);
|
||||
err.lineno = metadata.lineNumber;
|
||||
err.column = JS::ColumnNumberOneOrigin(metadata.columnNumber);
|
||||
err.column = JSErrorBase::fromZeroOriginToOneOrigin(metadata.columnNumber);
|
||||
err.isMuted = metadata.isMuted;
|
||||
|
||||
if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
|
||||
@ -196,9 +196,9 @@ static void PopulateReportBlame(JSContext* cx, JSErrorReport* report) {
|
||||
if (iter.hasScript()) {
|
||||
report->sourceId = iter.script()->scriptSource()->id();
|
||||
}
|
||||
JS::TaggedColumnNumberZeroOrigin column;
|
||||
uint32_t column;
|
||||
report->lineno = iter.computeLine(&column);
|
||||
report->column = JS::ColumnNumberOneOrigin(column.oneOriginValue());
|
||||
report->column = FixupMaybeWASMColumnForDisplay(column);
|
||||
report->isMuted = iter.mutedErrors();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "jsfriendapi.h" // for ScriptEnvironmentPreparer
|
||||
|
||||
#include "js/CharacterEncoding.h" // JS::ConstUTF8CharsZ
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin
|
||||
#include "js/ErrorReport.h" // for JSErrorNotes, JSErrorReport
|
||||
#include "js/UniquePtr.h" // for UniquePtr
|
||||
#include "js/Utility.h" // for UniqueTwoByteChars
|
||||
@ -42,8 +41,8 @@ struct ErrorMetadata {
|
||||
// Line number (1-origin).
|
||||
uint32_t lineNumber;
|
||||
|
||||
// Column number in UTF-16 code units.
|
||||
JS::ColumnNumberZeroOrigin columnNumber;
|
||||
// Column number in UTF-16 code units (0-origin).
|
||||
uint32_t columnNumber;
|
||||
|
||||
// If the error occurs at a particular location, context surrounding the
|
||||
// location of the error: the line that contained the error, or a small
|
||||
|
@ -16,11 +16,10 @@
|
||||
#include "jit/BaselineFrame.h" // js::jit::BaselineFrame
|
||||
#include "jit/JitFrames.h" // js::jit::EnsureUnwoundJitExitFrame
|
||||
#include "jit/JSJitFrameIter.h" // js::jit::{FrameType,InlineFrameIterator,JSJitFrameIter,MaybeReadFallback,SnapshotIterator}
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/GCAPI.h" // JS::AutoSuppressGCAnalysis
|
||||
#include "js/Principals.h" // JSSubsumesOp
|
||||
#include "js/RootingAPI.h" // JS::Rooted
|
||||
#include "vm/Activation.h" // js::Activation{,Iterator}
|
||||
#include "js/GCAPI.h" // JS::AutoSuppressGCAnalysis
|
||||
#include "js/Principals.h" // JSSubsumesOp
|
||||
#include "js/RootingAPI.h" // JS::Rooted
|
||||
#include "vm/Activation.h" // js::Activation{,Iterator}
|
||||
#include "vm/EnvironmentObject.h" // js::CallObject
|
||||
#include "vm/JitActivation.h" // js::jit::JitActivation
|
||||
#include "vm/JSContext.h" // JSContext
|
||||
@ -619,8 +618,7 @@ const char16_t* FrameIter::displayURL() const {
|
||||
MOZ_CRASH("Unexpected state");
|
||||
}
|
||||
|
||||
unsigned FrameIter::computeLine(
|
||||
JS::TaggedColumnNumberZeroOrigin* column) const {
|
||||
unsigned FrameIter::computeLine(uint32_t* column) const {
|
||||
switch (data_.state_) {
|
||||
case DONE:
|
||||
break;
|
||||
@ -629,12 +627,7 @@ unsigned FrameIter::computeLine(
|
||||
if (isWasm()) {
|
||||
return wasmFrame().computeLine(column);
|
||||
}
|
||||
JS::LimitedColumnNumberZeroOrigin columnNumber;
|
||||
unsigned lineNumber = PCToLineNumber(script(), pc(), &columnNumber);
|
||||
if (column) {
|
||||
*column = JS::TaggedColumnNumberZeroOrigin(columnNumber);
|
||||
}
|
||||
return lineNumber;
|
||||
return PCToLineNumber(script(), pc(), column);
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unexpected state");
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "jit/JSJitFrameIter.h" // js::jit::{InlineFrameIterator,JSJitFrameIter}
|
||||
#include "js/ColumnNumber.h" // JS::TaggedColumnNumberZeroOrigin
|
||||
#include "js/RootingAPI.h" // JS::Handle, JS::Rooted
|
||||
#include "js/TypeDecls.h" // jsbytecode, JSContext, JSAtom, JSFunction, JSObject, JSScript
|
||||
#include "js/Value.h" // JS::Value
|
||||
@ -284,8 +283,7 @@ class FrameIter {
|
||||
ScriptSource* scriptSource() const;
|
||||
const char* filename() const;
|
||||
const char16_t* displayURL() const;
|
||||
unsigned computeLine(
|
||||
JS::TaggedColumnNumberZeroOrigin* column = nullptr) const;
|
||||
unsigned computeLine(uint32_t* column = nullptr) const;
|
||||
JSAtom* maybeFunctionDisplayAtom() const;
|
||||
bool mutedErrors() const;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user