--- a/js/public/ProfilingFrameIterator.h
+++ b/js/public/ProfilingFrameIterator.h
@@ -46,24 +46,24 @@ class JS_PUBLIC_API(ProfilingFrameIterat
// When moving past a JitActivation, we need to save the prevJitTop
// from it to use as the exit-frame pointer when the next caller jit
// activation (if any) comes around.
void* savedPrevJitTop_;
static const unsigned StorageSpace = 8 * sizeof(void*);
mozilla::AlignedStorage<StorageSpace> storage_;
- js::wasm::ProfilingFrameIterator& asmJSIter() {
+ js::wasm::ProfilingFrameIterator& wasmIter() {
MOZ_ASSERT(!done());
- MOZ_ASSERT(isAsmJS());
+ MOZ_ASSERT(isWasm());
return *reinterpret_cast<js::wasm::ProfilingFrameIterator*>(storage_.addr());
}
- const js::wasm::ProfilingFrameIterator& asmJSIter() const {
+ const js::wasm::ProfilingFrameIterator& wasmIter() const {
MOZ_ASSERT(!done());
- MOZ_ASSERT(isAsmJS());
+ MOZ_ASSERT(isWasm());
return *reinterpret_cast<const js::wasm::ProfilingFrameIterator*>(storage_.addr());
}
js::jit::JitProfilingFrameIterator& jitIter() {
MOZ_ASSERT(!done());
MOZ_ASSERT(isJit());
return *reinterpret_cast<js::jit::JitProfilingFrameIterator*>(storage_.addr());
}
@@ -101,29 +101,29 @@ class JS_PUBLIC_API(ProfilingFrameIterat
// - will compare greater than newer native and psuedo-stack frame addresses
// and less than older native and psuedo-stack frame addresses
void* stackAddress() const;
enum FrameKind
{
Frame_Baseline,
Frame_Ion,
- Frame_AsmJS
+ Frame_Wasm
};
struct Frame
{
FrameKind kind;
void* stackAddress;
void* returnAddress;
void* activation;
const char* label;
};
- bool isAsmJS() const;
+ bool isWasm() const;
bool isJit() const;
uint32_t extractStack(Frame* frames, uint32_t offset, uint32_t end) const;
mozilla::Maybe<Frame> getPhysicalFrameWithoutLabel() const;
private:
mozilla::Maybe<Frame> getPhysicalFrameAndEntry(js::jit::JitcodeGlobalEntry* entry) const;
--- a/js/src/asmjs/AsmJSLink.cpp
+++ b/js/src/asmjs/AsmJSLink.cpp
@@ -698,22 +698,22 @@ CallAsmJS(JSContext* cx, unsigned argc,
// since these can technically pop out anywhere and the full fix may
// actually OOM when trying to allocate the PROT_NONE memory.
if (module.hasDetachedHeap()) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
return false;
}
{
- // Push an AsmJSActivation to describe the asm.js frames we're about to
+ // Push a WasmActivation to describe the asm.js frames we're about to
// push when running this module. Additionally, push a JitActivation so
// that the optimized asm.js-to-Ion FFI call path (which we want to be
// very fast) can avoid doing so. The JitActivation is marked as
// inactive so stack iteration will skip over it.
- AsmJSActivation activation(cx, asmJSModule);
+ WasmActivation activation(cx, module);
JitActivation jitActivation(cx, /* active */ false);
// Call the per-exported-function trampoline created by GenerateEntry.
Module::EntryFuncPtr enter = module.entryTrampoline(func);
if (!CALL_GENERATED_2(enter, coercedArgs.begin(), module.globalData()))
return false;
}
--- a/js/src/asmjs/AsmJSValidate.cpp
+++ b/js/src/asmjs/AsmJSValidate.cpp
@@ -1360,22 +1360,24 @@ class MOZ_STACK_CLASS ModuleValidator
bool finish(SlowFunctionVector* slowFuncs) {
uint32_t endBeforeCurly = tokenStream().currentToken().pos.end;
TokenPos pos;
JS_ALWAYS_TRUE(tokenStream().peekTokenPos(&pos, TokenStream::Operand));
uint32_t endAfterCurly = pos.end;
auto usesHeap = Module::HeapBool(module_->hasArrayView());
auto sharedHeap = Module::SharedBool(module_->isSharedView());
+ auto mutedErrors = Module::MutedBool(parser_.ss->mutedErrors());
UniqueChars filename = make_string_copy(parser_.ss->filename());
if (!filename)
return false;
UniqueStaticLinkData linkData;
- Module* wasm = mg_.finish(usesHeap, sharedHeap, Move(filename), &linkData, slowFuncs);
+ Module* wasm = mg_.finish(usesHeap, sharedHeap, mutedErrors, Move(filename),
+ &linkData, slowFuncs);
if (!wasm)
return false;
module_->finish(wasm, Move(linkData), endBeforeCurly, endAfterCurly);
return true;
}
// Mutable interface.
--- a/js/src/asmjs/WasmFrameIterator.cpp
+++ b/js/src/asmjs/WasmFrameIterator.cpp
@@ -15,17 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "asmjs/WasmFrameIterator.h"
#include "jsatom.h"
-#include "asmjs/AsmJSModule.h"
+#include "asmjs/WasmModule.h"
+
#include "jit/MacroAssembler-inl.h"
using namespace js;
using namespace js::jit;
using namespace js::wasm;
using mozilla::DebugOnly;
using mozilla::Swap;
@@ -40,19 +41,19 @@ ReturnAddressFromFP(void* fp)
}
static uint8_t*
CallerFPFromFP(void* fp)
{
return reinterpret_cast<AsmJSFrame*>(fp)->callerFP;
}
-FrameIterator::FrameIterator(const AsmJSActivation& activation)
+FrameIterator::FrameIterator(const WasmActivation& activation)
: cx_(activation.cx()),
- module_(&activation.module().wasm()),
+ module_(&activation.module()),
fp_(activation.fp())
{
if (!fp_)
return;
settle();
}
void
@@ -177,17 +178,17 @@ PushRetAddr(MacroAssembler& masm)
masm.push(lr);
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
masm.push(ra);
#else
// The x86/x64 call instruction pushes the return address.
#endif
}
-// Generate a prologue that maintains AsmJSActivation::fp as the virtual frame
+// Generate a prologue that maintains WasmActivation::fp as the virtual frame
// pointer so that ProfilingFrameIterator can walk the stack at any pc in
// generated code.
static void
GenerateProfilingPrologue(MacroAssembler& masm, unsigned framePushed, ExitReason reason,
ProfilingOffsets* offsets, Label* maybeEntry = nullptr)
{
#if !defined (JS_CODEGEN_ARM)
Register scratch = ABIArgGenerator::NonArg_VolatileReg;
@@ -211,27 +212,27 @@ GenerateProfilingPrologue(MacroAssembler
offsets->begin = masm.currentOffset();
if (maybeEntry)
masm.bind(maybeEntry);
PushRetAddr(masm);
MOZ_ASSERT_IF(!masm.oom(), PushedRetAddr == masm.currentOffset() - offsets->begin);
- masm.loadAsmJSActivation(scratch);
- masm.push(Address(scratch, AsmJSActivation::offsetOfFP()));
+ masm.loadWasmActivation(scratch);
+ masm.push(Address(scratch, WasmActivation::offsetOfFP()));
MOZ_ASSERT_IF(!masm.oom(), PushedFP == masm.currentOffset() - offsets->begin);
- masm.storePtr(masm.getStackPointer(), Address(scratch, AsmJSActivation::offsetOfFP()));
+ masm.storePtr(masm.getStackPointer(), Address(scratch, WasmActivation::offsetOfFP()));
MOZ_ASSERT_IF(!masm.oom(), StoredFP == masm.currentOffset() - offsets->begin);
}
if (reason != ExitReason::None) {
masm.store32_NoSecondScratch(Imm32(int32_t(reason)),
- Address(scratch, AsmJSActivation::offsetOfExitReason()));
+ Address(scratch, WasmActivation::offsetOfExitReason()));
}
#if defined(JS_CODEGEN_ARM)
masm.setSecondScratchReg(lr);
#endif
if (framePushed)
masm.subFromStackPtr(Imm32(framePushed));
@@ -246,21 +247,21 @@ GenerateProfilingEpilogue(MacroAssembler
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
Register scratch2 = ABIArgGenerator::NonReturn_VolatileReg1;
#endif
if (framePushed)
masm.addToStackPtr(Imm32(framePushed));
- masm.loadAsmJSActivation(scratch);
+ masm.loadWasmActivation(scratch);
if (reason != ExitReason::None) {
masm.store32(Imm32(int32_t(ExitReason::None)),
- Address(scratch, AsmJSActivation::offsetOfExitReason()));
+ Address(scratch, WasmActivation::offsetOfExitReason()));
}
// ProfilingFrameIterator assumes fixed offsets of the last few
// instructions from profilingReturn, so AutoForbidPools to ensure that
// unintended instructions are not automatically inserted.
{
#if defined(JS_CODEGEN_ARM)
AutoForbidPools afp(&masm, /* number of instructions in scope = */ 4);
@@ -268,32 +269,32 @@ GenerateProfilingEpilogue(MacroAssembler
// sp protects the stack from clobber via asynchronous signal handlers
// and the async interrupt exit. Since activation.fp can be read at any
// time and still points to the current frame, be careful to only update
// sp after activation.fp has been repointed to the caller's frame.
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
masm.loadPtr(Address(masm.getStackPointer(), 0), scratch2);
- masm.storePtr(scratch2, Address(scratch, AsmJSActivation::offsetOfFP()));
+ masm.storePtr(scratch2, Address(scratch, WasmActivation::offsetOfFP()));
DebugOnly<uint32_t> prePop = masm.currentOffset();
masm.addToStackPtr(Imm32(sizeof(void *)));
MOZ_ASSERT_IF(!masm.oom(), PostStorePrePopFP == masm.currentOffset() - prePop);
#else
- masm.pop(Address(scratch, AsmJSActivation::offsetOfFP()));
+ masm.pop(Address(scratch, WasmActivation::offsetOfFP()));
MOZ_ASSERT(PostStorePrePopFP == 0);
#endif
offsets->profilingReturn = masm.currentOffset();
masm.ret();
}
}
// In profiling mode, we need to maintain fp so that we can unwind the stack at
-// any pc. In non-profiling mode, the only way to observe AsmJSActivation::fp is
+// any pc. In non-profiling mode, the only way to observe WasmActivation::fp is
// to call out to C++ so, as an optimization, we don't update fp. To avoid
// recompilation when the profiling mode is toggled, we generate both prologues
// a priori and switch between prologues when the profiling mode is toggled.
// Specifically, Module::setProfilingEnabled patches all callsites to
// either call the profiling or non-profiling entry point.
void
wasm::GenerateFunctionPrologue(MacroAssembler& masm, unsigned framePushed, FuncOffsets* offsets)
{
@@ -395,18 +396,18 @@ wasm::GenerateExitEpilogue(MacroAssemble
MOZ_ASSERT(masm.framePushed() == framePushed);
GenerateProfilingEpilogue(masm, framePushed, reason, offsets);
masm.setFramePushed(0);
}
/*****************************************************************************/
// ProfilingFrameIterator
-ProfilingFrameIterator::ProfilingFrameIterator(const AsmJSActivation& activation)
- : module_(&activation.module().wasm()),
+ProfilingFrameIterator::ProfilingFrameIterator(const WasmActivation& activation)
+ : module_(&activation.module()),
codeRange_(nullptr),
callerFP_(nullptr),
callerPC_(nullptr),
stackAddress_(nullptr),
exitReason_(ExitReason::None)
{
// If profiling hasn't been enabled for this module, then CallerFPFromFP
// will be trash, so ignore the entire activation. In practice, this only
@@ -435,17 +436,17 @@ AssertMatchesCallSite(const Module& modu
const CallSite* callsite = module.lookupCallSite(callerPC);
MOZ_ASSERT(callsite);
MOZ_ASSERT(callerFP == (uint8_t*)fp + callsite->stackDepth());
#endif
}
void
-ProfilingFrameIterator::initFromFP(const AsmJSActivation& activation)
+ProfilingFrameIterator::initFromFP(const WasmActivation& activation)
{
uint8_t* fp = activation.fp();
// If a signal was handled while entering an activation, the frame will
// still be null.
if (!fp) {
MOZ_ASSERT(done());
return;
@@ -493,19 +494,19 @@ ProfilingFrameIterator::initFromFP(const
if (exitReason_ == ExitReason::None)
exitReason_ = ExitReason::Native;
MOZ_ASSERT(!done());
}
typedef JS::ProfilingFrameIterator::RegisterState RegisterState;
-ProfilingFrameIterator::ProfilingFrameIterator(const AsmJSActivation& activation,
+ProfilingFrameIterator::ProfilingFrameIterator(const WasmActivation& activation,
const RegisterState& state)
- : module_(&activation.module().wasm()),
+ : module_(&activation.module()),
codeRange_(nullptr),
callerFP_(nullptr),
callerPC_(nullptr),
exitReason_(ExitReason::None)
{
// If profiling hasn't been enabled for this module, then CallerFPFromFP
// will be trash, so ignore the entire activation. In practice, this only
// happens if profiling is enabled while !module->active() (in this case,
@@ -577,26 +578,26 @@ ProfilingFrameIterator::ProfilingFrameIt
// Not in the prologue/epilogue.
callerPC_ = ReturnAddressFromFP(fp);
callerFP_ = CallerFPFromFP(fp);
AssertMatchesCallSite(*module_, codeRange, callerPC_, callerFP_, fp);
}
break;
}
case CodeRange::Entry: {
- // The entry trampoline is the final frame in an AsmJSActivation. The entry
+ // The entry trampoline is the final frame in a WasmActivation. The entry
// trampoline also doesn't GeneratePrologue/Epilogue so we can't use
// the general unwinding logic above.
MOZ_ASSERT(!fp);
callerPC_ = nullptr;
callerFP_ = nullptr;
break;
}
case CodeRange::Inline: {
- // The throw stub clears AsmJSActivation::fp on it's way out.
+ // The throw stub clears WasmActivation::fp on it's way out.
if (!fp) {
MOZ_ASSERT(done());
return;
}
// Most inline code stubs execute after the prologue/epilogue have
// completed so we can simply unwind based on fp. The only exception is
// the async interrupt stub, since it can be executed at any time.
--- a/js/src/asmjs/WasmFrameIterator.h
+++ b/js/src/asmjs/WasmFrameIterator.h
@@ -20,78 +20,78 @@
#define wasm_frame_iterator_h
#include "js/ProfilingFrameIterator.h"
class JSAtom;
namespace js {
-class AsmJSActivation;
+class WasmActivation;
namespace jit { class MacroAssembler; class Label; }
namespace wasm {
class CallSite;
class CodeRange;
class Module;
struct FuncOffsets;
struct ProfilingOffsets;
-// Iterates over the frames of a single AsmJSActivation, called synchronously
+// Iterates over the frames of a single WasmActivation, called synchronously
// from C++ in the thread of the asm.js. The one exception is that this iterator
// may be called from the interrupt callback which may be called asynchronously
// from asm.js code; in this case, the backtrace may not be correct.
class FrameIterator
{
JSContext* cx_;
const Module* module_;
const CallSite* callsite_;
const CodeRange* codeRange_;
uint8_t* fp_;
void settle();
public:
explicit FrameIterator() : fp_(nullptr) { MOZ_ASSERT(done()); }
- explicit FrameIterator(const AsmJSActivation& activation);
+ explicit FrameIterator(const WasmActivation& activation);
void operator++();
bool done() const { return !fp_; }
JSAtom* functionDisplayAtom() const;
unsigned computeLine(uint32_t* column) const;
};
// An ExitReason describes the possible reasons for leaving compiled wasm code
// or the state of not having left compiled wasm code (ExitReason::None).
enum class ExitReason : uint32_t
{
None, // default state, the pc is in wasm code
ImportJit, // fast-path call directly into JIT code
ImportInterp, // slow-path call into C++ Invoke()
Native // implementation-dependent call to native C++ code
};
-// Iterates over the frames of a single AsmJSActivation, given an
+// Iterates over the frames of a single WasmActivation, given an
// asynchrously-interrupted thread's state. If the activation's
// module is not in profiling mode, the activation is skipped.
class ProfilingFrameIterator
{
const Module* module_;
const CodeRange* codeRange_;
uint8_t* callerFP_;
void* callerPC_;
void* stackAddress_;
ExitReason exitReason_;
- void initFromFP(const AsmJSActivation& activation);
+ void initFromFP(const WasmActivation& activation);
public:
ProfilingFrameIterator() : codeRange_(nullptr) {}
- explicit ProfilingFrameIterator(const AsmJSActivation& activation);
- ProfilingFrameIterator(const AsmJSActivation& activation,
+ explicit ProfilingFrameIterator(const WasmActivation& activation);
+ ProfilingFrameIterator(const WasmActivation& activation,
const JS::ProfilingFrameIterator::RegisterState& state);
void operator++();
bool done() const { return !codeRange_; }
void* stackAddress() const { MOZ_ASSERT(!done()); return stackAddress_; }
const char* label() const;
};
--- a/js/src/asmjs/WasmGenerator.cpp
+++ b/js/src/asmjs/WasmGenerator.cpp
@@ -486,16 +486,17 @@ ModuleGenerator::defineOutOfBoundsStub(O
MOZ_ASSERT(finishedFuncs_);
staticLinkData_->pod.outOfBoundsOffset = offsets.begin;
return codeRanges_.emplaceBack(CodeRange::Inline, offsets);
}
Module*
ModuleGenerator::finish(Module::HeapBool usesHeap,
Module::SharedBool sharedHeap,
+ Module::MutedBool mutedErrors,
UniqueChars filename,
UniqueStaticLinkData* staticLinkData,
SlowFunctionVector* slowFuncs)
{
MOZ_ASSERT(!activeFunc_);
MOZ_ASSERT(finishedFuncs_);
if (!GenerateStubs(*this, usesHeap))
@@ -601,16 +602,17 @@ ModuleGenerator::finish(Module::HeapBool
*staticLinkData = Move(staticLinkData_);
*slowFuncs = Move(slowFuncs_);
return cx_->new_<Module>(args_,
funcBytes_,
codeBytes,
globalBytes_,
usesHeap,
sharedHeap,
+ mutedErrors,
Move(code),
Move(imports_),
Move(exports_),
masm_.extractHeapAccesses(),
Move(codeRanges_),
Move(callSites),
Move(funcNames_),
Move(filename));
--- a/js/src/asmjs/WasmGenerator.h
+++ b/js/src/asmjs/WasmGenerator.h
@@ -144,16 +144,17 @@ class MOZ_STACK_CLASS ModuleGenerator
bool defineSyncInterruptStub(ProfilingOffsets offsets);
bool defineAsyncInterruptStub(Offsets offsets);
bool defineOutOfBoundsStub(Offsets offsets);
// Null return indicates failure. The caller must immediately root a
// non-null return value.
Module* finish(Module::HeapBool usesHeap,
Module::SharedBool sharedHeap,
+ Module::MutedBool mutedErrors,
UniqueChars filename,
UniqueStaticLinkData* staticLinkData,
SlowFunctionVector* slowFuncs);
};
// A FunctionGenerator encapsulates the generation of a single function body.
// ModuleGenerator::startFunc must be called after construction and before doing
// anything else. After the body is complete, ModuleGenerator::finishFunc must
--- a/js/src/asmjs/WasmModule.cpp
+++ b/js/src/asmjs/WasmModule.cpp
@@ -608,17 +608,17 @@ Module::ImportExit&
Module::importToExit(const Import& import)
{
return *reinterpret_cast<ImportExit*>(globalData() + import.exitGlobalDataOffset());
}
/* static */ Module::CacheablePod
Module::zeroPod()
{
- CacheablePod pod = {0, 0, 0, false, false, false, false};
+ CacheablePod pod = {0, 0, 0, false, false, false, false, false};
return pod;
}
void
Module::init()
{
staticallyLinked_ = false;
interrupt_ = nullptr;
@@ -665,16 +665,17 @@ Module::Module(const CacheablePod& pod,
// Public constructor for compilation.
Module::Module(CompileArgs args,
uint32_t functionBytes,
uint32_t codeBytes,
uint32_t globalBytes,
HeapBool usesHeap,
SharedBool sharedHeap,
+ MutedBool mutedErrors,
UniqueCodePtr code,
ImportVector&& imports,
ExportVector&& exports,
HeapAccessVector&& heapAccesses,
CodeRangeVector&& codeRanges,
CallSiteVector&& callSites,
CacheableCharsVector&& funcNames,
CacheableChars filename)
@@ -691,16 +692,17 @@ Module::Module(CompileArgs args,
profilingEnabled_(false)
{
// Work around MSVC 2013 bug around {} member initialization.
const_cast<uint32_t&>(pod.functionBytes_) = functionBytes;
const_cast<uint32_t&>(pod.codeBytes_) = codeBytes;
const_cast<uint32_t&>(pod.globalBytes_) = globalBytes;
const_cast<bool&>(pod.usesHeap_) = bool(usesHeap);
const_cast<bool&>(pod.sharedHeap_) = bool(sharedHeap);
+ const_cast<bool&>(pod.mutedErrors_) = bool(mutedErrors);
const_cast<bool&>(pod.usesSignalHandlersForOOB_) = args.useSignalHandlersForOOB;
const_cast<bool&>(pod.usesSignalHandlersForInterrupt_) = args.useSignalHandlersForInterrupt;
MOZ_ASSERT_IF(sharedHeap, usesHeap);
init();
}
Module::~Module()
@@ -1019,21 +1021,21 @@ Module::detachHeap(JSContext* cx)
void
Module::setInterrupted(bool interrupted)
{
MOZ_ASSERT(dynamicallyLinked_);
interrupted_ = interrupted;
}
-AsmJSActivation*&
+WasmActivation*&
Module::activation()
{
MOZ_ASSERT(dynamicallyLinked_);
- return *reinterpret_cast<AsmJSActivation**>(globalData() + ActivationGlobalDataOffset);
+ return *reinterpret_cast<WasmActivation**>(globalData() + ActivationGlobalDataOffset);
}
Module::EntryFuncPtr
Module::entryTrampoline(const Export& func) const
{
MOZ_ASSERT(dynamicallyLinked_);
return JS_DATA_TO_FUNC_PTR(EntryFuncPtr, code() + func.stubOffset());
}
--- a/js/src/asmjs/WasmModule.h
+++ b/js/src/asmjs/WasmModule.h
@@ -20,17 +20,17 @@
#define wasm_module_h
#include "asmjs/WasmTypes.h"
#include "gc/Barrier.h"
#include "vm/MallocProvider.h"
namespace js {
-class AsmJSActivation;
+class WasmActivation;
namespace jit { struct BaselineScript; }
namespace wasm {
// A wasm Module and everything it contains must support serialization,
// deserialization and cloning. Some data can be simply copied as raw bytes and,
// as a convention, is stored in an inline CacheablePod struct. Everything else
// should implement the below methods which are called recusively by the
@@ -367,16 +367,17 @@ class Module
// Initialized when constructed:
struct CacheablePod {
const uint32_t functionBytes_;
const uint32_t codeBytes_;
const uint32_t globalBytes_;
const bool usesHeap_;
const bool sharedHeap_;
+ const bool mutedErrors_;
const bool usesSignalHandlersForOOB_;
const bool usesSignalHandlersForInterrupt_;
} pod;
const UniqueCodePtr code_;
const ImportVector imports_;
const ExportVector exports_;
const HeapAccessVector heapAccesses_;
const CodeRangeVector codeRanges_;
@@ -433,39 +434,42 @@ class Module
template <class> friend struct js::MallocProvider;
public:
static const unsigned SizeOfImportExit = sizeof(ImportExit);
static const unsigned OffsetOfImportExitFun = offsetof(ImportExit, fun);
enum HeapBool { DoesntUseHeap = false, UsesHeap = true };
enum SharedBool { UnsharedHeap = false, SharedHeap = true };
+ enum MutedBool { DontMuteErrors = false, MuteErrors = true };
Module(CompileArgs args,
uint32_t functionBytes,
uint32_t codeBytes,
uint32_t globalBytes,
HeapBool usesHeap,
SharedBool sharedHeap,
+ MutedBool mutedErrors,
UniqueCodePtr code,
ImportVector&& imports,
ExportVector&& exports,
HeapAccessVector&& heapAccesses,
CodeRangeVector&& codeRanges,
CallSiteVector&& callSites,
CacheableCharsVector&& funcNames,
CacheableChars filename);
~Module();
void trace(JSTracer* trc);
uint8_t* code() const { return code_.get(); }
uint8_t* globalData() const { return code() + pod.codeBytes_; }
uint32_t globalBytes() const { return pod.globalBytes_; }
bool usesHeap() const { return pod.usesHeap_; }
bool sharedHeap() const { return pod.sharedHeap_; }
+ bool mutedErrors() const { return pod.mutedErrors_; }
CompileArgs compileArgs() const;
const ImportVector& imports() const { return imports_; }
const ExportVector& exports() const { return exports_; }
const char* functionName(uint32_t i) const { return funcNames_[i].get(); }
const char* filename() const { return filename_.get(); }
bool loadedFromCache() const { return loadedFromCache_; }
bool staticallyLinked() const { return staticallyLinked_; }
bool dynamicallyLinked() const { return dynamicallyLinked_; }
@@ -511,26 +515,26 @@ class Module
bool hasDetachedHeap() const;
bool changeHeap(Handle<ArrayBufferObject*> newBuffer, JSContext* cx);
bool detachHeap(JSContext* cx);
void setInterrupted(bool interrupted);
// The exports of a wasm module are called by preparing an array of
// arguments (coerced to the corresponding types of the Export signature)
// and calling the export's entry trampoline. All such calls must be
- // associated with a containing AsmJSActivation. The innermost
- // AsmJSActivation must be maintained in the Module::activation field.
+ // associated with a containing WasmActivation. The innermost
+ // WasmActivation must be maintained in the Module::activation field.
struct EntryArg {
uint64_t lo;
uint64_t hi;
};
typedef int32_t (*EntryFuncPtr)(EntryArg* args, uint8_t* global);
EntryFuncPtr entryTrampoline(const Export& func) const;
- AsmJSActivation*& activation();
+ WasmActivation*& activation();
// Initially, calls to imports in wasm code call out through the generic
// callImport method. If the imported callee gets JIT compiled and the types
// match up, callImport will patch the code to instead call through a thunk
// directly into the JIT code. If the JIT code is released, the Module must
// be notified so it can go back to the generic callImport.
bool callImport(JSContext* cx, uint32_t importIndex, unsigned argc, const Value* argv,
--- a/js/src/asmjs/WasmSignalHandlers.cpp
+++ b/js/src/asmjs/WasmSignalHandlers.cpp
@@ -16,18 +16,18 @@
* limitations under the License.
*/
#include "asmjs/WasmSignalHandlers.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/PodOperations.h"
-#include "asmjs/AsmJSModule.h"
#include "asmjs/AsmJSValidate.h"
+#include "asmjs/WasmModule.h"
#include "jit/AtomicOperations.h"
#include "jit/Disassembler.h"
#include "vm/Runtime.h"
using namespace js;
using namespace js::jit;
using namespace js::wasm;
@@ -748,21 +748,21 @@ HandleFault(PEXCEPTION_POINTERS exceptio
return false;
// Don't allow recursive handling of signals, see AutoSetHandlingSignal.
JSRuntime* rt = RuntimeForCurrentThread();
if (!rt || rt->handlingSignal)
return false;
AutoSetHandlingSignal handling(rt);
- AsmJSActivation* activation = rt->asmJSActivationStack();
+ WasmActivation* activation = rt->wasmActivationStack();
if (!activation)
return false;
- const Module& module = activation->module().wasm();
+ const Module& module = activation->module();
// These checks aren't necessary, but, since we can, check anyway to make
// sure we aren't covering up a real bug.
uint8_t* faultingAddress = reinterpret_cast<uint8_t*>(record->ExceptionInformation[1]);
if (!module.maybeHeap() ||
faultingAddress < module.maybeHeap() ||
faultingAddress >= module.maybeHeap() + AsmJSMappedSize)
{
@@ -895,21 +895,21 @@ HandleMachException(JSRuntime* rt, const
return false;
uint8_t** ppc = ContextToPC(&context);
uint8_t* pc = *ppc;
if (request.body.exception != EXC_BAD_ACCESS || request.body.codeCnt != 2)
return false;
- AsmJSActivation* activation = rt->asmJSActivationStack();
+ WasmActivation* activation = rt->wasmActivationStack();
if (!activation)
return false;
- const Module& module = activation->module().wasm();
+ const Module& module = activation->module();
if (!module.containsFunctionPC(pc))
return false;
// These checks aren't necessary, but, since we can, check anyway to make
// sure we aren't covering up a real bug.
uint8_t* faultingAddress = reinterpret_cast<uint8_t*>(request.body.code[1]);
if (!module.maybeHeap() ||
faultingAddress < module.maybeHeap() ||
@@ -1105,21 +1105,21 @@ HandleFault(int signum, siginfo_t* info,
uint8_t* pc = *ppc;
// Don't allow recursive handling of signals, see AutoSetHandlingSignal.
JSRuntime* rt = RuntimeForCurrentThread();
if (!rt || rt->handlingSignal)
return false;
AutoSetHandlingSignal handling(rt);
- AsmJSActivation* activation = rt->asmJSActivationStack();
+ WasmActivation* activation = rt->wasmActivationStack();
if (!activation)
return false;
- const Module& module = activation->module().wasm();
+ const Module& module = activation->module();
if (!module.containsFunctionPC(pc))
return false;
// These checks aren't necessary, but, since we can, check anyway to make
// sure we aren't covering up a real bug.
uint8_t* faultingAddress = reinterpret_cast<uint8_t*>(info->si_addr);
if (!module.maybeHeap() ||
faultingAddress < module.maybeHeap() ||
@@ -1181,18 +1181,18 @@ RedirectIonBackedgesToInterruptCheck(JSR
}
}
static bool
RedirectJitCodeToInterruptCheck(JSRuntime* rt, CONTEXT* context)
{
RedirectIonBackedgesToInterruptCheck(rt);
- if (AsmJSActivation* activation = rt->asmJSActivationStack()) {
- const Module& module = activation->module().wasm();
+ if (WasmActivation* activation = rt->wasmActivationStack()) {
+ const Module& module = activation->module();
#ifdef JS_SIMULATOR
if (module.containsFunctionPC(rt->simulator()->get_pc_as<void*>()))
rt->simulator()->set_resume_pc(module.interrupt());
#endif
uint8_t** ppc = ContextToPC(context);
uint8_t* pc = *ppc;
--- a/js/src/asmjs/WasmStubs.cpp
+++ b/js/src/asmjs/WasmStubs.cpp
@@ -147,21 +147,21 @@ GenerateEntry(ModuleGenerator& mg, unsig
masm.loadPtr(Address(masm.getStackPointer(), EntryFrameSize + masm.framePushed()), argv);
#else
masm.movePtr(IntArgReg0, argv);
#endif
masm.Push(argv);
// Save the stack pointer to the saved non-volatile registers. We will use
// this on two paths: normal return and exceptional return. Since
- // loadAsmJSActivation uses GlobalReg, we must do this after loading
+ // loadWasmActivation uses GlobalReg, we must do this after loading
// GlobalReg.
MOZ_ASSERT(masm.framePushed() == FramePushedForEntrySP);
- masm.loadAsmJSActivation(scratch);
- masm.storeStackPtr(Address(scratch, AsmJSActivation::offsetOfEntrySP()));
+ masm.loadWasmActivation(scratch);
+ masm.storeStackPtr(Address(scratch, WasmActivation::offsetOfEntrySP()));
// Dynamically align the stack since ABIStackAlignment is not necessarily
// AsmJSStackAlignment. We'll use entrySP to recover the original stack
// pointer on return.
masm.andToStackPtr(Imm32(~(AsmJSStackAlignment - 1)));
// Bump the stack for the call.
masm.reserveStack(AlignBytes(StackArgBytes(sig.args()), AsmJSStackAlignment));
@@ -236,18 +236,18 @@ GenerateEntry(ModuleGenerator& mg, unsig
// Call into the real function.
masm.assertStackAlignment(AsmJSStackAlignment);
Label target;
target.bind(mg.funcEntryOffsets()[mg.exportFuncIndex(exportIndex)]);
masm.call(CallSiteDesc(CallSiteDesc::Relative), &target);
// Recover the stack pointer value before dynamic alignment.
- masm.loadAsmJSActivation(scratch);
- masm.loadStackPtr(Address(scratch, AsmJSActivation::offsetOfEntrySP()));
+ masm.loadWasmActivation(scratch);
+ masm.loadStackPtr(Address(scratch, WasmActivation::offsetOfEntrySP()));
masm.setFramePushed(FramePushedForEntrySP);
// Recover the 'argv' pointer which was saved before aligning the stack.
masm.Pop(argv);
// Store the return value in argv[0]
switch (sig.ret()) {
case ExprType::Void:
@@ -564,18 +564,18 @@ GenerateJitExitStub(ModuleGenerator& mg,
// act.prevProfilingActivation_ = cx->runtime()->profilingActivation;
// cx->runtime()->profilingActivation_ = act;
// On the ARM store8() uses the secondScratchReg (lr) as a temp.
size_t offsetOfActivation = JSRuntime::offsetOfActivation();
size_t offsetOfJitTop = offsetof(JSRuntime, jitTop);
size_t offsetOfJitJSContext = offsetof(JSRuntime, jitJSContext);
size_t offsetOfJitActivation = offsetof(JSRuntime, jitActivation);
size_t offsetOfProfilingActivation = JSRuntime::offsetOfProfilingActivation();
- masm.loadAsmJSActivation(reg0);
- masm.loadPtr(Address(reg0, AsmJSActivation::offsetOfContext()), reg3);
+ masm.loadWasmActivation(reg0);
+ masm.loadPtr(Address(reg0, WasmActivation::offsetOfContext()), reg3);
masm.loadPtr(Address(reg3, JSContext::offsetOfRuntime()), reg0);
masm.loadPtr(Address(reg0, offsetOfActivation), reg1);
// act.active_ = true;
masm.store8(Imm32(1), Address(reg1, JitActivation::offsetOfActiveUint8()));
// act.prevJitTop_ = cx->runtime()->jitTop;
masm.loadPtr(Address(reg0, offsetOfJitTop), reg2);
@@ -790,25 +790,25 @@ GenerateStackOverflowStub(ModuleGenerato
{
MacroAssembler& masm = mg.masm();
masm.haltingAlign(CodeAlignment);
Offsets offsets;
offsets.begin = masm.currentOffset();
masm.bind(masm.asmStackOverflowLabel());
- // If we reach here via the non-profiling prologue, AsmJSActivation::fp has
+ // If we reach here via the non-profiling prologue, WasmActivation::fp has
// not been updated. To enable stack unwinding from C++, store to it now. If
// we reached here via the profiling prologue, we'll just store the same
// value again. Do not update AsmJSFrame::callerFP as it is not necessary in
// the non-profiling case (there is no return path from this point) and, in
// the profiling case, it is already correct.
Register activation = ABIArgGenerator::NonArgReturnReg0;
- masm.loadAsmJSActivation(activation);
- masm.storePtr(masm.getStackPointer(), Address(activation, AsmJSActivation::offsetOfFP()));
+ masm.loadWasmActivation(activation);
+ masm.storePtr(masm.getStackPointer(), Address(activation, WasmActivation::offsetOfFP()));
// Prepare the stack for calling C++.
if (uint32_t d = StackDecrementForCall(ABIStackAlignment, sizeof(AsmJSFrame), ShadowStackSpace))
masm.subFromStackPtr(Imm32(d));
// No need to restore the stack; the throw stub pops everything.
masm.assertStackAlignment(ABIStackAlignment);
masm.call(SymbolicAddress::ReportOverRecursed);
@@ -911,17 +911,17 @@ static const LiveRegisterSet AllRegsExce
GeneralRegisterSet(Registers::AllMask&
~(uint32_t(1) << Registers::StackPointer)),
FloatRegisterSet(FloatRegisters::AllMask));
// The async interrupt-callback exit is called from arbitrarily-interrupted asm.js
// code. That means we must first save *all* registers and restore *all*
// registers (except the stack pointer) when we resume. The address to resume to
// (assuming that js::HandleExecutionInterrupt doesn't indicate that the
-// execution should be aborted) is stored in AsmJSActivation::resumePC_.
+// execution should be aborted) is stored in WasmActivation::resumePC_.
// Unfortunately, loading this requires a scratch register which we don't have
// after restoring all registers. To hack around this, push the resumePC on the
// stack so that it can be popped directly into PC.
static bool
GenerateAsyncInterruptStub(ModuleGenerator& mg, Module::HeapBool usesHeap, Label* throwLabel)
{
MacroAssembler& masm = mg.masm();
@@ -936,18 +936,18 @@ GenerateAsyncInterruptStub(ModuleGenerat
masm.push(Imm32(0)); // space for resumePC
masm.pushFlags(); // after this we are safe to use sub
masm.setFramePushed(0); // set to zero so we can use masm.framePushed() below
masm.PushRegsInMask(AllRegsExceptSP); // save all GP/FP registers (except SP)
Register scratch = ABIArgGenerator::NonArgReturnReg0;
// Store resumePC into the reserved space.
- masm.loadAsmJSActivation(scratch);
- masm.loadPtr(Address(scratch, AsmJSActivation::offsetOfResumePC()), scratch);
+ masm.loadWasmActivation(scratch);
+ masm.loadPtr(Address(scratch, WasmActivation::offsetOfResumePC()), scratch);
masm.storePtr(scratch, Address(masm.getStackPointer(), masm.framePushed() + sizeof(void*)));
// We know that StackPointer is word-aligned, but not necessarily
// stack-aligned, so we need to align it dynamically.
masm.moveStackPtrTo(ABIArgGenerator::NonVolatileReg);
masm.andToStackPtr(Imm32(~(ABIStackAlignment - 1)));
if (ShadowStackSpace)
masm.subFromStackPtr(Imm32(ShadowStackSpace));
@@ -976,18 +976,18 @@ GenerateAsyncInterruptStub(ModuleGenerat
masm.PushRegsInMask(AllRegsExceptSP);
// Save the stack pointer in a non-volatile register.
masm.moveStackPtrTo(s0);
// Align the stack.
masm.ma_and(StackPointer, StackPointer, Imm32(~(ABIStackAlignment - 1)));
// Store resumePC into the reserved space.
- masm.loadAsmJSActivation(IntArgReg0);
- masm.loadPtr(Address(IntArgReg0, AsmJSActivation::offsetOfResumePC()), IntArgReg1);
+ masm.loadWasmActivation(IntArgReg0);
+ masm.loadPtr(Address(IntArgReg0, WasmActivation::offsetOfResumePC()), IntArgReg1);
masm.storePtr(IntArgReg1, Address(s0, masm.framePushed()));
// MIPS ABI requires rewserving stack for registes $a0 to $a3.
masm.subFromStackPtr(Imm32(4 * sizeof(intptr_t)));
masm.assertStackAlignment(ABIStackAlignment);
masm.call(SymbolicAddress::HandleExecutionInterrupt);
@@ -1016,18 +1016,18 @@ GenerateAsyncInterruptStub(ModuleGenerat
masm.as_mrs(r4);
masm.as_vmrs(r5);
// Save the stack pointer in a non-volatile register.
masm.mov(sp,r6);
// Align the stack.
masm.ma_and(Imm32(~7), sp, sp);
// Store resumePC into the return PC stack slot.
- masm.loadAsmJSActivation(IntArgReg0);
- masm.loadPtr(Address(IntArgReg0, AsmJSActivation::offsetOfResumePC()), IntArgReg1);
+ masm.loadWasmActivation(IntArgReg0);
+ masm.loadPtr(Address(IntArgReg0, WasmActivation::offsetOfResumePC()), IntArgReg1);
masm.storePtr(IntArgReg1, Address(r6, 14 * sizeof(uint32_t*)));
// When this platform supports SIMD extensions, we'll need to push and pop
// high lanes of SIMD registers as well.
// Save all FP registers
JS_STATIC_ASSERT(!SupportsSimd);
masm.PushRegsInMask(LiveRegisterSet(GeneralRegisterSet(0),
@@ -1089,25 +1089,25 @@ GenerateThrowStub(ModuleGenerator& mg, L
{
MacroAssembler& masm = mg.masm();
masm.haltingAlign(CodeAlignment);
Offsets offsets;
offsets.begin = masm.currentOffset();
masm.bind(throwLabel);
- // We are about to pop all frames in this AsmJSActivation. Set fp to null to
+ // We are about to pop all frames in this WasmActivation. Set fp to null to
// maintain the invariant that fp is either null or pointing to a valid
// frame.
Register scratch = ABIArgGenerator::NonArgReturnReg0;
- masm.loadAsmJSActivation(scratch);
- masm.storePtr(ImmWord(0), Address(scratch, AsmJSActivation::offsetOfFP()));
+ masm.loadWasmActivation(scratch);
+ masm.storePtr(ImmWord(0), Address(scratch, WasmActivation::offsetOfFP()));
masm.setFramePushed(FramePushedForEntrySP);
- masm.loadStackPtr(Address(scratch, AsmJSActivation::offsetOfEntrySP()));
+ masm.loadStackPtr(Address(scratch, WasmActivation::offsetOfEntrySP()));
masm.Pop(scratch);
masm.PopRegsInMask(NonVolatileRegs);
MOZ_ASSERT(masm.framePushed() == 0);
masm.mov(ImmWord(0), ReturnReg);
masm.ret();
if (masm.oom())
--- a/js/src/asmjs/WasmTypes.cpp
+++ b/js/src/asmjs/WasmTypes.cpp
@@ -16,17 +16,17 @@
* limitations under the License.
*/
#include "asmjs/WasmTypes.h"
#include "jslibmath.h"
#include "jsmath.h"
-#include "asmjs/AsmJSModule.h"
+#include "asmjs/WasmModule.h"
#include "js/Conversions.h"
#include "vm/Interpreter.h"
#include "vm/Stack-inl.h"
using namespace js;
using namespace js::jit;
using namespace js::wasm;
@@ -44,102 +44,102 @@ extern MOZ_EXPORT int64_t
#endif
namespace js {
namespace wasm {
void
ReportOverRecursed()
{
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
ReportOverRecursed(cx);
}
bool
HandleExecutionInterrupt()
{
- AsmJSActivation* act = JSRuntime::innermostAsmJSActivation();
- act->module().wasm().setInterrupted(true);
+ WasmActivation* act = JSRuntime::innermostWasmActivation();
+ act->module().setInterrupted(true);
bool ret = CheckForInterrupt(act->cx());
- act->module().wasm().setInterrupted(false);
+ act->module().setInterrupted(false);
return ret;
}
} // namespace wasm
} // namespace js
static void
OnDetached()
{
// See hasDetachedHeap comment in LinkAsmJS.
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
}
static void
OnOutOfBounds()
{
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
}
static void
OnImpreciseConversion()
{
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_FAILED_CONVERSION);
}
static int32_t
CoerceInPlace_ToInt32(MutableHandleValue val)
{
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
int32_t i32;
if (!ToInt32(cx, val, &i32))
return false;
val.set(Int32Value(i32));
return true;
}
static int32_t
CoerceInPlace_ToNumber(MutableHandleValue val)
{
- JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
+ JSContext* cx = JSRuntime::innermostWasmActivation()->cx();
double dbl;
if (!ToNumber(cx, val, &dbl))
return false;
val.set(DoubleValue(dbl));
return true;
}
// Use an int32_t return type instead of bool since bool does not have a
// specified width and the caller is assuming a word-sized return.
static int32_t
InvokeImport_Void(int32_t importIndex, int32_t argc, Value* argv)
{
- AsmJSActivation* activation = JSRuntime::innermostAsmJSActivation();
+ WasmActivation* activation = JSRuntime::innermostWasmActivation();
JSContext* cx = activation->cx();
- Module& module = activation->module().wasm();
+ Module& module = activation->module();
RootedValue rval(cx);
return module.callImport(cx, importIndex, argc, argv, &rval);
}
// Use an int32_t return type instead of bool since bool does not have a
// specified width and the caller is assuming a word-sized return.
static int32_t
InvokeImport_I32(int32_t importIndex, int32_t argc, Value* argv)
{
- AsmJSActivation* activation = JSRuntime::innermostAsmJSActivation();
+ WasmActivation* activation = JSRuntime::innermostWasmActivation();
JSContext* cx = activation->cx();
- Module& module = activation->module().wasm();
+ Module& module = activation->module();
RootedValue rval(cx);
if (!module.callImport(cx, importIndex, argc, argv, &rval))
return false;
int32_t i32;
if (!ToInt32(cx, rval, &i32))
return false;
@@ -148,19 +148,19 @@ InvokeImport_I32(int32_t importIndex, in
return true;
}
// Use an int32_t return type instead of bool since bool does not have a
// specified width and the caller is assuming a word-sized return.
static int32_t
InvokeImport_F64(int32_t importIndex, int32_t argc, Value* argv)
{
- AsmJSActivation* activation = JSRuntime::innermostAsmJSActivation();
+ WasmActivation* activation = JSRuntime::innermostWasmActivation();
JSContext* cx = activation->cx();
- Module& module = activation->module().wasm();
+ Module& module = activation->module();
RootedValue rval(cx);
if (!module.callImport(cx, importIndex, argc, argv, &rval))
return false;
double dbl;
if (!ToNumber(cx, rval, &dbl))
return false;
--- a/js/src/builtin/AtomicsObject.cpp
+++ b/js/src/builtin/AtomicsObject.cpp
@@ -48,17 +48,17 @@
#include "builtin/AtomicsObject.h"
#include "mozilla/Atomics.h"
#include "mozilla/FloatingPoint.h"
#include "jsapi.h"
#include "jsfriendapi.h"
-#include "asmjs/AsmJSModule.h"
+#include "asmjs/WasmModule.h"
#include "jit/AtomicOperations.h"
#include "jit/InlinableNatives.h"
#include "js/Class.h"
#include "vm/GlobalObject.h"
#include "vm/Time.h"
#include "vm/TypedArrayObject.h"
#include "jsobjinlines.h"
@@ -518,17 +518,17 @@ js::atomics_isLockFree(JSContext* cx, un
// To test this, either run on eg Raspberry Pi Model 1, or invoke the ARM
// simulator build with ARMHWCAP=vfp set. Do not set any other flags; other
// vfp/neon flags force ARMv7 to be set.
static void
GetCurrentAsmJSHeap(SharedMem<void*>* heap, size_t* length)
{
JSRuntime* rt = js::TlsPerThreadData.get()->runtimeFromMainThread();
- wasm::Module& module = rt->asmJSActivationStack()->module().wasm();
+ wasm::Module& module = rt->wasmActivationStack()->module();
*heap = module.maybeHeap().cast<void*>();
*length = module.heapLength();
}
int32_t
js::atomics_add_asm_callout(int32_t vt, int32_t offset, int32_t value)
{
SharedMem<void*> heap;
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -33,16 +33,17 @@
#include "vm/SavedStacks.h"
#include "vm/Stack.h"
#include "vm/TraceLogging.h"
#include "jscntxtinlines.h"
#include "jsobjinlines.h"
#include "vm/NativeObject-inl.h"
+#include "vm/ScopeObject-inl.h"
using namespace js;
using mozilla::ArrayLength;
using mozilla::Move;
using mozilla::UniquePtr;
// If fuzzingSafe is set, remove functionality that could cause problems with
@@ -1445,17 +1446,17 @@ ReadSPSProfilingStack(JSContext* cx, uns
const char* frameKindStr = nullptr;
switch (frames[inlineFrameNo].kind) {
case JS::ProfilingFrameIterator::Frame_Baseline:
frameKindStr = "baseline";
break;
case JS::ProfilingFrameIterator::Frame_Ion:
frameKindStr = "ion";
break;
- case JS::ProfilingFrameIterator::Frame_AsmJS:
+ case JS::ProfilingFrameIterator::Frame_Wasm:
frameKindStr = "asmjs";
break;
default:
frameKindStr = "unknown";
}
frameKind = NewStringCopyZ<CanGC>(cx, frameKindStr);
if (!frameKind)
return false;
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -633,19 +633,19 @@ TokenStream::reportCompileErrorNumberVA(
// If we have no location information, try to get one from the caller.
bool callerFilename = false;
if (offset != NoOffset && !err.report.filename && cx->isJSContext()) {
NonBuiltinFrameIter iter(cx->asJSContext(),
FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED,
FrameIter::FOLLOW_DEBUGGER_EVAL_PREV_LINK,
cx->compartment()->principals());
- if (!iter.done() && iter.scriptFilename()) {
+ if (!iter.done() && iter.filename()) {
callerFilename = true;
- err.report.filename = iter.scriptFilename();
+ err.report.filename = iter.filename();
err.report.lineno = iter.computeLine(&err.report.column);
}
}
err.argumentsType = (flags & JSREPORT_UC) ? ArgumentsAreUnicode : ArgumentsAreASCII;
if (!ExpandErrorArgumentsVA(cx, GetErrorMessage, nullptr, errorNumber, &err.message,
&err.report, err.argumentsType, args))
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -1740,17 +1740,17 @@ class MacroAssemblerARMCompat : public M
void moveFloat32(FloatRegister src, FloatRegister dest) {
as_vmov(VFPRegister(dest).singleOverlay(), VFPRegister(src).singleOverlay());
}
void branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label* label);
void branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label* label);
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
void loadAsmJSHeapRegisterFromGlobalData() {
loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg);
}
// Instrumentation for entering and leaving the profiler.
void profilerEnterFrame(Register framePtr, Register scratch);
void profilerExitFrame();
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -30,17 +30,16 @@
#include "mozilla/Casting.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Likely.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SizePrintfMacros.h"
-#include "asmjs/AsmJSValidate.h"
#include "jit/arm/Assembler-arm.h"
#include "jit/arm/disasm/Constants-arm.h"
#include "jit/AtomicOperations.h"
#include "vm/Runtime.h"
#include "vm/SharedMem.h"
extern "C" {
@@ -4458,17 +4457,17 @@ Simulator::execute()
single_step_callback_(single_step_callback_arg_, this, (void*)program_counter);
SimInstruction* instr = reinterpret_cast<SimInstruction*>(program_counter);
instructionDecode(instr);
icount_++;
int32_t rpc = resume_pc_;
if (MOZ_UNLIKELY(rpc != 0)) {
// AsmJS signal handler ran and we have to adjust the pc.
- JSRuntime::innermostAsmJSActivation()->setResumePC((void*)get_pc());
+ JSRuntime::innermostWasmActivation()->setResumePC((void*)get_pc());
set_pc(rpc);
resume_pc_ = 0;
}
}
program_counter = get_pc();
}
if (single_stepping_)
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -2906,17 +2906,17 @@ class MacroAssemblerCompat : public vixl
// Emits a simulator directive to pop from its internal stack
// and assert that the value is equal to the current sp.
void simulatorCheckSP() {
#ifdef JS_SIMULATOR_ARM64
svc(vixl::kCheckStackPointer);
#endif
}
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
void loadAsmJSHeapRegisterFromGlobalData() {
loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg);
loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias + 8), HeapLenReg);
}
// Overwrites the payload bits of a dest register containing a Value.
--- a/js/src/jit/arm64/vixl/MozSimulator-vixl.cpp
+++ b/js/src/jit/arm64/vixl/MozSimulator-vixl.cpp
@@ -193,17 +193,17 @@ void Simulator::Destroy(Simulator* sim)
void Simulator::ExecuteInstruction() {
// The program counter should always be aligned.
VIXL_ASSERT(IsWordAligned(pc_));
decoder_->Decode(pc_);
const Instruction* rpc = resume_pc_;
increment_pc();
if (MOZ_UNLIKELY(rpc)) {
- JSRuntime::innermostAsmJSActivation()->setResumePC((void*)pc());
+ JSRuntime::innermostWasmActivation()->setResumePC((void*)pc());
set_pc(rpc);
// Just calling set_pc turns the pc_modified_ flag on, which means it doesn't
// auto-step after executing the next instruction. Force that to off so it
// will auto-step after executing the first instruction of the handler.
pc_modified_ = false;
resume_pc_ = nullptr;
}
}
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -1282,17 +1282,17 @@ class MacroAssemblerMIPSCompat : public
void moveFloat32(FloatRegister src, FloatRegister dest) {
as_movs(dest, src);
}
void branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label* label);
void branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
Label* label);
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
void loadAsmJSHeapRegisterFromGlobalData() {
MOZ_ASSERT(Imm16::IsInSignedRange(wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias));
loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg);
}
// Instrumentation for entering and leaving the profiler.
--- a/js/src/jit/mips32/Simulator-mips32.cpp
+++ b/js/src/jit/mips32/Simulator-mips32.cpp
@@ -3326,17 +3326,17 @@ Simulator::branchDelayInstructionDecode(
template<bool enableStopSimAt>
void
Simulator::execute()
{
// Get the PC to simulate. Cannot use the accessor here as we need the
// raw PC value and not the one used as input to arithmetic instructions.
int program_counter = get_pc();
- AsmJSActivation* activation = TlsPerThreadData.get()->runtimeFromMainThread()->asmJSActivationStack();
+ WasmActivation* activation = TlsPerThreadData.get()->runtimeFromMainThread()->wasmActivationStack();
while (program_counter != end_sim_pc) {
if (enableStopSimAt && (icount_ == Simulator::StopSimAt)) {
MipsDebugger dbg(this);
dbg.debug();
} else {
SimInstruction* instr = reinterpret_cast<SimInstruction*>(program_counter);
instructionDecode(instr);
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -1291,17 +1291,17 @@ class MacroAssemblerMIPS64Compat : publi
void moveFloat32(FloatRegister src, FloatRegister dest) {
as_movs(dest, src);
}
void branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label* label);
void branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp,
Label* label);
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
loadPtr(Address(GlobalReg, wasm::ActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
void loadAsmJSHeapRegisterFromGlobalData() {
MOZ_ASSERT(Imm16::IsInSignedRange(wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias));
loadPtr(Address(GlobalReg, wasm::HeapGlobalDataOffset - AsmJSGlobalRegBias), HeapReg);
}
// Instrumentation for entering and leaving the profiler.
--- a/js/src/jit/mips64/Simulator-mips64.cpp
+++ b/js/src/jit/mips64/Simulator-mips64.cpp
@@ -3691,17 +3691,17 @@ void
Simulator::execute()
{
if (single_stepping_)
single_step_callback_(single_step_callback_arg_, this, nullptr);
// Get the PC to simulate. Cannot use the accessor here as we need the
// raw PC value and not the one used as input to arithmetic instructions.
int64_t program_counter = get_pc();
- AsmJSActivation* activation = TlsPerThreadData.get()->runtimeFromMainThread()->asmJSActivationStack();
+ WasmActivation* activation = TlsPerThreadData.get()->runtimeFromMainThread()->wasmActivationStack();
while (program_counter != end_sim_pc) {
if (enableStopSimAt && (icount_ == Simulator::StopSimAt)) {
MipsDebugger dbg(this);
dbg.debug();
} else {
if (single_stepping_)
single_step_callback_(single_step_callback_arg_, this, (void*)program_counter);
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -416,17 +416,17 @@ class MacroAssemblerNone : public Assemb
void ensureDouble(ValueOperand, FloatRegister, Label*) { MOZ_CRASH(); }
void handleFailureWithHandlerTail(void*) { MOZ_CRASH(); }
void branchPtrInNurseryRange(Condition, Register, Register, Label*) { MOZ_CRASH(); }
void branchValueIsNurseryObject(Condition, ValueOperand, Register, Label*) { MOZ_CRASH(); }
void buildFakeExitFrame(Register, uint32_t*) { MOZ_CRASH(); }
bool buildOOLFakeExitFrame(void*) { MOZ_CRASH(); }
- void loadAsmJSActivation(Register) { MOZ_CRASH(); }
+ void loadWasmActivation(Register) { MOZ_CRASH(); }
void loadAsmJSHeapRegisterFromGlobalData() { MOZ_CRASH(); }
void memIntToValue(Address, Address) { MOZ_CRASH(); }
void setPrinter(Sprinter*) { MOZ_CRASH(); }
Operand ToPayload(Operand base) { MOZ_CRASH(); }
static const Register getStackPointer() { MOZ_CRASH(); }
--- a/js/src/jit/x64/Assembler-x64.h
+++ b/js/src/jit/x64/Assembler-x64.h
@@ -667,17 +667,17 @@ class Assembler : public AssemblerX86Sha
}
CodeOffset storeRipRelativeFloat32x4(FloatRegister dest) {
return CodeOffset(masm.vmovaps_rrip(dest.encoding()).offset());
}
CodeOffset leaRipRelative(Register dest) {
return CodeOffset(masm.leaq_rip(dest.encoding()).offset());
}
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
CodeOffset label = loadRipRelativeInt64(dest);
append(AsmJSGlobalAccess(label, wasm::ActivationGlobalDataOffset));
}
void loadAsmJSHeapRegisterFromGlobalData() {
CodeOffset label = loadRipRelativeInt64(HeapReg);
append(AsmJSGlobalAccess(label, wasm::HeapGlobalDataOffset));
}
--- a/js/src/jit/x86/Assembler-x86.h
+++ b/js/src/jit/x86/Assembler-x86.h
@@ -898,17 +898,17 @@ class Assembler : public AssemblerX86Sha
return CodeOffset(masm.currentOffset());
}
CodeOffset vmovupsWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) {
MOZ_ASSERT(HasSSE2());
masm.vmovups_rm(src.encoding(), dest.addr);
return CodeOffset(masm.currentOffset());
}
- void loadAsmJSActivation(Register dest) {
+ void loadWasmActivation(Register dest) {
CodeOffset label = movlWithPatch(PatchedAbsoluteAddress(), dest);
append(AsmJSGlobalAccess(label, wasm::ActivationGlobalDataOffset));
}
void loadAsmJSHeapRegisterFromGlobalData() {
// x86 doesn't have a pinned heap register.
}
static bool canUseInSingleByteInstruction(Register reg) {
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5896,32 +5896,16 @@ JS_IsIdentifier(JSContext* cx, HandleStr
JS_PUBLIC_API(bool)
JS_IsIdentifier(const char16_t* chars, size_t length)
{
return js::frontend::IsIdentifier(chars, length);
}
namespace JS {
-void
-AutoFilename::reset(void* newScriptSource)
-{
- if (newScriptSource)
- reinterpret_cast<ScriptSource*>(newScriptSource)->incref();
- if (scriptSource_)
- reinterpret_cast<ScriptSource*>(scriptSource_)->decref();
- scriptSource_ = newScriptSource;
-}
-
-const char*
-AutoFilename::get() const
-{
- return scriptSource_ ? reinterpret_cast<ScriptSource*>(scriptSource_)->filename() : nullptr;
-}
-
JS_PUBLIC_API(bool)
DescribeScriptedCaller(JSContext* cx, AutoFilename* filename, unsigned* lineno,
unsigned* column)
{
if (lineno)
*lineno = 0;
if (column)
*column = 0;
@@ -5930,18 +5914,22 @@ DescribeScriptedCaller(JSContext* cx, Au
if (i.done())
return false;
// If the caller is hidden, the embedding wants us to return false here so
// that it can check its own stack (see HideScriptedCaller).
if (i.activation()->scriptedCallerIsHidden())
return false;
- if (filename)
- filename->reset(i.scriptSource());
+ if (filename) {
+ UniqueChars copy = make_string_copy(i.filename());
+ if (!copy)
+ return false;
+ filename->reset(Move(copy));
+ }
if (lineno)
*lineno = i.computeLine(column);
else if (column)
i.computeLine(column);
return true;
}
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -5206,30 +5206,23 @@ extern JS_PUBLIC_API(bool)
JS_IsIdentifier(const char16_t* chars, size_t length);
namespace JS {
/**
* AutoFilename encapsulates a pointer to a C-string and keeps the C-string
* alive for as long as the associated AutoFilename object is alive.
*/
-class MOZ_STACK_CLASS JS_PUBLIC_API(AutoFilename)
+class JS_PUBLIC_API(AutoFilename)
{
- void* scriptSource_;
-
- AutoFilename(const AutoFilename&) = delete;
- void operator=(const AutoFilename&) = delete;
+ js::UniqueChars filename_;
public:
- AutoFilename() : scriptSource_(nullptr) {}
- ~AutoFilename() { reset(nullptr); }
-
- const char* get() const;
-
- void reset(void* newScriptSource);
+ void reset(js::UniqueChars&& filename) { filename_ = mozilla::Move(filename); }
+ const char* get() const { return filename_.get(); }
};
/**
* Return the current filename, line number and column number of the most
* currently running frame. Returns true if a scripted frame was found, false
* otherwise.
*
* If a the embedding has hidden the scripted caller for the topmost activation
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -255,17 +255,17 @@ PopulateReportBlame(JSContext* cx, JSErr
/*
* Walk stack until we find a frame that is associated with a non-builtin
* rather than a builtin frame and which we're allowed to know about.
*/
NonBuiltinFrameIter iter(cx, compartment->principals());
if (iter.done())
return;
- report->filename = iter.scriptFilename();
+ report->filename = iter.filename();
report->lineno = iter.computeLine(&report->column);
// XXX: Make the column 1-based as in other browsers, instead of 0-based
// which is how SpiderMonkey stores it internally. This will be
// unnecessary once bug 1144340 is fixed.
report->column++;
report->isMuted = iter.mutedErrors();
}
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -463,17 +463,17 @@ JSContext::currentScript(jsbytecode** pp
if (!allowCrossCompartment && script->compartment() != compartment()) {
if (ppc)
*ppc = nullptr;
return nullptr;
}
return script;
}
- if (act->isAsmJS())
+ if (act->isWasm())
return nullptr;
MOZ_ASSERT(act->isInterpreter());
js::InterpreterFrame* fp = act->asInterpreter()->current();
MOZ_ASSERT(!fp->runningInJit());
JSScript* script = fp->script();
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -356,17 +356,17 @@ Error(JSContext* cx, unsigned argc, Valu
/* Set the 'fileName' property. */
RootedString fileName(cx);
if (args.length() > 1) {
fileName = ToString<CanGC>(cx, args[1]);
} else {
fileName = cx->runtime()->emptyString;
if (!iter.done()) {
- if (const char* cfilename = iter.scriptFilename())
+ if (const char* cfilename = iter.filename())
fileName = JS_NewStringCopyZ(cx, cfilename);
}
}
if (!fileName)
return false;
/* Set the 'lineNumber' property. */
uint32_t lineNumber, columnNumber = 0;
@@ -931,17 +931,17 @@ ErrorReport::populateUncaughtExceptionRe
new (&ownedReport) JSErrorReport();
ownedReport.flags = JSREPORT_ERROR;
ownedReport.errorNumber = JSMSG_UNCAUGHT_EXCEPTION;
// XXXbz this assumes the stack we have right now is still
// related to our exception object. It would be better if we
// could accept a passed-in stack of some sort instead.
NonBuiltinFrameIter iter(cx, cx->compartment()->principals());
if (!iter.done()) {
- ownedReport.filename = iter.scriptFilename();
+ ownedReport.filename = iter.filename();
ownedReport.lineno = iter.computeLine(&ownedReport.column);
// XXX: Make the column 1-based as in other browsers, instead of 0-based
// which is how SpiderMonkey stores it internally. This will be
// unnecessary once bug 1144340 is fixed.
++ownedReport.column;
ownedReport.isMuted = iter.mutedErrors();
}
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3645,17 +3645,17 @@ js::DumpBacktrace(JSContext* cx)
for (AllFramesIter i(cx); !i.done(); ++i, ++depth) {
const char* filename = JS_GetScriptFilename(i.script());
unsigned line = PCToLineNumber(i.script(), i.pc());
JSScript* script = i.script();
char frameType =
i.isInterp() ? 'i' :
i.isBaseline() ? 'b' :
i.isIon() ? 'I' :
- i.isAsmJS() ? 'A' :
+ i.isWasm() ? 'W' :
'?';
sprinter.printf("#%d %14p %c %s:%d (%p @ %d)\n",
depth, i.rawFramePtr(), frameType, filename, line,
script, script->pcToOffset(i.pc()));
}
fprintf(stdout, "%s", sprinter.string());
#ifdef XP_WIN32
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -3347,17 +3347,17 @@ js::DescribeScriptedCallerForCompilation
maybeScript.set(nullptr);
*file = nullptr;
*linenop = 0;
*pcOffset = 0;
*mutedErrors = false;
return;
}
- *file = iter.scriptFilename();
+ *file = iter.filename();
*linenop = iter.computeLine();
*mutedErrors = iter.mutedErrors();
// These values are only used for introducer fields which are debugging
// information and can be safely left null for asm.js frames.
if (iter.hasScript()) {
maybeScript.set(iter.script());
*pcOffset = iter.pc() - maybeScript->code();
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -131,17 +131,17 @@ JSRuntime::JSRuntime(JSRuntime* parentRu
jitJSContext(nullptr),
jitActivation(nullptr),
jitStackLimit_(0xbad),
jitStackLimitNoInterrupt_(0xbad),
activation_(nullptr),
profilingActivation_(nullptr),
profilerSampleBufferGen_(0),
profilerSampleBufferLapCount_(1),
- asmJSActivationStack_(nullptr),
+ wasmActivationStack_(nullptr),
asyncStackForNewActivations(this),
asyncCauseForNewActivations(this),
asyncCallIsExplicit(false),
entryMonitor(nullptr),
parentRuntime(parentRuntime),
interrupt_(false),
telemetryCallback(nullptr),
handlingSignal(false),
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -81,18 +81,18 @@ ReportOutOfMemory(ExclusiveContext* cx);
extern MOZ_COLD void
ReportAllocationOverflow(ExclusiveContext* maybecx);
extern MOZ_COLD void
ReportOverRecursed(ExclusiveContext* cx);
class Activation;
class ActivationIterator;
-class AsmJSActivation;
class MathCache;
+class WasmActivation;
namespace jit {
class JitRuntime;
class JitActivation;
struct PcScriptCache;
struct AutoFlushICache;
class CompileRuntime;
@@ -650,17 +650,17 @@ struct JSRuntime : public JS::shadow::Ru
// Information about the heap allocated backtrack stack used by RegExp JIT code.
js::irregexp::RegExpStack regexpStack;
private:
friend class js::Activation;
friend class js::ActivationIterator;
friend class js::jit::JitActivation;
- friend class js::AsmJSActivation;
+ friend class js::WasmActivation;
friend class js::jit::CompileRuntime;
#ifdef DEBUG
friend void js::AssertCurrentThreadCanLock(js::RuntimeLock which);
#endif
/*
* Points to the most recent activation running on the thread.
* See Activation comment in vm/Stack.h.
@@ -683,18 +683,18 @@ struct JSRuntime : public JS::shadow::Ru
* at the START of the run. If multiple laps occur, then some entries
* (towards the end) will be written out with the "wrong" generation.
* The lapCount indicates the required fudge factor to use to compare
* entry generations with the sample buffer generation.
*/
mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> profilerSampleBufferGen_;
mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> profilerSampleBufferLapCount_;
- /* See AsmJSActivation comment. */
- js::AsmJSActivation * volatile asmJSActivationStack_;
+ /* See WasmActivation comment. */
+ js::WasmActivation * volatile wasmActivationStack_;
public:
/*
* Youngest frame of a saved stack that will be picked up as an async stack
* by any new Activation, and is nullptr when no async stack should be used.
*
* The JS::AutoSetAsyncStackForNewCalls class can be used to set this.
*
@@ -770,22 +770,22 @@ struct JSRuntime : public JS::shadow::Ru
if (curLapCount >= lapCount)
break;
if (profilerSampleBufferLapCount_.compareExchange(curLapCount, lapCount))
break;
}
}
- js::AsmJSActivation* asmJSActivationStack() const {
- return asmJSActivationStack_;
+ js::WasmActivation* wasmActivationStack() const {
+ return wasmActivationStack_;
}
- static js::AsmJSActivation* innermostAsmJSActivation() {
+ static js::WasmActivation* innermostWasmActivation() {
js::PerThreadData* ptd = js::TlsPerThreadData.get();
- return ptd ? ptd->runtimeFromMainThread()->asmJSActivationStack_ : nullptr;
+ return ptd ? ptd->runtimeFromMainThread()->wasmActivationStack_ : nullptr;
}
js::Activation* activation() const {
return activation_;
}
/*
* If non-null, another runtime guaranteed to outlive this one and whose
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -1336,20 +1336,20 @@ SavedStacks::getLocation(JSContext* cx,
assertSameCompartment(cx, this, iter.compartment());
// When we have a |JSScript| for this frame, use a potentially memoized
// location from our PCLocationMap and copy it into |locationp|. When we do
// not have a |JSScript| for this frame (asm.js frames), we take a slow path
// that doesn't employ memoization, and update |locationp|'s slots directly.
if (!iter.hasScript()) {
- if (const char16_t* displayURL = iter.scriptDisplayURL()) {
+ if (const char16_t* displayURL = iter.displayURL()) {
locationp->source = AtomizeChars(cx, displayURL, js_strlen(displayURL));
} else {
- const char* filename = iter.scriptFilename() ? iter.scriptFilename() : "";
+ const char* filename = iter.filename() ? iter.filename() : "";
locationp->source = Atomize(cx, filename, strlen(filename));
}
if (!locationp->source)
return false;
locationp->line = iter.computeLine(&locationp->column);
// XXX: Make the column 1-based as in other browsers, instead of 0-based
// which is how SpiderMonkey stores it internally. This will be
@@ -1361,17 +1361,17 @@ SavedStacks::getLocation(JSContext* cx,
RootedScript script(cx, iter.script());
jsbytecode* pc = iter.pc();
PCKey key(script, pc);
PCLocationMap::AddPtr p = pcLocationMap.lookupForAdd(key);
if (!p) {
RootedAtom source(cx);
- if (const char16_t* displayURL = iter.scriptDisplayURL()) {
+ if (const char16_t* displayURL = iter.displayURL()) {
source = AtomizeChars(cx, displayURL, js_strlen(displayURL));
} else {
const char* filename = script->filename() ? script->filename() : "";
source = Atomize(cx, filename, strlen(filename));
}
if (!source)
return false;
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -406,17 +406,17 @@ InterpreterStack::popInlineFrame(Interpr
}
template <class Op>
inline void
FrameIter::unaliasedForEachActual(JSContext* cx, Op op)
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP:
interpFrame()->unaliasedForEachActual(op);
return;
case JIT:
if (data_.jitFrames_.isIonJS()) {
jit::MaybeReadFallback recover(cx, activation()->asJit(), &data_.jitFrames_);
ionInlineFrames_.unaliasedForEachActual(cx, op, jit::ReadFrame_Actuals, recover);
@@ -938,18 +938,18 @@ bool
Activation::isProfiling() const
{
if (isInterpreter())
return asInterpreter()->isProfiling();
if (isJit())
return asJit()->isProfiling();
- MOZ_ASSERT(isAsmJS());
- return asAsmJS()->isProfiling();
+ MOZ_ASSERT(isWasm());
+ return asWasm()->isProfiling();
}
Activation*
Activation::mostRecentProfiling()
{
if (isProfiling())
return this;
return prevProfiling_;
@@ -1021,33 +1021,33 @@ InterpreterActivation::resumeGeneratorFr
MOZ_ASSERT(regs_.fp()->script()->compartment() == compartment_);
return true;
}
inline bool
FrameIter::hasCachedSavedFrame() const
{
- if (isAsmJS())
+ if (isWasm())
return false;
if (hasUsableAbstractFramePtr())
return abstractFramePtr().hasCachedSavedFrame();
MOZ_ASSERT(data_.jitFrames_.isIonScripted());
// SavedFrame caching is done at the physical frame granularity (rather than
// for each inlined frame) for ion. Therefore, it is impossible to have a
// cached SavedFrame if this frame is not a physical frame.
return isPhysicalIonFrame() && data_.jitFrames_.current()->hasCachedSavedFrame();
}
inline void
FrameIter::setHasCachedSavedFrame()
{
- MOZ_ASSERT(!isAsmJS());
+ MOZ_ASSERT(!isWasm());
if (hasUsableAbstractFramePtr()) {
abstractFramePtr().setHasCachedSavedFrame();
return;
}
MOZ_ASSERT(isPhysicalIonFrame());
data_.jitFrames_.current()->setHasCachedSavedFrame();
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -5,18 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "vm/Stack-inl.h"
#include "mozilla/PodOperations.h"
#include "jscntxt.h"
-#include "asmjs/AsmJSModule.h"
-#include "asmjs/WasmFrameIterator.h"
+#include "asmjs/WasmModule.h"
#include "gc/Marking.h"
#include "jit/BaselineFrame.h"
#include "jit/JitcodeMap.h"
#include "jit/JitCompartment.h"
#include "js/GCAPI.h"
#include "vm/Debugger.h"
#include "vm/Opcodes.h"
@@ -58,17 +57,17 @@ InterpreterFrame::initExecuteFrame(JSCon
newTarget = evalInFramePrev.newTarget();
flags_ |= FUNCTION;
} else {
flags_ |= GLOBAL;
}
} else {
FrameIter iter(cx);
MOZ_ASSERT(iter.isFunctionFrame() || iter.isGlobalFrame());
- MOZ_ASSERT(!iter.isAsmJS());
+ MOZ_ASSERT(!iter.isWasm());
if (iter.isFunctionFrame()) {
if (newTarget.isNull())
newTarget = iter.newTarget();
callee = iter.callee(cx);
flags_ |= FUNCTION;
} else {
flags_ |= GLOBAL;
}
@@ -602,25 +601,25 @@ FrameIter::settleOnActivation()
continue;
}
nextJitFrame();
data_.state_ = JIT;
return;
}
- if (activation->isAsmJS()) {
- data_.asmJSFrames_ = wasm::FrameIterator(*data_.activations_->asAsmJS());
+ if (activation->isWasm()) {
+ data_.wasmFrames_ = wasm::FrameIterator(*data_.activations_->asWasm());
- if (data_.asmJSFrames_.done()) {
+ if (data_.wasmFrames_.done()) {
++data_.activations_;
continue;
}
- data_.state_ = ASMJS;
+ data_.state_ = WASM;
return;
}
MOZ_ASSERT(activation->isInterpreter());
InterpreterActivation* interpAct = activation->asInterpreter();
data_.interpFrames_ = InterpreterFrameIterator(interpAct);
@@ -649,33 +648,33 @@ FrameIter::Data::Data(JSContext* cx, Sav
contextOption_(contextOption),
debuggerEvalOption_(debuggerEvalOption),
principals_(principals),
pc_(nullptr),
interpFrames_(nullptr),
activations_(cx->runtime()),
jitFrames_(),
ionInlineFrameNo_(0),
- asmJSFrames_()
+ wasmFrames_()
{
}
FrameIter::Data::Data(const FrameIter::Data& other)
: cx_(other.cx_),
savedOption_(other.savedOption_),
contextOption_(other.contextOption_),
debuggerEvalOption_(other.debuggerEvalOption_),
principals_(other.principals_),
state_(other.state_),
pc_(other.pc_),
interpFrames_(other.interpFrames_),
activations_(other.activations_),
jitFrames_(other.jitFrames_),
ionInlineFrameNo_(other.ionInlineFrameNo_),
- asmJSFrames_(other.asmJSFrames_)
+ wasmFrames_(other.wasmFrames_)
{
}
FrameIter::FrameIter(JSContext* cx, SavedOption savedOption)
: data_(cx, savedOption, CURRENT_CONTEXT, FOLLOW_DEBUGGER_EVAL_PREV_LINK, nullptr),
ionInlineFrames_(cx, (js::jit::JitFrameIterator*) nullptr)
{
// settleOnActivation can only GC if principals are given.
@@ -752,22 +751,22 @@ FrameIter::popJitFrame()
nextJitFrame();
return;
}
popActivation();
}
void
-FrameIter::popAsmJSFrame()
+FrameIter::popWasmFrame()
{
- MOZ_ASSERT(data_.state_ == ASMJS);
+ MOZ_ASSERT(data_.state_ == WASM);
- ++data_.asmJSFrames_;
- if (data_.asmJSFrames_.done())
+ ++data_.wasmFrames_;
+ if (data_.wasmFrames_.done())
popActivation();
}
FrameIter&
FrameIter::operator++()
{
switch (data_.state_) {
case DONE:
@@ -800,31 +799,31 @@ FrameIter::operator++()
data_.cx_ = data_.activations_->cx();
break;
}
popInterpreterFrame();
break;
case JIT:
popJitFrame();
break;
- case ASMJS:
- popAsmJSFrame();
+ case WASM:
+ popWasmFrame();
break;
}
return *this;
}
FrameIter::Data*
FrameIter::copyData() const
{
Data* data = data_.cx_->new_<Data>(data_);
if (!data)
return nullptr;
- MOZ_ASSERT(data_.state_ != ASMJS);
+ MOZ_ASSERT(data_.state_ != WASM);
if (data && data_.jitFrames_.isIonScripted())
data->ionInlineFrameNo_ = ionInlineFrames_.frameNo();
// Give the copied Data the cx of the current activation, which may be
// different than the cx that the current FrameIter was constructed
// with. This ensures that when we instantiate another FrameIter with the
// copied data, its cx is still alive.
data->cx_ = activation()->cx();
return data;
@@ -839,17 +838,17 @@ FrameIter::copyDataAsAbstractFramePtr()
return frame;
}
void*
FrameIter::rawFramePtr() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
return nullptr;
case JIT:
return data_.jitFrames_.fp();
case INTERP:
return interpFrame();
}
MOZ_CRASH("Unexpected state");
}
@@ -857,17 +856,17 @@ FrameIter::rawFramePtr() const
JSCompartment*
FrameIter::compartment() const
{
switch (data_.state_) {
case DONE:
break;
case INTERP:
case JIT:
- case ASMJS:
+ case WASM:
return data_.activations_->compartment();
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::isFunctionFrame() const
{
@@ -876,17 +875,17 @@ FrameIter::isFunctionFrame() const
break;
case INTERP:
return interpFrame()->isFunctionFrame();
case JIT:
MOZ_ASSERT(data_.jitFrames_.isScripted());
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.isFunctionFrame();
return ionInlineFrames_.isFunctionFrame();
- case ASMJS:
+ case WASM:
return true;
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::isGlobalFrame() const
{
@@ -895,17 +894,17 @@ FrameIter::isGlobalFrame() const
break;
case INTERP:
return interpFrame()->isGlobalFrame();
case JIT:
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.baselineFrame()->isGlobalFrame();
MOZ_ASSERT(!script()->isForEval());
return !script()->functionNonDelazifying();
- case ASMJS:
+ case WASM:
return false;
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::isEvalFrame() const
{
@@ -914,134 +913,120 @@ FrameIter::isEvalFrame() const
break;
case INTERP:
return interpFrame()->isEvalFrame();
case JIT:
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.baselineFrame()->isEvalFrame();
MOZ_ASSERT(!script()->isForEval());
return false;
- case ASMJS:
+ case WASM:
return false;
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::isNonEvalFunctionFrame() const
{
MOZ_ASSERT(!done());
switch (data_.state_) {
case DONE:
break;
case INTERP:
return interpFrame()->isNonEvalFunctionFrame();
case JIT:
return !isEvalFrame() && isFunctionFrame();
- case ASMJS:
+ case WASM:
return true;
}
MOZ_CRASH("Unexpected state");
}
JSAtom*
FrameIter::functionDisplayAtom() const
{
MOZ_ASSERT(isNonEvalFunctionFrame());
switch (data_.state_) {
case DONE:
break;
case INTERP:
case JIT:
return calleeTemplate()->displayAtom();
- case ASMJS:
- return data_.asmJSFrames_.functionDisplayAtom();
- }
-
- MOZ_CRASH("Unexpected state");
-}
-
-ScriptSource*
-FrameIter::scriptSource() const
-{
- switch (data_.state_) {
- case DONE:
- break;
- case INTERP:
- case JIT:
- return script()->scriptSource();
- case ASMJS:
- return data_.activations_->asAsmJS()->module().scriptSource();
+ case WASM:
+ return data_.wasmFrames_.functionDisplayAtom();
}
MOZ_CRASH("Unexpected state");
}
const char*
-FrameIter::scriptFilename() const
+FrameIter::filename() const
{
switch (data_.state_) {
case DONE:
break;
case INTERP:
case JIT:
return script()->filename();
- case ASMJS:
- return data_.activations_->asAsmJS()->module().wasm().filename();
+ case WASM:
+ return data_.activations_->asWasm()->module().filename();
}
MOZ_CRASH("Unexpected state");
}
const char16_t*
-FrameIter::scriptDisplayURL() const
+FrameIter::displayURL() const
{
- ScriptSource* ss = scriptSource();
+ if (!hasScript())
+ return nullptr;
+ ScriptSource* ss = script()->scriptSource();
return ss->hasDisplayURL() ? ss->displayURL() : nullptr;
}
unsigned
FrameIter::computeLine(uint32_t* column) const
{
switch (data_.state_) {
case DONE:
break;
case INTERP:
case JIT:
return PCToLineNumber(script(), pc(), column);
- case ASMJS:
- return data_.asmJSFrames_.computeLine(column);
+ case WASM:
+ return data_.wasmFrames_.computeLine(column);
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::mutedErrors() const
{
switch (data_.state_) {
case DONE:
break;
case INTERP:
case JIT:
return script()->mutedErrors();
- case ASMJS:
- return data_.activations_->asAsmJS()->module().scriptSource()->mutedErrors();
+ case WASM:
+ return data_.activations_->asWasm()->module().mutedErrors();
}
MOZ_CRASH("Unexpected state");
}
bool
FrameIter::isConstructing() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isIonScripted())
return ionInlineFrames_.isConstructing();
MOZ_ASSERT(data_.jitFrames_.isBaselineJS());
return data_.jitFrames_.isConstructing();
case INTERP:
return interpFrame()->isConstructing();
@@ -1057,17 +1042,17 @@ FrameIter::ensureHasRematerializedFrame(
return !!activation()->asJit()->getRematerializedFrame(cx, data_.jitFrames_);
}
bool
FrameIter::hasUsableAbstractFramePtr() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
return false;
case JIT:
if (data_.jitFrames_.isBaselineJS())
return true;
MOZ_ASSERT(data_.jitFrames_.isIonScripted());
return !!activation()->asJit()->lookupRematerializedFrame(data_.jitFrames_.fp(),
ionInlineFrames_.frameNo());
@@ -1079,17 +1064,17 @@ FrameIter::hasUsableAbstractFramePtr() c
}
AbstractFramePtr
FrameIter::abstractFramePtr() const
{
MOZ_ASSERT(hasUsableAbstractFramePtr());
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT: {
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.baselineFrame();
MOZ_ASSERT(data_.jitFrames_.isIonScripted());
return activation()->asJit()->lookupRematerializedFrame(data_.jitFrames_.fp(),
ionInlineFrames_.frameNo());
@@ -1102,17 +1087,17 @@ FrameIter::abstractFramePtr() const
MOZ_CRASH("Unexpected state");
}
void
FrameIter::updatePcQuadratic()
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP: {
InterpreterFrame* frame = interpFrame();
InterpreterActivation* activation = data_.activations_->asInterpreter();
// Look for the current frame.
data_.interpFrames_ = InterpreterFrameIterator(activation);
while (data_.interpFrames_.frame() != frame)
@@ -1149,17 +1134,17 @@ FrameIter::updatePcQuadratic()
MOZ_CRASH("Unexpected state");
}
JSFunction*
FrameIter::calleeTemplate() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP:
MOZ_ASSERT(isFunctionFrame());
return &interpFrame()->callee();
case JIT:
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.callee();
MOZ_ASSERT(data_.jitFrames_.isIonScripted());
@@ -1168,17 +1153,17 @@ FrameIter::calleeTemplate() const
MOZ_CRASH("Unexpected state");
}
JSFunction*
FrameIter::callee(JSContext* cx) const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP:
return calleeTemplate();
case JIT:
if (data_.jitFrames_.isIonScripted()) {
jit::MaybeReadFallback recover(cx, activation()->asJit(), &data_.jitFrames_);
return ionInlineFrames_.callee(recover);
}
@@ -1219,17 +1204,17 @@ FrameIter::matchCallee(JSContext* cx, Ha
return callee(cx) == fun;
}
unsigned
FrameIter::numActualArgs() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP:
MOZ_ASSERT(isFunctionFrame());
return interpFrame()->numActualArgs();
case JIT:
if (data_.jitFrames_.isIonScripted())
return ionInlineFrames_.numActualArgs();
@@ -1251,17 +1236,17 @@ FrameIter::unaliasedActual(unsigned i, M
return abstractFramePtr().unaliasedActual(i, checkAliasing);
}
JSObject*
FrameIter::scopeChain(JSContext* cx) const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isIonScripted()) {
jit::MaybeReadFallback recover(cx, activation()->asJit(), &data_.jitFrames_);
return ionInlineFrames_.scopeChain(recover);
}
return data_.jitFrames_.baselineFrame()->scopeChain();
case INTERP:
@@ -1296,17 +1281,17 @@ FrameIter::argsObj() const
Value
FrameIter::thisArgument(JSContext* cx) const
{
MOZ_ASSERT(isNonEvalFunctionFrame());
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isIonScripted()) {
jit::MaybeReadFallback recover(cx, activation()->asJit(), &data_.jitFrames_);
return ionInlineFrames_.thisArgument(recover);
}
return data_.jitFrames_.baselineFrame()->thisArgument();
case INTERP:
@@ -1315,50 +1300,50 @@ FrameIter::thisArgument(JSContext* cx) c
MOZ_CRASH("Unexpected state");
}
Value
FrameIter::newTarget() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case INTERP:
return interpFrame()->newTarget();
case JIT:
MOZ_ASSERT(data_.jitFrames_.isBaselineJS());
return data_.jitFrames_.baselineFrame()->newTarget();
}
MOZ_CRASH("Unexpected state");
}
Value
FrameIter::returnValue() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isBaselineJS())
return data_.jitFrames_.baselineFrame()->returnValue();
break;
case INTERP:
return interpFrame()->returnValue();
}
MOZ_CRASH("Unexpected state");
}
void
FrameIter::setReturnValue(const Value& v)
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isBaselineJS()) {
data_.jitFrames_.baselineFrame()->setReturnValue(v);
return;
}
break;
case INTERP:
@@ -1368,17 +1353,17 @@ FrameIter::setReturnValue(const Value& v
MOZ_CRASH("Unexpected state");
}
size_t
FrameIter::numFrameSlots() const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT: {
if (data_.jitFrames_.isIonScripted()) {
return ionInlineFrames_.snapshotIterator().numAllocations() -
ionInlineFrames_.script()->nfixed();
}
jit::BaselineFrame* frame = data_.jitFrames_.baselineFrame();
return frame->numValueSlots() - data_.jitFrames_.script()->nfixed();
@@ -1390,17 +1375,17 @@ FrameIter::numFrameSlots() const
MOZ_CRASH("Unexpected state");
}
Value
FrameIter::frameSlotValue(size_t index) const
{
switch (data_.state_) {
case DONE:
- case ASMJS:
+ case WASM:
break;
case JIT:
if (data_.jitFrames_.isIonScripted()) {
jit::SnapshotIterator si(ionInlineFrames_.snapshotIterator());
index += ionInlineFrames_.script()->nfixed();
return si.maybeReadAllocByIndex(index);
}
@@ -1733,51 +1718,51 @@ jit::JitActivation::removeIonFrameRecove
void
jit::JitActivation::markIonRecovery(JSTracer* trc)
{
for (RInstructionResults* it = ionRecovery_.begin(); it != ionRecovery_.end(); it++)
it->trace(trc);
}
-AsmJSActivation::AsmJSActivation(JSContext* cx, AsmJSModule& module)
- : Activation(cx, AsmJS),
+WasmActivation::WasmActivation(JSContext* cx, wasm::Module& module)
+ : Activation(cx, Wasm),
module_(module),
entrySP_(nullptr),
resumePC_(nullptr),
fp_(nullptr),
exitReason_(wasm::ExitReason::None)
{
(void) entrySP_; // squelch GCC warning
- prevAsmJSForModule_ = module.wasm().activation();
- module.wasm().activation() = this;
+ prevWasmForModule_ = module.activation();
+ module.activation() = this;
- prevAsmJS_ = cx->runtime()->asmJSActivationStack_;
- cx->runtime()->asmJSActivationStack_ = this;
+ prevWasm_ = cx->runtime()->wasmActivationStack_;
+ cx->runtime()->wasmActivationStack_ = this;
- // Now that the AsmJSActivation is fully initialized, make it visible to
+ // Now that the WasmActivation is fully initialized, make it visible to
// asynchronous profiling.
registerProfiling();
}
-AsmJSActivation::~AsmJSActivation()
+WasmActivation::~WasmActivation()
{
// Hide this activation from the profiler before is is destroyed.
unregisterProfiling();
MOZ_ASSERT(fp_ == nullptr);
- MOZ_ASSERT(module_.wasm().activation() == this);
- module_.wasm().activation() = prevAsmJSForModule_;
+ MOZ_ASSERT(module_.activation() == this);
+ module_.activation() = prevWasmForModule_;
JSContext* cx = cx_->asJSContext();
- MOZ_ASSERT(cx->runtime()->asmJSActivationStack_ == this);
+ MOZ_ASSERT(cx->runtime()->wasmActivationStack_ == this);
- cx->runtime()->asmJSActivationStack_ = prevAsmJS_;
+ cx->runtime()->wasmActivationStack_ = prevWasm_;
}
InterpreterFrameIterator&
InterpreterFrameIterator::operator++()
{
MOZ_ASSERT(!done());
if (fp_ != activation_->entryFrame_) {
pc_ = fp_->prevpc();
@@ -1875,20 +1860,20 @@ JS::ProfilingFrameIterator::~ProfilingFr
iteratorDestroy();
}
}
void
JS::ProfilingFrameIterator::operator++()
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS()) {
- ++asmJSIter();
+ if (activation_->isWasm()) {
+ ++wasmIter();
settle();
return;
}
++jitIter();
settle();
}
@@ -1908,93 +1893,93 @@ JS::ProfilingFrameIterator::settle()
iteratorConstruct();
}
}
void
JS::ProfilingFrameIterator::iteratorConstruct(const RegisterState& state)
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS()) {
- new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asAsmJS(), state);
+ if (activation_->isWasm()) {
+ new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asWasm(), state);
// Set savedPrevJitTop_ to the actual jitTop_ from the runtime.
savedPrevJitTop_ = activation_->cx()->runtime()->jitTop;
return;
}
MOZ_ASSERT(activation_->asJit()->isActive());
new (storage_.addr()) jit::JitProfilingFrameIterator(rt_, state);
}
void
JS::ProfilingFrameIterator::iteratorConstruct()
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS()) {
- new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asAsmJS());
+ if (activation_->isWasm()) {
+ new (storage_.addr()) wasm::ProfilingFrameIterator(*activation_->asWasm());
return;
}
MOZ_ASSERT(activation_->asJit()->isActive());
MOZ_ASSERT(savedPrevJitTop_ != nullptr);
new (storage_.addr()) jit::JitProfilingFrameIterator(savedPrevJitTop_);
}
void
JS::ProfilingFrameIterator::iteratorDestroy()
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS()) {
- asmJSIter().~ProfilingFrameIterator();
+ if (activation_->isWasm()) {
+ wasmIter().~ProfilingFrameIterator();
return;
}
// Save prevjitTop for later use
savedPrevJitTop_ = activation_->asJit()->prevJitTop();
jitIter().~JitProfilingFrameIterator();
}
bool
JS::ProfilingFrameIterator::iteratorDone()
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS())
- return asmJSIter().done();
+ if (activation_->isWasm())
+ return wasmIter().done();
return jitIter().done();
}
void*
JS::ProfilingFrameIterator::stackAddress() const
{
MOZ_ASSERT(!done());
- MOZ_ASSERT(activation_->isAsmJS() || activation_->isJit());
+ MOZ_ASSERT(activation_->isWasm() || activation_->isJit());
- if (activation_->isAsmJS())
- return asmJSIter().stackAddress();
+ if (activation_->isWasm())
+ return wasmIter().stackAddress();
return jitIter().stackAddress();
}
Maybe<JS::ProfilingFrameIterator::Frame>
JS::ProfilingFrameIterator::getPhysicalFrameAndEntry(jit::JitcodeGlobalEntry* entry) const
{
void* stackAddr = stackAddress();
- if (isAsmJS()) {
+ if (isWasm()) {
Frame frame;
- frame.kind = Frame_AsmJS;
+ frame.kind = Frame_Wasm;
frame.stackAddress = stackAddr;
frame.returnAddress = nullptr;
frame.activation = activation_;
frame.label = nullptr;
return mozilla::Some(frame);
}
MOZ_ASSERT(isJit());
@@ -2030,19 +2015,19 @@ JS::ProfilingFrameIterator::extractStack
jit::JitcodeGlobalEntry entry;
Maybe<Frame> physicalFrame = getPhysicalFrameAndEntry(&entry);
// Dummy frames produce no stack frames.
if (physicalFrame.isNothing())
return 0;
- if (isAsmJS()) {
+ if (isWasm()) {
frames[offset] = physicalFrame.value();
- frames[offset].label = asmJSIter().label();
+ frames[offset].label = wasmIter().label();
return 1;
}
// Extract the stack for the entry. Assume maximum inlining depth is <64
const char* labels[64];
uint32_t depth = entry.callStackAtAddr(rt_, jitIter().returnAddressToFp(), labels, 64);
MOZ_ASSERT(depth < 64);
for (uint32_t i = 0; i < depth; i++) {
@@ -2058,19 +2043,19 @@ JS::ProfilingFrameIterator::extractStack
Maybe<JS::ProfilingFrameIterator::Frame>
JS::ProfilingFrameIterator::getPhysicalFrameWithoutLabel() const
{
jit::JitcodeGlobalEntry unused;
return getPhysicalFrameAndEntry(&unused);
}
bool
-JS::ProfilingFrameIterator::isAsmJS() const
+JS::ProfilingFrameIterator::isWasm() const
{
MOZ_ASSERT(!done());
- return activation_->isAsmJS();
+ return activation_->isWasm();
}
bool
JS::ProfilingFrameIterator::isJit() const
{
return activation_->isJit();
}
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -31,17 +31,16 @@ namespace JS {
namespace dbg {
class AutoEntryMonitor;
} // namespace dbg
} // namespace JS
namespace js {
class ArgumentsObject;
-class AsmJSModule;
class InterpreterRegs;
class CallObject;
class FrameIter;
class ScopeObject;
class ScriptFrameIter;
class SPSProfiler;
class InterpreterFrame;
class StaticBlockObject;
@@ -1269,17 +1268,17 @@ static_assert(sizeof(LiveSavedFrameCache
"Every js::Activation has a LiveSavedFrameCache, so we need to be pretty careful "
"about avoiding bloat. If you're adding members to LiveSavedFrameCache, maybe you "
"should consider figuring out a way to make js::Activation have a "
"LiveSavedFrameCache* instead of a Rooted<LiveSavedFrameCache>.");
/*****************************************************************************/
class InterpreterActivation;
-class AsmJSActivation;
+class WasmActivation;
namespace jit {
class JitActivation;
} // namespace jit
// This class is separate from Activation, because it calls JSCompartment::wrap()
// which can GC and walk the stack. It's not safe to do that within the
// JitActivation constructor.
@@ -1339,17 +1338,17 @@ class Activation
// Value of asyncCause to be attached to asyncStack_.
RootedString asyncCause_;
// True if the async call was explicitly requested, e.g. via
// callFunctionWithAsyncStack.
bool asyncCallIsExplicit_;
- enum Kind { Interpreter, Jit, AsmJS };
+ enum Kind { Interpreter, Jit, Wasm };
Kind kind_;
inline Activation(JSContext* cx, Kind kind);
inline ~Activation();
public:
JSContext* cx() const {
return cx_;
@@ -1364,35 +1363,35 @@ class Activation
inline Activation* mostRecentProfiling();
bool isInterpreter() const {
return kind_ == Interpreter;
}
bool isJit() const {
return kind_ == Jit;
}
- bool isAsmJS() const {
- return kind_ == AsmJS;
+ bool isWasm() const {
+ return kind_ == Wasm;
}
inline bool isProfiling() const;
void registerProfiling();
void unregisterProfiling();
InterpreterActivation* asInterpreter() const {
MOZ_ASSERT(isInterpreter());
return (InterpreterActivation*)this;
}
jit::JitActivation* asJit() const {
MOZ_ASSERT(isJit());
return (jit::JitActivation*)this;
}
- AsmJSActivation* asAsmJS() const {
- MOZ_ASSERT(isAsmJS());
- return (AsmJSActivation*)this;
+ WasmActivation* asWasm() const {
+ MOZ_ASSERT(isWasm());
+ return (WasmActivation*)this;
}
void saveFrameChain() {
savedFrameChain_++;
}
void restoreFrameChain() {
MOZ_ASSERT(savedFrameChain_ > 0);
savedFrameChain_--;
@@ -1782,61 +1781,61 @@ class InterpreterFrameIterator
InterpreterFrameIterator& operator++();
bool done() const {
return fp_ == nullptr;
}
};
-// An AsmJSActivation is part of two activation linked lists:
+// A WasmActivation is part of two activation linked lists:
// - the normal Activation list used by FrameIter
-// - a list of only AsmJSActivations that is signal-safe since it is accessed
+// - a list of only WasmActivations that is signal-safe since it is accessed
// from the profiler at arbitrary points
//
-// An eventual goal is to remove AsmJSActivation and to run asm.js code in a
+// An eventual goal is to remove WasmActivation and to run asm code in a
// JitActivation interleaved with Ion/Baseline jit code. This would allow
// efficient calls back and forth but requires that we can walk the stack for
// all kinds of jit code.
-class AsmJSActivation : public Activation
+class WasmActivation : public Activation
{
- AsmJSModule& module_;
- AsmJSActivation* prevAsmJS_;
- AsmJSActivation* prevAsmJSForModule_;
+ wasm::Module& module_;
+ WasmActivation* prevWasm_;
+ WasmActivation* prevWasmForModule_;
void* entrySP_;
void* resumePC_;
uint8_t* fp_;
wasm::ExitReason exitReason_;
public:
- AsmJSActivation(JSContext* cx, AsmJSModule& module);
- ~AsmJSActivation();
+ WasmActivation(JSContext* cx, wasm::Module& module);
+ ~WasmActivation();
- AsmJSModule& module() const { return module_; }
- AsmJSActivation* prevAsmJS() const { return prevAsmJS_; }
+ wasm::Module& module() const { return module_; }
+ WasmActivation* prevWasm() const { return prevWasm_; }
bool isProfiling() const {
return true;
}
// Returns a pointer to the base of the innermost stack frame of asm.js code
// in this activation.
uint8_t* fp() const { return fp_; }
// Returns the reason why asm.js code called out of asm.js code.
wasm::ExitReason exitReason() const { return exitReason_; }
// Read by JIT code:
- static unsigned offsetOfContext() { return offsetof(AsmJSActivation, cx_); }
- static unsigned offsetOfResumePC() { return offsetof(AsmJSActivation, resumePC_); }
+ static unsigned offsetOfContext() { return offsetof(WasmActivation, cx_); }
+ static unsigned offsetOfResumePC() { return offsetof(WasmActivation, resumePC_); }
// Written by JIT code:
- static unsigned offsetOfEntrySP() { return offsetof(AsmJSActivation, entrySP_); }
- static unsigned offsetOfFP() { return offsetof(AsmJSActivation, fp_); }
- static unsigned offsetOfExitReason() { return offsetof(AsmJSActivation, exitReason_); }
+ static unsigned offsetOfEntrySP() { return offsetof(WasmActivation, entrySP_); }
+ static unsigned offsetOfFP() { return offsetof(WasmActivation, fp_); }
+ static unsigned offsetOfExitReason() { return offsetof(WasmActivation, exitReason_); }
// Read/written from SIGSEGV handler:
void setResumePC(void* pc) { resumePC_ = pc; }
void* resumePC() const { return resumePC_; }
};
// A FrameIter walks over the runtime's stack of JS script activations,
// abstracting over whether the JS scripts were running in the interpreter or
@@ -1862,17 +1861,17 @@ class AsmJSActivation : public Activatio
// scripts.
class FrameIter
{
public:
enum SavedOption { STOP_AT_SAVED, GO_THROUGH_SAVED };
enum ContextOption { CURRENT_CONTEXT, ALL_CONTEXTS };
enum DebuggerEvalOption { FOLLOW_DEBUGGER_EVAL_PREV_LINK,
IGNORE_DEBUGGER_EVAL_PREV_LINK };
- enum State { DONE, INTERP, JIT, ASMJS };
+ enum State { DONE, INTERP, JIT, WASM };
// Unlike ScriptFrameIter itself, ScriptFrameIter::Data can be allocated on
// the heap, so this structure should not contain any GC things.
struct Data
{
JSContext * cx_;
SavedOption savedOption_;
ContextOption contextOption_;
@@ -1883,17 +1882,17 @@ class FrameIter
jsbytecode * pc_;
InterpreterFrameIterator interpFrames_;
ActivationIterator activations_;
jit::JitFrameIterator jitFrames_;
unsigned ionInlineFrameNo_;
- wasm::FrameIterator asmJSFrames_;
+ wasm::FrameIterator wasmFrames_;
Data(JSContext* cx, SavedOption savedOption, ContextOption contextOption,
DebuggerEvalOption debuggerEvalOption, JSPrincipals* principals);
Data(const Data& other);
};
MOZ_IMPLICIT FrameIter(JSContext* cx, SavedOption = STOP_AT_SAVED);
FrameIter(JSContext* cx, ContextOption, SavedOption,
@@ -1911,39 +1910,38 @@ class FrameIter
FrameIter& operator++();
JSCompartment* compartment() const;
Activation* activation() const { return data_.activations_.activation(); }
bool isInterp() const { MOZ_ASSERT(!done()); return data_.state_ == INTERP; }
bool isJit() const { MOZ_ASSERT(!done()); return data_.state_ == JIT; }
- bool isAsmJS() const { MOZ_ASSERT(!done()); return data_.state_ == ASMJS; }
+ bool isWasm() const { MOZ_ASSERT(!done()); return data_.state_ == WASM; }
inline bool isIon() const;
inline bool isBaseline() const;
inline bool isPhysicalIonFrame() const;
bool isFunctionFrame() const;
bool isGlobalFrame() const;
bool isEvalFrame() const;
bool isNonEvalFunctionFrame() const;
bool hasArgs() const { return isNonEvalFunctionFrame(); }
// These two methods may not be called with asm frames.
inline bool hasCachedSavedFrame() const;
inline void setHasCachedSavedFrame();
- ScriptSource* scriptSource() const;
- const char* scriptFilename() const;
- const char16_t* scriptDisplayURL() const;
+ const char* filename() const;
+ const char16_t* displayURL() const;
unsigned computeLine(uint32_t* column = nullptr) const;
JSAtom* functionDisplayAtom() const;
bool mutedErrors() const;
- bool hasScript() const { return !isAsmJS(); }
+ bool hasScript() const { return !isWasm(); }
// -----------------------------------------------------------
// The following functions can only be called when hasScript()
// -----------------------------------------------------------
inline JSScript* script() const;
bool isConstructing() const;
@@ -2021,17 +2019,17 @@ class FrameIter
private:
Data data_;
jit::InlineFrameIterator ionInlineFrames_;
void popActivation();
void popInterpreterFrame();
void nextJitFrame();
void popJitFrame();
- void popAsmJSFrame();
+ void popWasmFrame();
void settleOnActivation();
};
class ScriptFrameIter : public FrameIter
{
void settle() {
while (!done() && !hasScript())
FrameIter::operator++();
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -240,19 +240,19 @@ TraceLoggerThread::enable(JSContext* cx)
while (!it.isScripted() && !it.done())
++it;
MOZ_ASSERT(!it.done());
MOZ_ASSERT(it.isIonJS() || it.isBaselineJS());
script = it.script();
engine = it.isIonJS() ? TraceLogger_IonMonkey : TraceLogger_Baseline;
- } else if (act->isAsmJS()) {
+ } else if (act->isWasm()) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TRACELOGGER_ENABLE_FAIL,
- "not yet supported in asmjs code");
+ "not yet supported in wasm code");
return false;
} else {
MOZ_ASSERT(act->isInterpreter());
InterpreterFrame* fp = act->asInterpreter()->current();
MOZ_ASSERT(!fp->runningInJit());
script = fp->script();
engine = TraceLogger_Interpreter;