-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put all JIT support framework in place
Summary: This makes everything ready for the JIT without the JIT itself. Reviewed By: neildhar Differential Revision: D61752810 fbshipit-source-id: 6e7e52699acd19814bf8d9095e51d00f69923309
- Loading branch information
1 parent
1d3005a
commit 419a599
Showing
12 changed files
with
317 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#ifndef HERMES_VM_JIT_JIT_H | ||
#define HERMES_VM_JIT_JIT_H | ||
|
||
#include "hermes/VM/JIT/Config.h" | ||
|
||
#include "hermes/VM/CodeBlock.h" | ||
|
||
namespace hermes { | ||
namespace vm { | ||
|
||
/// All state related to JIT compilation. | ||
class JITContext { | ||
public: | ||
/// Construct a JIT context. No executable memory is allocated before it is | ||
/// needed. | ||
/// \param enable whether JIT is enabled. | ||
JITContext(bool enable) {} | ||
~JITContext() = default; | ||
|
||
JITContext(const JITContext &) = delete; | ||
void operator=(const JITContext &) = delete; | ||
|
||
/// Compile a function to native code and return the native pointer. If the | ||
/// function was previously compiled, return the existing body. If it cannot | ||
/// be compiled, return nullptr. | ||
inline JITCompiledFunctionPtr compile( | ||
Runtime &runtime, | ||
CodeBlock *codeBlock) { | ||
return codeBlock->getJITCompiled(); | ||
} | ||
|
||
/// \return true if JIT compilation is enabled. | ||
bool isEnabled() const { | ||
return false; | ||
} | ||
|
||
/// Enable or disable JIT compilation. | ||
void setEnabled(bool enabled) {} | ||
|
||
/// Enable or disable dumping JIT'ed Code. | ||
void setDumpJITCode(bool dump) {} | ||
|
||
/// \return true if dumping JIT'ed Code is enabled. | ||
bool getDumpJITCode() { | ||
return false; | ||
} | ||
|
||
/// Set the flag to fatally crash on JIT compilation errors. | ||
void setCrashOnError(bool crash) {} | ||
|
||
/// \return true if we should fatally crash on JIT compilation errors. | ||
bool getCrashOnError() { | ||
return false; | ||
} | ||
|
||
/// Whether to force jitting of all functions right away. | ||
void setForceJIT(bool force) {} | ||
}; | ||
|
||
} // namespace vm | ||
} // namespace hermes | ||
|
||
#endif // HERMES_VM_JIT_JIT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.