[wasm] Move serialization-specific tagging logic.
The tagging logic used for serializing and deserializing WasmCode objects is by now only used in the "wasm-serialization.cc" unit. R=clemensh@chromium.org Change-Id: I31bd82e7dbd17f713c5e51073dfd9836f1ddaed7 Reviewed-on: https://chromium-review.googlesource.com/975303 Reviewed-by: Clemens Hammacher <clemensh@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#52140}
This commit is contained in:
parent
be1b2d66c0
commit
a7127e4a3f
@ -1056,29 +1056,6 @@ NativeModuleModificationScope::~NativeModuleModificationScope() {
|
||||
}
|
||||
}
|
||||
|
||||
// On Intel, call sites are encoded as a displacement. For linking
|
||||
// and for serialization/deserialization, we want to store/retrieve
|
||||
// a tag (the function index). On Intel, that means accessing the
|
||||
// raw displacement. Everywhere else, that simply means accessing
|
||||
// the target address.
|
||||
void SetWasmCalleeTag(RelocInfo* rinfo, uint32_t tag) {
|
||||
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
|
||||
*(reinterpret_cast<uint32_t*>(rinfo->target_address_address())) = tag;
|
||||
#else
|
||||
rinfo->set_target_address(reinterpret_cast<Address>(tag), SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t GetWasmCalleeTag(RelocInfo* rinfo) {
|
||||
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
|
||||
return *(reinterpret_cast<uint32_t*>(rinfo->target_address_address()));
|
||||
#else
|
||||
return static_cast<uint32_t>(
|
||||
reinterpret_cast<size_t>(rinfo->target_address()));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -386,13 +386,6 @@ class NativeModuleModificationScope final {
|
||||
NativeModule* native_module_;
|
||||
};
|
||||
|
||||
// Utilities specific to wasm code generation. We embed a tag for call sites -
|
||||
// the index of the called function - when serializing and when creating the
|
||||
// code, initially. These APIs offer accessors. The implementation has platform
|
||||
// specific nuances.
|
||||
void SetWasmCalleeTag(RelocInfo* rinfo, uint32_t tag);
|
||||
uint32_t GetWasmCalleeTag(RelocInfo* rinfo);
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -24,6 +24,7 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace wasm {
|
||||
|
||||
namespace {
|
||||
|
||||
class Writer {
|
||||
@ -117,6 +118,29 @@ bool IsSupportedVersion(Isolate* isolate, const Vector<const byte> buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// On Intel, call sites are encoded as a displacement. For linking
|
||||
// and for serialization/deserialization, we want to store/retrieve
|
||||
// a tag (the function index). On Intel, that means accessing the
|
||||
// raw displacement. Everywhere else, that simply means accessing
|
||||
// the target address.
|
||||
void SetWasmCalleeTag(RelocInfo* rinfo, uint32_t tag) {
|
||||
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
|
||||
*(reinterpret_cast<uint32_t*>(rinfo->target_address_address())) = tag;
|
||||
#else
|
||||
rinfo->set_target_address(reinterpret_cast<Address>(tag), SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t GetWasmCalleeTag(RelocInfo* rinfo) {
|
||||
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
|
||||
return *(reinterpret_cast<uint32_t*>(rinfo->target_address_address()));
|
||||
#else
|
||||
return static_cast<uint32_t>(
|
||||
reinterpret_cast<size_t>(rinfo->target_address()));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
enum SerializationSection { Init, Metadata, Stubs, CodeSection, Done };
|
||||
|
Loading…
Reference in New Issue
Block a user