[wasm] Remove test-only {RelocInfo::JS_TO_WASM_CALL}.
The relocation mode in question was by now only used in tests to model a wrapper call from wrapper code (on the GC'ed heap) to a non-movable wasm code object. Instead of using a special relocation mode, we switch to using the existing {EXTERNAL_REFERENCE} mode similar to other static C++ functions called from generated code. R=sigurds@chromium.org BUG=v8:8238 Change-Id: I30af98b92aed207c52ccccaf018a455ecac39c2b Reviewed-on: https://chromium-review.googlesource.com/c/1309821 Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#57239}
This commit is contained in:
parent
ece9156c4c
commit
fbeaeb26ef
@ -344,18 +344,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return static_cast<uint32_t>(
|
||||
|
@ -202,18 +202,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return static_cast<int>(imm);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
Instruction* instr = reinterpret_cast<Instruction*>(pc_);
|
||||
|
@ -204,12 +204,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
bool allow_macro_instructions() const { return allow_macro_instructions_; }
|
||||
#endif
|
||||
|
||||
// We should not use near calls or jumps for JS->WASM calls and calls to
|
||||
// external references, since the code spaces are not guaranteed to be close
|
||||
// to each other.
|
||||
// We should not use near calls or jumps for calls to external references,
|
||||
// since the code spaces are not guaranteed to be close to each other.
|
||||
bool CanUseNearCallOrJump(RelocInfo::Mode rmode) {
|
||||
return rmode != RelocInfo::JS_TO_WASM_CALL &&
|
||||
rmode != RelocInfo::EXTERNAL_REFERENCE;
|
||||
return rmode != RelocInfo::EXTERNAL_REFERENCE;
|
||||
}
|
||||
|
||||
// Activation support.
|
||||
|
@ -213,7 +213,7 @@ class Arm64OperandConverter final : public InstructionOperandConverter {
|
||||
case Constant::kInt32:
|
||||
return Operand(constant.ToInt32());
|
||||
case Constant::kInt64:
|
||||
if (RelocInfo::IsWasmPtrReference(constant.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(constant.rmode())) {
|
||||
return Operand(constant.ToInt64(), constant.rmode());
|
||||
} else {
|
||||
return Operand(constant.ToInt64());
|
||||
|
@ -3686,7 +3686,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
__ li(dst, Operand::EmbeddedNumber(src.ToFloat32()));
|
||||
break;
|
||||
case Constant::kInt64:
|
||||
if (RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(src.rmode())) {
|
||||
__ li(dst, Operand(src.ToInt64(), src.rmode()));
|
||||
} else {
|
||||
__ li(dst, Operand(src.ToInt64()));
|
||||
|
@ -2522,7 +2522,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
break;
|
||||
case Constant::kInt64:
|
||||
#if V8_TARGET_ARCH_PPC64
|
||||
if (RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(src.rmode())) {
|
||||
__ mov(dst, Operand(src.ToInt64(), src.rmode()));
|
||||
} else {
|
||||
#endif
|
||||
|
@ -3201,7 +3201,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
break;
|
||||
case Constant::kInt64:
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
if (RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(src.rmode())) {
|
||||
__ mov(dst, Operand(src.ToInt64(), src.rmode()));
|
||||
} else {
|
||||
__ Load(dst, Operand(src.ToInt64()));
|
||||
|
@ -3448,7 +3448,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
auto MoveConstantToRegister = [&](Register dst, Constant src) {
|
||||
switch (src.type()) {
|
||||
case Constant::kInt32: {
|
||||
if (RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(src.rmode())) {
|
||||
__ movq(dst, src.ToInt64(), src.rmode());
|
||||
} else {
|
||||
int32_t value = src.ToInt32();
|
||||
@ -3461,7 +3461,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
break;
|
||||
}
|
||||
case Constant::kInt64:
|
||||
if (RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (RelocInfo::IsWasmReference(src.rmode())) {
|
||||
__ movq(dst, src.ToInt64(), src.rmode());
|
||||
} else {
|
||||
__ Set(dst, src.ToInt64());
|
||||
@ -3498,7 +3498,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
};
|
||||
// Helper function to write the given constant to the stack.
|
||||
auto MoveConstantToSlot = [&](Operand dst, Constant src) {
|
||||
if (!RelocInfo::IsWasmPtrReference(src.rmode())) {
|
||||
if (!RelocInfo::IsWasmReference(src.rmode())) {
|
||||
switch (src.type()) {
|
||||
case Constant::kInt32:
|
||||
__ movq(dst, Immediate(src.ToInt32()));
|
||||
|
@ -55,11 +55,10 @@ bool CpuFeatures::SupportsWasmSimd128() { return IsSupported(SSE4_1); }
|
||||
void RelocInfo::apply(intptr_t delta) {
|
||||
DCHECK_EQ(kApplyMask, (RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
|
||||
RelocInfo::ModeMask(RelocInfo::JS_TO_WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::OFF_HEAP_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY)));
|
||||
if (IsRuntimeEntry(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsJsToWasmCall(rmode_) || IsOffHeapTarget(rmode_)) {
|
||||
IsOffHeapTarget(rmode_)) {
|
||||
int32_t* p = reinterpret_cast<int32_t*>(pc_);
|
||||
*p -= delta; // Relocate entry.
|
||||
} else if (IsInternalReference(rmode_)) {
|
||||
|
@ -198,7 +198,6 @@ void Displacement::init(Label* L, Type type) {
|
||||
const int RelocInfo::kApplyMask =
|
||||
RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
|
||||
RelocInfo::ModeMask(RelocInfo::JS_TO_WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::OFF_HEAP_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
|
||||
|
||||
@ -220,18 +219,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return Memory<uint32_t>(pc_);
|
||||
@ -3252,8 +3239,7 @@ void Assembler::GrowBuffer() {
|
||||
}
|
||||
|
||||
// Relocate pc-relative references.
|
||||
int mode_mask = RelocInfo::ModeMask(RelocInfo::JS_TO_WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::OFF_HEAP_TARGET);
|
||||
int mode_mask = RelocInfo::ModeMask(RelocInfo::OFF_HEAP_TARGET);
|
||||
DCHECK_EQ(mode_mask, RelocInfo::kApplyMask & mode_mask);
|
||||
for (RelocIterator it(desc, mode_mask); !it.done(); it.next()) {
|
||||
it.rinfo()->apply(pc_delta);
|
||||
|
@ -207,18 +207,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return static_cast<uint32_t>(
|
||||
|
@ -184,18 +184,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return static_cast<uint32_t>(
|
||||
|
@ -14622,7 +14622,6 @@ bool Code::IsIsolateIndependent(Isolate* isolate) {
|
||||
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
|
||||
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
|
||||
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) |
|
||||
RelocInfo::ModeMask(RelocInfo::JS_TO_WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
|
||||
RelocInfo::ModeMask(RelocInfo::WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::WASM_STUB_CALL)));
|
||||
|
@ -168,18 +168,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return static_cast<uint32_t>(
|
||||
|
@ -426,8 +426,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
|
||||
return "internal wasm call";
|
||||
case WASM_STUB_CALL:
|
||||
return "wasm stub call";
|
||||
case JS_TO_WASM_CALL:
|
||||
return "js to wasm call";
|
||||
case NUMBER_OF_MODES:
|
||||
case PC_JUMP:
|
||||
UNREACHABLE();
|
||||
@ -526,7 +524,6 @@ void RelocInfo::Verify(Isolate* isolate) {
|
||||
case VENEER_POOL:
|
||||
case WASM_CALL:
|
||||
case WASM_STUB_CALL:
|
||||
case JS_TO_WASM_CALL:
|
||||
case NONE:
|
||||
break;
|
||||
case NUMBER_OF_MODES:
|
||||
|
@ -57,7 +57,6 @@ class RelocInfo {
|
||||
RELATIVE_CODE_TARGET, // LAST_CODE_TARGET_MODE
|
||||
EMBEDDED_OBJECT, // LAST_GCED_ENUM
|
||||
|
||||
JS_TO_WASM_CALL,
|
||||
WASM_CALL, // FIRST_SHAREABLE_RELOC_MODE
|
||||
WASM_STUB_CALL,
|
||||
|
||||
@ -137,6 +136,7 @@ class RelocInfo {
|
||||
return mode == RUNTIME_ENTRY;
|
||||
}
|
||||
static constexpr bool IsWasmCall(Mode mode) { return mode == WASM_CALL; }
|
||||
static constexpr bool IsWasmReference(Mode mode) { return mode == WASM_CALL; }
|
||||
static constexpr bool IsWasmStubCall(Mode mode) {
|
||||
return mode == WASM_STUB_CALL;
|
||||
}
|
||||
@ -163,15 +163,6 @@ class RelocInfo {
|
||||
return mode == OFF_HEAP_TARGET;
|
||||
}
|
||||
static constexpr bool IsNone(Mode mode) { return mode == NONE; }
|
||||
static constexpr bool IsWasmReference(Mode mode) {
|
||||
return IsWasmPtrReference(mode);
|
||||
}
|
||||
static constexpr bool IsJsToWasmCall(Mode mode) {
|
||||
return mode == JS_TO_WASM_CALL;
|
||||
}
|
||||
static constexpr bool IsWasmPtrReference(Mode mode) {
|
||||
return mode == WASM_CALL || mode == JS_TO_WASM_CALL;
|
||||
}
|
||||
|
||||
static bool IsOnlyForSerializer(Mode mode) {
|
||||
#ifdef V8_TARGET_ARCH_IA32
|
||||
@ -221,7 +212,6 @@ class RelocInfo {
|
||||
|
||||
Address wasm_call_address() const;
|
||||
Address wasm_stub_call_address() const;
|
||||
Address js_to_wasm_address() const;
|
||||
|
||||
uint32_t wasm_call_tag() const;
|
||||
|
||||
@ -229,8 +219,6 @@ class RelocInfo {
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_wasm_stub_call_address(
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_js_to_wasm_address(
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
void set_target_address(
|
||||
Address target,
|
||||
|
@ -280,18 +280,6 @@ int RelocInfo::GetDeoptimizationId(Isolate* isolate, DeoptimizeKind kind) {
|
||||
return Deoptimizer::GetDeoptimizationId(isolate, target_address(), kind);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return static_cast<uint32_t>(
|
||||
|
@ -224,7 +224,6 @@ void WasmCode::Validate() const {
|
||||
CHECK(contains(target));
|
||||
break;
|
||||
}
|
||||
case RelocInfo::JS_TO_WASM_CALL:
|
||||
case RelocInfo::EXTERNAL_REFERENCE:
|
||||
case RelocInfo::COMMENT:
|
||||
case RelocInfo::CONST_POOL:
|
||||
|
@ -128,20 +128,6 @@ void CpuFeatures::PrintFeatures() {
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation of RelocInfo
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Memory<Address>(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(pc_, sizeof(Address));
|
||||
}
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
return Memory<Address>(pc_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_call_tag() const {
|
||||
DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
|
||||
return Memory<uint32_t>(pc_);
|
||||
|
@ -263,11 +263,7 @@ class WasmFunctionWrapper : private compiler::GraphAndBuilders {
|
||||
intptr_t address = static_cast<intptr_t>(code->instruction_start());
|
||||
compiler::NodeProperties::ChangeOp(
|
||||
inner_code_node_,
|
||||
kPointerSize == 8
|
||||
? common()->RelocatableInt64Constant(address,
|
||||
RelocInfo::JS_TO_WASM_CALL)
|
||||
: common()->RelocatableInt32Constant(static_cast<int>(address),
|
||||
RelocInfo::JS_TO_WASM_CALL));
|
||||
common()->ExternalConstant(ExternalReference::FromRawAddress(address)));
|
||||
}
|
||||
|
||||
const compiler::Operator* IntPtrConstant(intptr_t value) {
|
||||
|
Loading…
Reference in New Issue
Block a user