Bug 1596288 - Move some code in Bailouts.h into Bailouts.cpp that is the sole user of it. r=jandem
authorJeff Walden <jwalden@mit.edu>
Thu, 14 Nov 2019 22:53:04 +0000
changeset 502065 bba1ab697faa083c7fe335061b8ca607bd83a2c7
parent 502064 55c9bc5fb1fe59bb21afcde021cbb3553d17fd9e
child 502066 f6aa348ba29ac0d8310d5ea7a447828dc22f0543
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1596288
milestone72.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 1596288 - Move some code in Bailouts.h into Bailouts.cpp that is the sole user of it. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D52936
js/src/jit/Bailouts.cpp
js/src/jit/Bailouts.h
js/src/wasm/WasmCraneliftCompile.cpp
js/src/wasm/WasmInstance.h
js/src/wasm/WasmStubs.h
--- a/js/src/jit/Bailouts.cpp
+++ b/js/src/jit/Bailouts.cpp
@@ -20,16 +20,26 @@
 #include "vm/Probes-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::jit;
 
 using mozilla::IsInRange;
 
+// This address is a magic number made to cause crashes while indicating that we
+// are making an attempt to mark the stack during a bailout.
+static constexpr uint32_t FAKE_EXITFP_FOR_BAILOUT_ADDR = 0xba2;
+static uint8_t* const FAKE_EXITFP_FOR_BAILOUT =
+    reinterpret_cast<uint8_t*>(FAKE_EXITFP_FOR_BAILOUT_ADDR);
+
+static_assert(!(FAKE_EXITFP_FOR_BAILOUT_ADDR & wasm::ExitOrJitEntryFPTag),
+              "FAKE_EXITFP_FOR_BAILOUT could be mistaken as a low-bit tagged "
+              "wasm exit fp");
+
 bool jit::Bailout(BailoutStack* sp, BaselineBailoutInfo** bailoutInfo) {
   JSContext* cx = TlsContext.get();
   MOZ_ASSERT(bailoutInfo);
 
   // We don't have an exit frame.
   MOZ_ASSERT(IsInRange(FAKE_EXITFP_FOR_BAILOUT, 0, 0x1000) &&
                  IsInRange(FAKE_EXITFP_FOR_BAILOUT + sizeof(CommonFrameLayout),
                            0, 0x1000),
--- a/js/src/jit/Bailouts.h
+++ b/js/src/jit/Bailouts.h
@@ -2,24 +2,29 @@
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_Bailouts_h
 #define jit_Bailouts_h
 
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+#include "mozilla/Attributes.h"  // MOZ_MUST_USE
+
 #include <stddef.h>  // size_t
 #include <stdint.h>  // uint8_t, uint32_t
 
 #include "jstypes.h"
 
-#include "jit/JitFrames.h"
-#include "jit/JSJitFrameIter.h"
-#include "wasm/WasmFrameIter.h"  // js::wasm::ExitOrJitEntryFPTag
+#include "jit/IonTypes.h"  // js::jit::Bailout{Id,Kind}, js::jit::SnapshotOffset
+#include "jit/JSJitFrameIter.h"  // js::jit::InlineFrameIterator
+#include "jit/Registers.h"       // js::jit::MachineState
+#include "js/TypeDecls.h"        // jsbytecode
+#include "vm/Stack.h"            // js::AbstractFramePtr
 
 namespace js {
 namespace jit {
 
 // [SMDOC] IonMonkey Bailouts
 //
 // A "bailout" is the process of recovering a baseline frame from an IonFrame.
 // Bailouts are implemented in js::jit::BailoutIonToBaseline, which has the
@@ -125,33 +130,25 @@ namespace jit {
 // 10 byte cost is more optimal than a bailout table. See JitFrames.h for more
 // detail.
 
 static const BailoutId INVALID_BAILOUT_ID = BailoutId(-1);
 
 // Keep this arbitrarily small for now, for testing.
 static const uint32_t BAILOUT_TABLE_SIZE = 16;
 
-// This address is a magic number made to cause crashes while indicating that we
-// are making an attempt to mark the stack during a bailout.
-static const uint32_t FAKE_EXITFP_FOR_BAILOUT_ADDR = 0xba2;
-static uint8_t* const FAKE_EXITFP_FOR_BAILOUT =
-    reinterpret_cast<uint8_t*>(FAKE_EXITFP_FOR_BAILOUT_ADDR);
-
-static_assert(!(FAKE_EXITFP_FOR_BAILOUT_ADDR & wasm::ExitOrJitEntryFPTag),
-              "FAKE_EXITFP_FOR_BAILOUT could be mistaken as a low-bit tagged "
-              "wasm exit fp");
-
 // BailoutStack is an architecture specific pointer to the stack, given by the
 // bailout handler.
 class BailoutStack;
 class InvalidationBailoutStack;
 
+struct IonScript;
 class JitActivation;
 class JitActivationIterator;
+struct ResumeFromException;
 
 // Must be implemented by each architecture.
 
 // This structure is constructed before recovering the baseline frames for a
 // bailout. It records all information extracted from the stack, and which are
 // needed for the JSJitFrameIter.
 class BailoutFrameInfo {
   MachineState machine_;
--- a/js/src/wasm/WasmCraneliftCompile.cpp
+++ b/js/src/wasm/WasmCraneliftCompile.cpp
@@ -20,16 +20,17 @@
 
 #include "mozilla/ScopeExit.h"
 
 #include "jit/Disassemble.h"
 #include "js/Printf.h"
 
 #include "wasm/cranelift/baldrapi.h"
 #include "wasm/cranelift/clifapi.h"
+#include "wasm/WasmFrameIter.h"  // js::wasm::GenerateFunction{Pro,Epi}logue
 #include "wasm/WasmGenerator.h"
 
 #include "jit/MacroAssembler-inl.h"
 
 using namespace js;
 using namespace js::jit;
 using namespace js::wasm;
 
--- a/js/src/wasm/WasmInstance.h
+++ b/js/src/wasm/WasmInstance.h
@@ -20,16 +20,17 @@
 #define wasm_instance_h
 
 #include "builtin/TypedObject.h"
 #include "gc/Barrier.h"
 #include "gc/Zone.h"
 #include "vm/SharedMem.h"
 #include "wasm/WasmCode.h"
 #include "wasm/WasmDebug.h"
+#include "wasm/WasmFrameIter.h"  // js::wasm::WasmFrameIter
 #include "wasm/WasmProcess.h"
 #include "wasm/WasmTable.h"
 
 namespace js {
 namespace wasm {
 
 // Instance represents a wasm instance and provides all the support for runtime
 // execution of code in the instance. Instances share various immutable data
--- a/js/src/wasm/WasmStubs.h
+++ b/js/src/wasm/WasmStubs.h
@@ -14,16 +14,17 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #ifndef wasm_stubs_h
 #define wasm_stubs_h
 
+#include "wasm/WasmFrameIter.h"  // js::wasm::ExitReason
 #include "wasm/WasmGenerator.h"
 #include "wasm/WasmOpIter.h"
 
 namespace js {
 namespace wasm {
 
 // ValType and location for a single result: either in a register or on the
 // stack.