Introduce CodeAssembler::LoadRootsPointer
Loading external references from off-heap builtins will be root-pointer-relative. At least initially, these loads will happen in CSA and thus need access to the root pointer value. Bug: v8:6666 Change-Id: Iae4c89061df442f5afd03f93e5ba35c4e125b850 Reviewed-on: https://chromium-review.googlesource.com/970264 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#52069}
This commit is contained in:
parent
5b7854f008
commit
377803f804
@ -915,6 +915,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mov(i.OutputRegister(), fp);
|
__ mov(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ mov(i.OutputRegister(), kRootRegister);
|
||||||
|
DCHECK_EQ(LeaveCC, i.OutputSBit());
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
i.InputDoubleRegister(0));
|
i.InputDoubleRegister(0));
|
||||||
|
@ -839,6 +839,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mov(i.OutputRegister(), fp);
|
__ mov(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ mov(i.OutputRegister(), root);
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
i.InputDoubleRegister(0));
|
i.InputDoubleRegister(0));
|
||||||
|
@ -497,6 +497,10 @@ Node* CodeAssembler::LoadParentFramePointer() {
|
|||||||
return raw_assembler()->LoadParentFramePointer();
|
return raw_assembler()->LoadParentFramePointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TNode<IntPtrT> CodeAssembler::LoadRootsPointer() {
|
||||||
|
return UncheckedCast<IntPtrT>(raw_assembler()->LoadRootsPointer());
|
||||||
|
}
|
||||||
|
|
||||||
Node* CodeAssembler::LoadStackPointer() {
|
Node* CodeAssembler::LoadStackPointer() {
|
||||||
return raw_assembler()->LoadStackPointer();
|
return raw_assembler()->LoadStackPointer();
|
||||||
}
|
}
|
||||||
|
@ -734,6 +734,9 @@ class V8_EXPORT_PRIVATE CodeAssembler {
|
|||||||
Node* LoadFramePointer();
|
Node* LoadFramePointer();
|
||||||
Node* LoadParentFramePointer();
|
Node* LoadParentFramePointer();
|
||||||
|
|
||||||
|
// Access to the roots pointer.
|
||||||
|
TNode<IntPtrT> LoadRootsPointer();
|
||||||
|
|
||||||
// Access to the stack pointer
|
// Access to the stack pointer
|
||||||
Node* LoadStackPointer();
|
Node* LoadStackPointer();
|
||||||
|
|
||||||
|
@ -817,6 +817,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mov(i.OutputRegister(), ebp);
|
__ mov(i.OutputRegister(), ebp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
// TODO(jgruber,v8:6666): Implement ia32 support.
|
||||||
|
UNREACHABLE();
|
||||||
case kArchTruncateDoubleToI: {
|
case kArchTruncateDoubleToI: {
|
||||||
auto result = i.OutputRegister();
|
auto result = i.OutputRegister();
|
||||||
auto input = i.InputDoubleRegister(0);
|
auto input = i.InputDoubleRegister(0);
|
||||||
|
@ -66,6 +66,7 @@ enum class RecordWriteMode { kValueIsMap, kValueIsPointer, kValueIsAny };
|
|||||||
V(ArchStackPointer) \
|
V(ArchStackPointer) \
|
||||||
V(ArchFramePointer) \
|
V(ArchFramePointer) \
|
||||||
V(ArchParentFramePointer) \
|
V(ArchParentFramePointer) \
|
||||||
|
V(ArchRootsPointer) \
|
||||||
V(ArchTruncateDoubleToI) \
|
V(ArchTruncateDoubleToI) \
|
||||||
V(ArchStoreWithWriteBarrier) \
|
V(ArchStoreWithWriteBarrier) \
|
||||||
V(ArchStackSlot) \
|
V(ArchStackSlot) \
|
||||||
|
@ -247,6 +247,7 @@ int InstructionScheduler::GetInstructionFlags(const Instruction* instr) const {
|
|||||||
case kArchNop:
|
case kArchNop:
|
||||||
case kArchFramePointer:
|
case kArchFramePointer:
|
||||||
case kArchParentFramePointer:
|
case kArchParentFramePointer:
|
||||||
|
case kArchRootsPointer:
|
||||||
case kArchStackSlot: // Despite its name this opcode will produce a
|
case kArchStackSlot: // Despite its name this opcode will produce a
|
||||||
// reference to a frame slot, so it is not affected
|
// reference to a frame slot, so it is not affected
|
||||||
// by the arm64 dual stack issues mentioned below.
|
// by the arm64 dual stack issues mentioned below.
|
||||||
|
@ -1629,6 +1629,8 @@ void InstructionSelector::VisitNode(Node* node) {
|
|||||||
return VisitLoadFramePointer(node);
|
return VisitLoadFramePointer(node);
|
||||||
case IrOpcode::kLoadParentFramePointer:
|
case IrOpcode::kLoadParentFramePointer:
|
||||||
return VisitLoadParentFramePointer(node);
|
return VisitLoadParentFramePointer(node);
|
||||||
|
case IrOpcode::kLoadRootsPointer:
|
||||||
|
return VisitLoadRootsPointer(node);
|
||||||
case IrOpcode::kUnalignedLoad: {
|
case IrOpcode::kUnalignedLoad: {
|
||||||
LoadRepresentation type = LoadRepresentationOf(node->op());
|
LoadRepresentation type = LoadRepresentationOf(node->op());
|
||||||
MarkAsRepresentation(type.representation(), node);
|
MarkAsRepresentation(type.representation(), node);
|
||||||
@ -1970,6 +1972,11 @@ void InstructionSelector::VisitLoadParentFramePointer(Node* node) {
|
|||||||
Emit(kArchParentFramePointer, g.DefineAsRegister(node));
|
Emit(kArchParentFramePointer, g.DefineAsRegister(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstructionSelector::VisitLoadRootsPointer(Node* node) {
|
||||||
|
OperandGenerator g(this);
|
||||||
|
Emit(kArchRootsPointer, g.DefineAsRegister(node));
|
||||||
|
}
|
||||||
|
|
||||||
void InstructionSelector::VisitFloat64Acos(Node* node) {
|
void InstructionSelector::VisitFloat64Acos(Node* node) {
|
||||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Acos);
|
VisitFloat64Ieee754Unop(node, kIeee754Float64Acos);
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,7 @@ class MachineRepresentationInferrer {
|
|||||||
case IrOpcode::kLoadStackPointer:
|
case IrOpcode::kLoadStackPointer:
|
||||||
case IrOpcode::kLoadFramePointer:
|
case IrOpcode::kLoadFramePointer:
|
||||||
case IrOpcode::kLoadParentFramePointer:
|
case IrOpcode::kLoadParentFramePointer:
|
||||||
|
case IrOpcode::kLoadRootsPointer:
|
||||||
case IrOpcode::kSpeculationPoison:
|
case IrOpcode::kSpeculationPoison:
|
||||||
representation_vector_[node->id()] =
|
representation_vector_[node->id()] =
|
||||||
MachineType::PointerRepresentation();
|
MachineType::PointerRepresentation();
|
||||||
|
@ -225,6 +225,7 @@ MachineType AtomicOpRepresentationOf(Operator const* op) {
|
|||||||
V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \
|
V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) \
|
||||||
V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \
|
V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1) \
|
||||||
V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \
|
V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1) \
|
||||||
|
V(LoadRootsPointer, Operator::kNoProperties, 0, 0, 1) \
|
||||||
V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \
|
V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2) \
|
||||||
V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \
|
V(Int32PairSub, Operator::kNoProperties, 4, 0, 2) \
|
||||||
V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \
|
V(Int32PairMul, Operator::kNoProperties, 4, 0, 2) \
|
||||||
|
@ -605,6 +605,9 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final
|
|||||||
const Operator* LoadFramePointer();
|
const Operator* LoadFramePointer();
|
||||||
const Operator* LoadParentFramePointer();
|
const Operator* LoadParentFramePointer();
|
||||||
|
|
||||||
|
// Access to the root register.
|
||||||
|
const Operator* LoadRootsPointer();
|
||||||
|
|
||||||
// atomic-load [base + index]
|
// atomic-load [base + index]
|
||||||
const Operator* Word32AtomicLoad(LoadRepresentation rep);
|
const Operator* Word32AtomicLoad(LoadRepresentation rep);
|
||||||
// atomic-store [base + index], value
|
// atomic-store [base + index], value
|
||||||
|
@ -872,6 +872,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mov(i.OutputRegister(), fp);
|
__ mov(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ mov(i.OutputRegister(), kRootRegister);
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
i.InputDoubleRegister(0));
|
i.InputDoubleRegister(0));
|
||||||
|
@ -896,6 +896,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mov(i.OutputRegister(), fp);
|
__ mov(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ mov(i.OutputRegister(), kRootRegister);
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
i.InputDoubleRegister(0));
|
i.InputDoubleRegister(0));
|
||||||
|
@ -613,6 +613,7 @@
|
|||||||
V(LoadStackPointer) \
|
V(LoadStackPointer) \
|
||||||
V(LoadFramePointer) \
|
V(LoadFramePointer) \
|
||||||
V(LoadParentFramePointer) \
|
V(LoadParentFramePointer) \
|
||||||
|
V(LoadRootsPointer) \
|
||||||
V(UnalignedLoad) \
|
V(UnalignedLoad) \
|
||||||
V(UnalignedStore) \
|
V(UnalignedStore) \
|
||||||
V(Int32PairAdd) \
|
V(Int32PairAdd) \
|
||||||
|
@ -1102,6 +1102,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ mr(i.OutputRegister(), fp);
|
__ mr(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ mr(i.OutputRegister(), kRootRegister);
|
||||||
|
DCHECK_EQ(LeaveRC, i.OutputRCBit());
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
// TODO(mbrandy): move slow call to stub out of line.
|
// TODO(mbrandy): move slow call to stub out of line.
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
|
@ -723,6 +723,9 @@ class V8_EXPORT_PRIVATE RawMachineAssembler {
|
|||||||
return AddNode(machine()->LoadParentFramePointer());
|
return AddNode(machine()->LoadParentFramePointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Root pointer operations.
|
||||||
|
Node* LoadRootsPointer() { return AddNode(machine()->LoadRootsPointer()); }
|
||||||
|
|
||||||
// Parameters.
|
// Parameters.
|
||||||
Node* Parameter(size_t index);
|
Node* Parameter(size_t index);
|
||||||
|
|
||||||
|
@ -1325,6 +1325,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ LoadRR(i.OutputRegister(), fp);
|
__ LoadRR(i.OutputRegister(), fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchFramePointer:
|
||||||
|
__ LoadRR(i.OutputRegister(), kRootRegister);
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI:
|
case kArchTruncateDoubleToI:
|
||||||
// TODO(mbrandy): move slow call to stub out of line.
|
// TODO(mbrandy): move slow call to stub out of line.
|
||||||
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
__ TruncateDoubleToIDelayed(zone(), i.OutputRegister(),
|
||||||
|
@ -1681,6 +1681,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
|
|||||||
case IrOpcode::kLoadStackPointer:
|
case IrOpcode::kLoadStackPointer:
|
||||||
case IrOpcode::kLoadFramePointer:
|
case IrOpcode::kLoadFramePointer:
|
||||||
case IrOpcode::kLoadParentFramePointer:
|
case IrOpcode::kLoadParentFramePointer:
|
||||||
|
case IrOpcode::kLoadRootsPointer:
|
||||||
case IrOpcode::kUnalignedLoad:
|
case IrOpcode::kUnalignedLoad:
|
||||||
case IrOpcode::kUnalignedStore:
|
case IrOpcode::kUnalignedStore:
|
||||||
case IrOpcode::kWord32AtomicLoad:
|
case IrOpcode::kWord32AtomicLoad:
|
||||||
|
@ -884,6 +884,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
__ movq(i.OutputRegister(), rbp);
|
__ movq(i.OutputRegister(), rbp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kArchRootsPointer:
|
||||||
|
__ movq(i.OutputRegister(), kRootRegister);
|
||||||
|
break;
|
||||||
case kArchTruncateDoubleToI: {
|
case kArchTruncateDoubleToI: {
|
||||||
auto result = i.OutputRegister();
|
auto result = i.OutputRegister();
|
||||||
auto input = i.InputDoubleRegister(0);
|
auto input = i.InputDoubleRegister(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user