зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c70c3d933ee8 (bug 1276028) for SM(nu) failures in WasmGenerator.cpp. r=backout
This commit is contained in:
Родитель
8876e244ab
Коммит
7dfaffa147
|
@ -7965,7 +7965,7 @@ static Module&
|
|||
AsmJSModuleFunctionToModule(JSFunction* fun)
|
||||
{
|
||||
MOZ_ASSERT(IsAsmJSModule(fun));
|
||||
const Value& v = fun->getExtendedSlot(FunctionExtended::ASMJS_MODULE_SLOT);
|
||||
const Value& v = fun->getExtendedSlot(FunctionExtended::WASM_MODULE_SLOT);
|
||||
return v.toObject().as<WasmModuleObject>().module();
|
||||
}
|
||||
|
||||
|
@ -8005,7 +8005,7 @@ NewAsmJSModuleFunction(ExclusiveContext* cx, JSFunction* origFun, HandleObject m
|
|||
if (!moduleFun)
|
||||
return nullptr;
|
||||
|
||||
moduleFun->setExtendedSlot(FunctionExtended::ASMJS_MODULE_SLOT, ObjectValue(*moduleObj));
|
||||
moduleFun->setExtendedSlot(FunctionExtended::WASM_MODULE_SLOT, ObjectValue(*moduleObj));
|
||||
|
||||
MOZ_ASSERT(IsAsmJSModule(moduleFun));
|
||||
return moduleFun;
|
||||
|
|
|
@ -812,11 +812,10 @@ wasm::ToggleProfiling(const Instance& instance, const CodeRange& codeRange, bool
|
|||
if (!codeRange.isFunction())
|
||||
return;
|
||||
|
||||
uint8_t* code = instance.codeSegment().code();
|
||||
uint8_t* profilingEntry = code + codeRange.funcProfilingEntry();
|
||||
uint8_t* tableProfilingJump = code + codeRange.funcTableProfilingJump();
|
||||
uint8_t* profilingJump = code + codeRange.funcProfilingJump();
|
||||
uint8_t* profilingEpilogue = code + codeRange.funcProfilingEpilogue();
|
||||
uint8_t* profilingEntry = instance.codeSegment().code() + codeRange.funcProfilingEntry();
|
||||
uint8_t* tableProfilingJump = instance.codeSegment().code() + codeRange.funcTableProfilingJump();
|
||||
uint8_t* profilingJump = instance.codeSegment().code() + codeRange.funcProfilingJump();
|
||||
uint8_t* profilingEpilogue = instance.codeSegment().code() + codeRange.funcProfilingEpilogue();
|
||||
|
||||
if (enabled) {
|
||||
MacroAssembler::patchNopToNearJump(tableProfilingJump, profilingEntry);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "asmjs/WasmGenerator.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
|
||||
#include "asmjs/WasmBaselineCompile.h"
|
||||
|
@ -544,19 +543,14 @@ ModuleGenerator::addImport(const Sig& sig, uint32_t globalDataOffset)
|
|||
bool
|
||||
ModuleGenerator::allocateGlobalBytes(uint32_t bytes, uint32_t align, uint32_t* globalDataOffset)
|
||||
{
|
||||
CheckedInt<uint32_t> newGlobalDataLength(linkData_.globalDataLength);
|
||||
|
||||
newGlobalDataLength += ComputeByteAlignment(newGlobalDataLength.value(), align);
|
||||
if (!newGlobalDataLength.isValid())
|
||||
uint32_t pad = ComputeByteAlignment(linkData_.globalDataLength, align);
|
||||
if (UINT32_MAX - linkData_.globalDataLength < pad + bytes)
|
||||
return false;
|
||||
|
||||
*globalDataOffset = newGlobalDataLength.value();
|
||||
newGlobalDataLength += bytes;
|
||||
linkData_.globalDataLength += pad;
|
||||
*globalDataOffset = linkData_.globalDataLength;
|
||||
linkData_.globalDataLength += bytes;
|
||||
|
||||
if (!newGlobalDataLength.isValid())
|
||||
return false;
|
||||
|
||||
linkData_.globalDataLength = newGlobalDataLength.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,15 +376,15 @@ NewExportedFunction(JSContext* cx, Handle<WasmInstanceObject*> instanceObj, uint
|
|||
if (!fun)
|
||||
return nullptr;
|
||||
|
||||
fun->setExtendedSlot(FunctionExtended::WASM_INSTANCE_SLOT, ObjectValue(*instanceObj));
|
||||
fun->setExtendedSlot(FunctionExtended::WASM_MODULE_SLOT, ObjectValue(*instanceObj));
|
||||
fun->setExtendedSlot(FunctionExtended::WASM_EXPORT_INDEX_SLOT, Int32Value(exportIndex));
|
||||
return fun;
|
||||
}
|
||||
|
||||
static bool
|
||||
CreateExportObject(JSContext* cx,
|
||||
HandleWasmInstanceObject instanceObj,
|
||||
HandleArrayBufferObjectMaybeShared heap,
|
||||
Handle<WasmInstanceObject*> instanceObj,
|
||||
Handle<ArrayBufferObjectMaybeShared*> heap,
|
||||
const ExportMap& exportMap,
|
||||
const ExportVector& exports,
|
||||
MutableHandleObject exportObj)
|
||||
|
@ -887,7 +887,7 @@ Instance&
|
|||
wasm::ExportedFunctionToInstance(JSFunction* fun)
|
||||
{
|
||||
MOZ_ASSERT(IsExportedFunction(fun));
|
||||
const Value& v = fun->getExtendedSlot(FunctionExtended::WASM_INSTANCE_SLOT);
|
||||
const Value& v = fun->getExtendedSlot(FunctionExtended::WASM_MODULE_SLOT);
|
||||
return v.toObject().as<WasmInstanceObject>().instance();
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ const ClassOps WasmModuleObject::classOps_ =
|
|||
const Class WasmModuleObject::class_ =
|
||||
{
|
||||
"WasmModuleObject",
|
||||
JSCLASS_DELAY_METADATA_BUILDER |
|
||||
JSCLASS_IS_ANONYMOUS | JSCLASS_DELAY_METADATA_BUILDER |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(WasmModuleObject::RESERVED_SLOTS),
|
||||
&WasmModuleObject::classOps_,
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ WasmModuleObject::finalize(FreeOp* fop, JSObject* obj)
|
|||
WasmModuleObject::create(ExclusiveContext* cx, UniqueModule module)
|
||||
{
|
||||
AutoSetNewObjectMetadata metadata(cx);
|
||||
auto* obj = NewObjectWithGivenProto<WasmModuleObject>(cx, nullptr);
|
||||
auto obj = NewObjectWithGivenProto<WasmModuleObject>(cx, nullptr);
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
|
@ -170,7 +170,7 @@ const ClassOps WasmInstanceObject::classOps_ =
|
|||
const Class WasmInstanceObject::class_ =
|
||||
{
|
||||
"WasmInstanceObject",
|
||||
JSCLASS_DELAY_METADATA_BUILDER |
|
||||
JSCLASS_IS_ANONYMOUS | JSCLASS_DELAY_METADATA_BUILDER |
|
||||
JSCLASS_HAS_RESERVED_SLOTS(WasmInstanceObject::RESERVED_SLOTS),
|
||||
&WasmInstanceObject::classOps_,
|
||||
};
|
||||
|
|
|
@ -314,8 +314,8 @@ Module::addSizeOfMisc(MallocSizeOf mallocSizeOf,
|
|||
bool
|
||||
Module::instantiate(JSContext* cx,
|
||||
Handle<FunctionVector> funcImports,
|
||||
HandleArrayBufferObjectMaybeShared heap,
|
||||
MutableHandleWasmInstanceObject instanceObj) const
|
||||
Handle<ArrayBufferObjectMaybeShared*> heap,
|
||||
MutableHandle<WasmInstanceObject*> instanceObj) const
|
||||
{
|
||||
MOZ_ASSERT(funcImports.length() == metadata_->imports.length());
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ struct ExportMap
|
|||
// operations: instantiation and serialization. A Module can be instantiated any
|
||||
// number of times to produce new Instance objects. A Module can be serialized
|
||||
// any number of times such that the serialized bytes can be deserialized later
|
||||
// to produce a new, equivalent Module.
|
||||
// to produce and new, equivalent Module.
|
||||
//
|
||||
// Since fully linked-and-instantiated code (represented by CodeSegment) cannot
|
||||
// be shared between instances, Module stores an unlinked, uninstantiated copy
|
||||
|
|
|
@ -704,10 +704,10 @@ class FunctionExtended : public JSFunction
|
|||
static const unsigned METHOD_HOMEOBJECT_SLOT = 0;
|
||||
|
||||
/*
|
||||
* Exported asm.js/wasm functions store their WasmInstanceObject in the
|
||||
* first slot.
|
||||
* All asm.js/wasm functions store their compiled module (either
|
||||
* WasmModuleObject or AsmJSModuleObject) in the first extended slot.
|
||||
*/
|
||||
static const unsigned WASM_INSTANCE_SLOT = 0;
|
||||
static const unsigned WASM_MODULE_SLOT = 0;
|
||||
|
||||
/*
|
||||
* wasm/asm.js exported functions store the index of the export in the
|
||||
|
@ -715,12 +715,6 @@ class FunctionExtended : public JSFunction
|
|||
*/
|
||||
static const unsigned WASM_EXPORT_INDEX_SLOT = 1;
|
||||
|
||||
/*
|
||||
* asm.js module functions store their WasmModuleObject in the first slot.
|
||||
*/
|
||||
static const unsigned ASMJS_MODULE_SLOT = 0;
|
||||
|
||||
|
||||
static inline size_t offsetOfExtendedSlot(unsigned which) {
|
||||
MOZ_ASSERT(which < NUM_EXTENDED_SLOTS);
|
||||
return offsetof(FunctionExtended, extendedSlots) + which * sizeof(GCPtrValue);
|
||||
|
|
Загрузка…
Ссылка в новой задаче