Bug 1176214 - Part 6: Odin changes. r=luke
authorLars T Hansen <lhansen@mozilla.com>
Fri, 27 Nov 2015 09:00:42 +0100
changeset 309420 3b97e81dcbd768972a85bd4f8bb96d6f12ee3828
parent 309419 36df961c4bdc55165397639f999cce8075af3326
child 309421 2a4992c56a458d0dd28f68d72fb6a80a7750af2d
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1176214
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1176214 - Part 6: Odin changes. r=luke
js/src/asmjs/AsmJSLink.cpp
js/src/asmjs/AsmJSModule.cpp
js/src/asmjs/AsmJSValidate.cpp
--- a/js/src/asmjs/AsmJSLink.cpp
+++ b/js/src/asmjs/AsmJSLink.cpp
@@ -215,29 +215,28 @@ ValidateFFI(JSContext* cx, AsmJSModule::
     if (!v.isObject() || !v.toObject().is<JSFunction>())
         return LinkFail(cx, "FFI imports must be functions");
 
     (*ffis)[global.ffiIndex()].set(&v.toObject().as<JSFunction>());
     return true;
 }
 
 static bool
-ValidateArrayView(JSContext* cx, AsmJSModule::Global& global, HandleValue globalVal, bool isShared)
+ValidateArrayView(JSContext* cx, AsmJSModule::Global& global, HandleValue globalVal)
 {
     RootedPropertyName field(cx, global.maybeViewName());
     if (!field)
         return true;
 
     RootedValue v(cx);
     if (!GetDataProperty(cx, globalVal, field, &v))
         return false;
 
     bool tac = IsTypedArrayConstructor(v, global.viewType());
-    bool stac = IsSharedTypedArrayConstructor(v, global.viewType());
-    if (!(tac || (stac && isShared)))
+    if (!tac)
         return LinkFail(cx, "bad typed array constructor");
 
     return true;
 }
 
 static bool
 ValidateByteLength(JSContext* cx, HandleValue globalVal)
 {
@@ -551,17 +550,17 @@ DynamicallyLinkModule(JSContext* cx, con
             break;
           case AsmJSModule::Global::FFI:
             if (!ValidateFFI(cx, global, importVal, &ffis))
                 return false;
             break;
           case AsmJSModule::Global::ArrayView:
           case AsmJSModule::Global::SharedArrayView:
           case AsmJSModule::Global::ArrayViewCtor:
-            if (!ValidateArrayView(cx, global, globalVal, module.hasArrayView() && module.isSharedView()))
+            if (!ValidateArrayView(cx, global, globalVal))
                 return false;
             break;
           case AsmJSModule::Global::ByteLength:
             if (!ValidateByteLength(cx, globalVal))
                 return false;
             break;
           case AsmJSModule::Global::MathBuiltinFunction:
             if (!ValidateMathBuiltinFunction(cx, global, globalVal))
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -780,20 +780,20 @@ AsmJSModule::initHeap(Handle<ArrayBuffer
     MOZ_ASSERT(IsValidAsmJSHeapLength(heap->byteLength()));
     MOZ_ASSERT(dynamicallyLinked_);
     MOZ_ASSERT(!maybeHeap_);
 
     maybeHeap_ = heap;
     // heapDatum() may point to shared memory but that memory is only
     // accessed from maybeHeap(), which wraps it, and from
     // hasDetachedHeap(), which checks it for null.
-    heapDatum() = heap->dataPointerMaybeShared().unwrap(/*safe - explained above*/);
+    heapDatum() = heap->dataPointerEither().unwrap(/*safe - explained above*/);
 
 #if defined(JS_CODEGEN_X86)
-    uint8_t* heapOffset = heap->dataPointerMaybeShared().unwrap(/*safe - used for value*/);
+    uint8_t* heapOffset = heap->dataPointerEither().unwrap(/*safe - used for value*/);
     uint32_t heapLength = heap->byteLength();
     for (unsigned i = 0; i < heapAccesses_.length(); i++) {
         const jit::AsmJSHeapAccess& access = heapAccesses_[i];
         // An access is out-of-bounds iff
         //      ptr + offset + data-type-byte-size > heapLength
         // i.e. ptr > heapLength - data-type-byte-size - offset.
         // data-type-byte-size and offset are already included in the addend
         // so we just have to add the heap length here.
@@ -829,17 +829,17 @@ AsmJSModule::initHeap(Handle<ArrayBuffer
 }
 
 void
 AsmJSModule::restoreHeapToInitialState(ArrayBufferObjectMaybeShared* maybePrevBuffer)
 {
 #if defined(JS_CODEGEN_X86)
     if (maybePrevBuffer) {
         // Subtract out the base-pointer added by AsmJSModule::initHeap.
-        uint8_t* ptrBase = maybePrevBuffer->dataPointerMaybeShared().unwrap(/*safe - used for value*/);
+        uint8_t* ptrBase = maybePrevBuffer->dataPointerEither().unwrap(/*safe - used for value*/);
         uint32_t heapLength = maybePrevBuffer->byteLength();
         for (unsigned i = 0; i < heapAccesses_.length(); i++) {
             const jit::AsmJSHeapAccess& access = heapAccesses_[i];
             // Subtract the heap length back out, leaving the raw displacement in place.
             if (access.hasLengthCheck())
                 X86Encoding::AddInt32(access.patchLengthAt(code_), -heapLength);
             void* addr = access.patchHeapPtrImmAt(code_);
             uint8_t* ptr = reinterpret_cast<uint8_t*>(X86Encoding::GetPointer(addr));
--- a/js/src/asmjs/AsmJSValidate.cpp
+++ b/js/src/asmjs/AsmJSValidate.cpp
@@ -2487,40 +2487,16 @@ IsArrayViewCtorName(ModuleValidator& m, 
     } else if (name == names.Int32Array) {
         *type = Scalar::Int32;
     } else if (name == names.Uint32Array) {
         *type = Scalar::Uint32;
     } else if (name == names.Float32Array) {
         *type = Scalar::Float32;
     } else if (name == names.Float64Array) {
         *type = Scalar::Float64;
-    } else if (name == names.SharedInt8Array) {
-        *shared = true;
-        *type = Scalar::Int8;
-    } else if (name == names.SharedUint8Array) {
-        *shared = true;
-        *type = Scalar::Uint8;
-    } else if (name == names.SharedInt16Array) {
-        *shared = true;
-        *type = Scalar::Int16;
-    } else if (name == names.SharedUint16Array) {
-        *shared = true;
-        *type = Scalar::Uint16;
-    } else if (name == names.SharedInt32Array) {
-        *shared = true;
-        *type = Scalar::Int32;
-    } else if (name == names.SharedUint32Array) {
-        *shared = true;
-        *type = Scalar::Uint32;
-    } else if (name == names.SharedFloat32Array) {
-        *shared = true;
-        *type = Scalar::Float32;
-    } else if (name == names.SharedFloat64Array) {
-        *shared = true;
-        *type = Scalar::Float64;
     } else {
         return false;
     }
     return true;
 }
 
 static bool
 CheckNewArrayViewArgs(ModuleValidator& m, ParseNode* ctorExpr, PropertyName* bufferName)
@@ -2572,21 +2548,16 @@ CheckNewArrayView(ModuleValidator& m, Pr
         if (global->which() != ModuleValidator::Global::ArrayViewCtor)
             return m.failName(ctorExpr, "%s must be an imported array view constructor", globalName);
 
         field = nullptr;
         type = global->viewType();
         shared = global->viewIsSharedView();
     }
 
-#if !defined(ENABLE_SHARED_ARRAY_BUFFER)
-    if (shared)
-        return m.fail(ctorExpr, "shared views not supported by this build");
-#endif
-
     if (!CheckNewArrayViewArgs(m, ctorExpr, bufferName))
         return false;
 
     if (!m.module().isValidViewSharedness(shared))
         return m.failName(ctorExpr, "%s has different sharedness than previous view constructors", globalName);
 
     return m.addArrayView(varName, type, field, shared);
 }
@@ -2721,20 +2692,16 @@ CheckGlobalDotImport(ModuleValidator& m,
         if (field == m.cx()->names().Infinity)
             return m.addGlobalConstant(varName, PositiveInfinity<double>(), field);
         if (field == m.cx()->names().byteLength)
             return m.addByteLength(varName);
 
         Scalar::Type type;
         bool shared = false;
         if (IsArrayViewCtorName(m, field, &type, &shared)) {
-#if !defined(ENABLE_SHARED_ARRAY_BUFFER)
-            if (shared)
-                return m.fail(initNode, "shared views not supported by this build");
-#endif
             if (!m.module().isValidViewSharedness(shared))
                 return m.failName(initNode, "'%s' has different sharedness than previous view constructors", field);
             return m.addArrayViewCtor(varName, type, field, shared);
         }
 
         return m.failName(initNode, "'%s' is not a standard constant or typed array name", field);
     }
 
@@ -6815,22 +6782,16 @@ CheckModule(ExclusiveContext* cx, AsmJSP
     if (!CheckModuleProcessingDirectives(m))
         return false;
 
     if (!CheckModuleGlobals(m))
         return false;
 
     m.startFunctionBodies();
 
-#if !defined(ENABLE_SHARED_ARRAY_BUFFER)
-    if (m.module().hasArrayView() && m.module().isSharedView())
-        return m.failOffset(m.parser().tokenStream.currentToken().pos.begin,
-                            "shared views not supported by this build");
-#endif
-
     if (!CheckFunctions(m))
         return false;
 
     if (!CheckFuncPtrTables(m))
         return false;
 
     if (!CheckModuleReturn(m))
         return false;