Bug 1526413 - Add support for reading BigInt values from bailout snapshots r=jandem
authorAndy Wingo <wingo@igalia.com>
Mon, 11 Feb 2019 13:01:19 +0000
changeset 458505 e803c33388095ae73900ee7aa599ef8def8b0699
parent 458504 a1f74e8c8fb72390d22054d6b00c28b1a32f6c43
child 458506 cd21500d51113327d995e7e5c053d525ba0bbed9
push id77877
push userarchaeopteryx@coole-files.de
push dateMon, 11 Feb 2019 15:08:51 +0000
treeherderautoland@e803c3338809 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1526413
milestone67.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 1526413 - Add support for reading BigInt values from bailout snapshots r=jandem Differential Revision: https://phabricator.services.mozilla.com/D19334
js/src/jit/JitFrames.cpp
js/src/jsapi-tests/testJitRValueAlloc.cpp
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -1495,26 +1495,36 @@ static Value FromObjectPayload(uintptr_t
 static Value FromStringPayload(uintptr_t payload) {
   return StringValue(reinterpret_cast<JSString*>(payload));
 }
 
 static Value FromSymbolPayload(uintptr_t payload) {
   return SymbolValue(reinterpret_cast<JS::Symbol*>(payload));
 }
 
+#ifdef ENABLE_BIGINT
+static Value FromBigIntPayload(uintptr_t payload) {
+  return BigIntValue(reinterpret_cast<JS::BigInt*>(payload));
+}
+#endif
+
 static Value FromTypedPayload(JSValueType type, uintptr_t payload) {
   switch (type) {
     case JSVAL_TYPE_INT32:
       return Int32Value(payload);
     case JSVAL_TYPE_BOOLEAN:
       return BooleanValue(!!payload);
     case JSVAL_TYPE_STRING:
       return FromStringPayload(payload);
     case JSVAL_TYPE_SYMBOL:
       return FromSymbolPayload(payload);
+#ifdef ENABLE_BIGINT
+    case JSVAL_TYPE_BIGINT:
+      return FromBigIntPayload(payload);
+#endif
     case JSVAL_TYPE_OBJECT:
       return FromObjectPayload(payload);
     default:
       MOZ_CRASH("unexpected type - needs payload");
   }
 }
 
 bool SnapshotIterator::allocationReadable(const RValueAllocation& alloc,
@@ -1601,16 +1611,20 @@ Value SnapshotIterator::allocationValue(
         case JSVAL_TYPE_INT32:
           return Int32Value(ReadFrameInt32Slot(fp_, alloc.stackOffset2()));
         case JSVAL_TYPE_BOOLEAN:
           return BooleanValue(ReadFrameBooleanSlot(fp_, alloc.stackOffset2()));
         case JSVAL_TYPE_STRING:
           return FromStringPayload(fromStack(alloc.stackOffset2()));
         case JSVAL_TYPE_SYMBOL:
           return FromSymbolPayload(fromStack(alloc.stackOffset2()));
+#ifdef ENABLE_BIGINT
+        case JSVAL_TYPE_BIGINT:
+          return FromBigIntPayload(fromStack(alloc.stackOffset2()));
+#endif
         case JSVAL_TYPE_OBJECT:
           return FromObjectPayload(fromStack(alloc.stackOffset2()));
         default:
           MOZ_CRASH("Unexpected type");
       }
     }
 
 #if defined(JS_NUNBOX32)
@@ -1722,16 +1736,19 @@ void SnapshotIterator::writeAllocationVa
 
     case RValueAllocation::TYPED_STACK:
       switch (alloc.knownType()) {
         default:
           MOZ_CRASH("Not a GC thing: Unexpected write");
           break;
         case JSVAL_TYPE_STRING:
         case JSVAL_TYPE_SYMBOL:
+#ifdef ENABLE_BIGINT
+        case JSVAL_TYPE_BIGINT:
+#endif
         case JSVAL_TYPE_OBJECT:
           WriteFrameSlot(fp_, alloc.stackOffset2(), uintptr_t(v.toGCThing()));
           break;
       }
       break;
 
 #if defined(JS_NUNBOX32)
     case RValueAllocation::UNTYPED_REG_REG:
--- a/js/src/jsapi-tests/testJitRValueAlloc.cpp
+++ b/js/src/jsapi-tests/testJitRValueAlloc.cpp
@@ -63,16 +63,17 @@ BEGIN_TEST(testJitRValueAlloc_TypedReg) 
 #define FOR_EACH_JSVAL(_)       \
   /* _(JSVAL_TYPE_DOUBLE) */    \
   _(JSVAL_TYPE_INT32)           \
   /* _(JSVAL_TYPE_UNDEFINED) */ \
   _(JSVAL_TYPE_BOOLEAN)         \
   /* _(JSVAL_TYPE_MAGIC) */     \
   _(JSVAL_TYPE_STRING)          \
   _(JSVAL_TYPE_SYMBOL)          \
+  IF_BIGINT(_(JSVAL_TYPE_BIGINT),) \
   /* _(JSVAL_TYPE_NULL) */      \
   _(JSVAL_TYPE_OBJECT)
 
 #define CHECK_WITH_JSVAL(jsval)                              \
   s = RValueAllocation::Typed(jsval, Register::FromCode(i)); \
   CHECK(s == Read(s));
 
     FOR_EACH_JSVAL(CHECK_WITH_JSVAL)
@@ -90,16 +91,17 @@ BEGIN_TEST(testJitRValueAlloc_TypedStack
 #define FOR_EACH_JSVAL(_)       \
   _(JSVAL_TYPE_DOUBLE)          \
   _(JSVAL_TYPE_INT32)           \
   /* _(JSVAL_TYPE_UNDEFINED) */ \
   _(JSVAL_TYPE_BOOLEAN)         \
   /* _(JSVAL_TYPE_MAGIC) */     \
   _(JSVAL_TYPE_STRING)          \
   _(JSVAL_TYPE_SYMBOL)          \
+  IF_BIGINT(_(JSVAL_TYPE_BIGINT),) \
   /* _(JSVAL_TYPE_NULL) */      \
   _(JSVAL_TYPE_OBJECT)
 
 #define CHECK_WITH_JSVAL(jsval)          \
   s = RValueAllocation::Typed(jsval, i); \
   CHECK(s == Read(s));
 
     FOR_EACH_JSVAL(CHECK_WITH_JSVAL)