Bug 1615728 - Move SourceExtent outside of JSScript r=djvj
authorMatthew Gaudet <mgaudet@mozilla.com>
Wed, 19 Feb 2020 23:02:39 +0000
changeset 514674 1130f972ab5cabf0e1908506b78c89c6e06dd8df
parent 514673 430371b4b906010e5f2e142f280f105f8230612c
child 514675 1159747240614719649a99322bfc6e10f84439fe
push id37140
push usermalexandru@mozilla.com
push dateThu, 20 Feb 2020 09:35:08 +0000
treeherdermozilla-central@b532be9d2719 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdjvj
bugs1615728
milestone75.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 1615728 - Move SourceExtent outside of JSScript r=djvj Differential Revision: https://phabricator.services.mozilla.com/D63271
js/src/vm/JSScript.h
--- a/js/src/vm/JSScript.h
+++ b/js/src/vm/JSScript.h
@@ -1946,16 +1946,50 @@ struct RuntimeScriptData::Hasher {
     return (entry->atomsSpan() == lookup->atomsSpan()) &&
            (entry->isd_->immutableData() == lookup->isd_->immutableData());
   }
 };
 
 using RuntimeScriptDataTable =
     HashSet<RuntimeScriptData*, RuntimeScriptData::Hasher, SystemAllocPolicy>;
 
+// Range of characters in scriptSource which contains a script's source,
+// that is, the range used by the Parser to produce a script.
+//
+// For most functions the fields point to the following locations.
+//
+//   function * f(a, b) { return a + b; }
+//   ^          ^                        ^
+//   |          |                        |
+//   |          sourceStart              sourceEnd
+//   |                                   |
+//   toStringStart                       toStringEnd
+//
+// For the special case of class constructors, the spec requires us to use an
+// alternate definition of toStringStart / toStringEnd.
+//
+//   class C { constructor() { this.field = 42; } }
+//   ^         ^                                 ^ ^
+//   |         |                                 | `---------`
+//   |         sourceStart                       sourceEnd   |
+//   |                                                       |
+//   toStringStart                                           toStringEnd
+//
+// NOTE: These are counted in Code Units from the start of the script source.
+struct SourceExtent {
+  uint32_t sourceStart = 0;
+  uint32_t sourceEnd = 0;
+  uint32_t toStringStart = 0;
+  uint32_t toStringEnd = 0;
+
+  // Line and column of |sourceStart_| position.
+  uint32_t lineno = 0;
+  uint32_t column = 0;  // Count of Code Points
+};
+
 // This class contains fields and accessors that are common to both lazy and
 // non-lazy interpreted scripts. This must be located at offset +0 of any
 // derived classes in order for the 'jitCodeRaw' mechanism to work with the
 // JITs.
 class BaseScript : public gc::TenuredCell {
  protected:
   // Pointer to baseline->method()->raw(), ion->method()->raw(), a wasm jit
   // entry, the JIT's EnterInterpreter stub, or the lazy link stub. Must be
@@ -1976,49 +2010,17 @@ class BaseScript : public gc::TenuredCel
   // inner-functions, but other kinds of entries have different interpretations.
   PrivateScriptData* data_ = nullptr;
 
   // Shareable script data. This includes runtime-wide atom pointers, bytecode,
   // and various script note structures. If the script is currently lazy, this
   // will not point to anything.
   RefPtr<js::RuntimeScriptData> sharedData_ = {};
 
-  // Range of characters in scriptSource which contains this script's source,
-  // that is, the range used by the Parser to produce this script.
-  //
-  // For most functions the fields point to the following locations.
-  //
-  //   function * f(a, b) { return a + b; }
-  //   ^          ^                        ^
-  //   |          |                        |
-  //   |          sourceStart_             sourceEnd_
-  //   |                                   |
-  //   toStringStart_                      toStringEnd_
-  //
-  // For the special case of class constructors, the spec requires us to use an
-  // alternate definition of toStringStart_ / toStringEnd_.
-  //
-  //   class C { constructor() { this.field = 42; } }
-  //   ^         ^                                 ^ ^
-  //   |         |                                 | `---------`
-  //   |         sourceStart_                      sourceEnd_  |
-  //   |                                                       |
-  //   toStringStart_                                          toStringEnd_
-  //
-  // NOTE: These are counted in Code Units from the start of the script source.
-  struct SourceExtent {
-    uint32_t sourceStart = 0;
-    uint32_t sourceEnd = 0;
-    uint32_t toStringStart = 0;
-    uint32_t toStringEnd = 0;
-
-    // Line and column of |sourceStart_| position.
-    uint32_t lineno = 0;
-    uint32_t column = 0;  // Count of Code Points
-  } extent_;
+  SourceExtent extent_;
 
   // See ImmutableFlags / MutableFlags below for definitions. These are stored
   // as uint32_t instead of bitfields to make it more predictable to access
   // from JIT code.
   uint32_t immutableFlags_ = 0;
   uint32_t mutableFlags_ = 0;
 
   ScriptWarmUpData warmUpData_ = {};