Bug 1468252 part 1 - Define NativeObject::global(). r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 14 Jun 2018 09:07:30 -0700
changeset 422551 671e4d24c511
parent 422550 cb09f382ff47
child 422552 09901c91248b
push id34138
push userdluca@mozilla.com
push date2018-06-15 02:39 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1468252
milestone62.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 1468252 part 1 - Define NativeObject::global(). r=luke
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.h
js/src/vm/Stack-inl.h
js/src/wasm/WasmTypes.cpp
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -664,16 +664,22 @@ NativeObject::allocKindForTenure() const
     using namespace js::gc;
     AllocKind kind = GetGCObjectFixedSlotsKind(numFixedSlots());
     MOZ_ASSERT(!IsBackgroundFinalized(kind));
     if (!CanBeFinalizedInBackground(kind, getClass()))
         return kind;
     return GetBackgroundAllocKind(kind);
 }
 
+inline js::GlobalObject&
+NativeObject::global() const
+{
+    return JSObject::global();
+}
+
 inline js::gc::AllocKind
 PlainObject::allocKindForTenure() const
 {
     using namespace js::gc;
     AllocKind kind = GetGCObjectFixedSlotsKind(numFixedSlots());
     MOZ_ASSERT(!IsBackgroundFinalized(kind));
     MOZ_ASSERT(CanBeFinalizedInBackground(kind, getClass()));
     return GetBackgroundAllocKind(kind);
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -1467,16 +1467,20 @@ class NativeObject : public ShapedObject
 
     /* Return the allocKind we would use if we were to tenure this object. */
     inline js::gc::AllocKind allocKindForTenure() const;
 
     void updateShapeAfterMovingGC();
     void sweepDictionaryListPointer();
     void updateDictionaryListPointerAfterMinorGC(NativeObject* old);
 
+    // Native objects are never wrappers, so a native object always has a realm
+    // and global.
+    inline js::GlobalObject& global() const;
+
     /* JIT Accessors */
     static size_t offsetOfElements() { return offsetof(NativeObject, elements_); }
     static size_t offsetOfFixedElements() {
         return sizeof(NativeObject) + sizeof(ObjectElements);
     }
 
     static size_t getFixedSlotOffset(size_t slot) {
         return sizeof(NativeObject) + slot * sizeof(Value);
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -19,16 +19,17 @@
 #include "vm/GeneratorObject.h"
 #include "vm/JSContext.h"
 #include "vm/JSScript.h"
 #include "wasm/WasmInstance.h"
 
 #include "jit/BaselineFrame-inl.h"
 #include "vm/JSObject-inl.h"
 #include "vm/JSScript-inl.h"
+#include "vm/NativeObject-inl.h"
 
 namespace js {
 
 inline HandleObject
 InterpreterFrame::environmentChain() const
 {
     return HandleObject::fromMarkedLocation(&envChain_);
 }
--- a/js/src/wasm/WasmTypes.cpp
+++ b/js/src/wasm/WasmTypes.cpp
@@ -19,16 +19,17 @@
 #include "wasm/WasmTypes.h"
 
 #include "vm/ArrayBufferObject.h"
 #include "wasm/WasmBaselineCompile.h"
 #include "wasm/WasmInstance.h"
 #include "wasm/WasmSerialize.h"
 
 #include "vm/JSObject-inl.h"
+#include "vm/NativeObject-inl.h"
 
 using namespace js;
 using namespace js::jit;
 using namespace js::wasm;
 
 using mozilla::IsPowerOfTwo;
 using mozilla::MakeEnumeratedRange;