Commit 4504fbe2 authored by Yahan Lu's avatar Yahan Lu Committed by Commit Bot

[riscv64] Re enable constant pool

Change-Id: Ic84fbda771a89ee20c43795dd5c1ab4a91057862
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2814724Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarBrice Dobry <brice.dobry@futurewei.com>
Commit-Queue: Yahan Lu <yahan@iscas.ac.cn>
Cr-Commit-Position: refs/heads/master@{#74116}
parent c98b4f4c
...@@ -160,6 +160,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -160,6 +160,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
virtual ~Assembler() { CHECK(constpool_.IsEmpty()); } virtual ~Assembler() { CHECK(constpool_.IsEmpty()); }
void AbortedCodeGeneration() { constpool_.Clear(); }
// GetCode emits any pending (non-emitted) code and fills the descriptor desc. // GetCode emits any pending (non-emitted) code and fills the descriptor desc.
static constexpr int kNoHandlerTable = 0; static constexpr int kNoHandlerTable = 0;
static constexpr SafepointTableBuilder* kNoSafepointTable = nullptr; static constexpr SafepointTableBuilder* kNoSafepointTable = nullptr;
...@@ -873,6 +874,34 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -873,6 +874,34 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
inline int UnboundLabelsCount() { return unbound_labels_count_; } inline int UnboundLabelsCount() { return unbound_labels_count_; }
using BlockPoolsScope = BlockTrampolinePoolScope;
void RecordConstPool(int size);
void ForceConstantPoolEmissionWithoutJump() {
constpool_.Check(Emission::kForced, Jump::kOmitted);
}
void ForceConstantPoolEmissionWithJump() {
constpool_.Check(Emission::kForced, Jump::kRequired);
}
// Check if the const pool needs to be emitted while pretending that {margin}
// more bytes of instructions have already been emitted.
void EmitConstPoolWithJumpIfNeeded(size_t margin = 0) {
constpool_.Check(Emission::kIfNeeded, Jump::kRequired, margin);
}
void EmitConstPoolWithoutJumpIfNeeded(size_t margin = 0) {
constpool_.Check(Emission::kIfNeeded, Jump::kOmitted, margin);
}
void RecordEntry(uint32_t data, RelocInfo::Mode rmode) {
constpool_.RecordEntry(data, rmode);
}
void RecordEntry(uint64_t data, RelocInfo::Mode rmode) {
constpool_.RecordEntry(data, rmode);
}
protected: protected:
// Readable constants for base and offset adjustment helper, these indicate if // Readable constants for base and offset adjustment helper, these indicate if
// aside from offset, another value like offset + 4 should fit into int16. // aside from offset, another value like offset + 4 should fit into int16.
...@@ -958,34 +987,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -958,34 +987,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
} }
} }
using BlockPoolsScope = BlockTrampolinePoolScope;
void RecordConstPool(int size);
void ForceConstantPoolEmissionWithoutJump() {
constpool_.Check(Emission::kForced, Jump::kOmitted);
}
void ForceConstantPoolEmissionWithJump() {
constpool_.Check(Emission::kForced, Jump::kRequired);
}
// Check if the const pool needs to be emitted while pretending that {margin}
// more bytes of instructions have already been emitted.
void EmitConstPoolWithJumpIfNeeded(size_t margin = 0) {
constpool_.Check(Emission::kIfNeeded, Jump::kRequired, margin);
}
void EmitConstPoolWithoutJumpIfNeeded(size_t margin = 0) {
constpool_.Check(Emission::kIfNeeded, Jump::kOmitted, margin);
}
void RecordEntry(uint32_t data, RelocInfo::Mode rmode) {
constpool_.RecordEntry(data, rmode);
}
void RecordEntry(uint64_t data, RelocInfo::Mode rmode) {
constpool_.RecordEntry(data, rmode);
}
private: private:
// Avoid overflows for displacements etc. // Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512 * MB; static const int kMaximalBufferSize = 512 * MB;
......
...@@ -2579,7 +2579,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) { ...@@ -2579,7 +2579,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
__ Ret(); __ Ret();
} }
void CodeGenerator::FinishCode() {} void CodeGenerator::FinishCode() { __ ForceConstantPoolEmissionWithoutJump(); }
void CodeGenerator::PrepareForDeoptimizationExits( void CodeGenerator::PrepareForDeoptimizationExits(
ZoneDeque<DeoptimizationExit*>* exits) {} ZoneDeque<DeoptimizationExit*>* exits) {}
......
...@@ -1293,8 +1293,8 @@ DEFINE_STRING(sim_arm64_optional_features, "none", ...@@ -1293,8 +1293,8 @@ DEFINE_STRING(sim_arm64_optional_features, "none",
"enable optional features on the simulator for testing: none or " "enable optional features on the simulator for testing: none or "
"all") "all")
DEFINE_BOOL(debug_riscv, false, "enable debug prints") DEFINE_BOOL(debug_riscv, false, "enable debug prints")
// TODO(RISCV): https://github.com/v8-riscv/v8/issues/330
DEFINE_BOOL(disable_riscv_constant_pool, true, DEFINE_BOOL(disable_riscv_constant_pool, false,
"disable constant pool (RISCV only)") "disable constant pool (RISCV only)")
// Controlling source positions for Torque/CSA code. // Controlling source positions for Torque/CSA code.
......
...@@ -325,9 +325,9 @@ void LiftoffAssembler::PatchPrepareStackFrame(int offset) { ...@@ -325,9 +325,9 @@ void LiftoffAssembler::PatchPrepareStackFrame(int offset) {
patching_assembler.Add64(sp, sp, Operand(-frame_size)); patching_assembler.Add64(sp, sp, Operand(-frame_size));
} }
void LiftoffAssembler::FinishCode() {} void LiftoffAssembler::FinishCode() { ForceConstantPoolEmissionWithoutJump(); }
void LiftoffAssembler::AbortCompilation() {} void LiftoffAssembler::AbortCompilation() { AbortedCodeGeneration(); }
// static // static
constexpr int LiftoffAssembler::StaticStackFrameSize() { constexpr int LiftoffAssembler::StaticStackFrameSize() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment