Commit c22737ab authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Make dangerous bitcasts effectful.

This makes the bitcasts that change pointerness effectful so that
they are not accidentally reordered with memory allocation.

Change-Id: I70e820fc0de1adb2a81b52a43bce4d47f2c304b9
Reviewed-on: https://chromium-review.googlesource.com/852052Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50374}
parent a97298ba
......@@ -169,6 +169,12 @@ Node* GraphAssembler::ToNumber(Node* value) {
value, NoContextConstant(), current_effect_);
}
Node* GraphAssembler::BitcastWordToTagged(Node* value) {
return current_effect_ =
graph()->NewNode(machine()->BitcastWordToTagged(), value,
current_effect_, current_control_);
}
Node* GraphAssembler::DeoptimizeIf(DeoptimizeReason reason,
VectorSlotPair const& feedback,
Node* condition, Node* frame_state) {
......
......@@ -29,8 +29,7 @@ namespace compiler {
V(RoundFloat64ToInt32) \
V(TruncateFloat64ToWord32) \
V(Float64ExtractHighWord32) \
V(Float64Abs) \
V(BitcastWordToTagged)
V(Float64Abs)
#define PURE_ASSEMBLER_MACH_BINOP_LIST(V) \
V(WordShl) \
......@@ -199,6 +198,7 @@ class GraphAssembler {
Node* Float64RoundDown(Node* value);
Node* ToNumber(Node* value);
Node* BitcastWordToTagged(Node* value);
Node* Allocate(PretenureFlag pretenure, Node* size);
Node* LoadField(FieldAccess const&, Node* object);
Node* LoadElement(ElementAccess const&, Node* object, Node* index);
......
......@@ -138,7 +138,6 @@ MachineType AtomicOpRepresentationOf(Operator const* op) {
PURE_BINARY_OP_LIST_64(V) \
V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \
V(Word64Clz, Operator::kNoProperties, 1, 0, 1) \
V(BitcastTaggedToWord, Operator::kNoProperties, 1, 0, 1) \
V(BitcastWordToTaggedSigned, Operator::kNoProperties, 1, 0, 1) \
V(TruncateFloat64ToWord32, Operator::kNoProperties, 1, 0, 1) \
V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
......@@ -614,10 +613,18 @@ struct MachineOperatorGlobalCache {
BitcastWordToTaggedOperator()
: Operator(IrOpcode::kBitcastWordToTagged,
Operator::kEliminatable | Operator::kNoWrite,
"BitcastWordToTagged", 1, 0, 0, 1, 0, 0) {}
"BitcastWordToTagged", 1, 1, 1, 1, 1, 0) {}
};
BitcastWordToTaggedOperator kBitcastWordToTagged;
struct BitcastTaggedToWordOperator : public Operator {
BitcastTaggedToWordOperator()
: Operator(IrOpcode::kBitcastTaggedToWord,
Operator::kEliminatable | Operator::kNoWrite,
"BitcastTaggedToWord", 1, 1, 1, 1, 1, 0) {}
};
BitcastTaggedToWordOperator kBitcastTaggedToWord;
struct DebugAbortOperator : public Operator {
DebugAbortOperator()
: Operator(IrOpcode::kDebugAbort, Operator::kNoThrow, "DebugAbort", 1,
......@@ -793,6 +800,10 @@ const Operator* MachineOperatorBuilder::BitcastWordToTagged() {
return &cache_.kBitcastWordToTagged;
}
const Operator* MachineOperatorBuilder::BitcastTaggedToWord() {
return &cache_.kBitcastTaggedToWord;
}
const Operator* MachineOperatorBuilder::DebugAbort() {
return &cache_.kDebugAbort;
}
......
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