Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(871)

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2494753003: [turbofan] Introduce an ExternalPointer type. (Closed)
Patch Set: Stronger ducktape. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index ca3ed1f75909630d9ae5f3a7757ad90c181f9203..a2b67db13bf04862ca2daaa571b233d395f8996b 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -858,26 +858,8 @@ class RepresentationSelector {
return MachineRepresentation::kTagged;
} else if (type->Is(Type::Number())) {
return MachineRepresentation::kFloat64;
- } else if (type->Is(Type::Internal())) {
- // We mark (u)int64 as Type::Internal.
- // TODO(jarin) This is a workaround for our lack of (u)int64
- // types. This can be removed once we can represent (u)int64
- // unambiguously. (At the moment internal objects, such as the hole,
- // are also Type::Internal()).
- bool is_word64 = GetInfo(node->InputAt(0))->representation() ==
- MachineRepresentation::kWord64;
-#ifdef DEBUG
- if (node->opcode() != IrOpcode::kTypeGuard) {
- // Check that all the inputs agree on being Word64.
- DCHECK_EQ(IrOpcode::kPhi, node->opcode()); // This only works for phis.
- for (int i = 1; i < node->op()->ValueInputCount(); i++) {
- DCHECK_EQ(is_word64, GetInfo(node->InputAt(i))->representation() ==
- MachineRepresentation::kWord64);
- }
- }
-#endif
- return is_word64 ? MachineRepresentation::kWord64
- : MachineRepresentation::kTagged;
+ } else if (type->Is(Type::ExternalPointer())) {
+ return MachineType::PointerRepresentation();
}
return MachineRepresentation::kTagged;
}
@@ -1015,7 +997,15 @@ class RepresentationSelector {
void VisitObjectState(Node* node) {
if (propagate()) {
for (int i = 0; i < node->InputCount(); i++) {
- EnqueueInput(node, i, UseInfo::Any());
+ Node* input = node->InputAt(i);
+ Type* input_type = TypeOf(input);
+ // TODO(turbofan): Special treatment for ExternalPointer here,
+ // to avoid incompatible truncations. We really need a story
+ // for the JSFunction::entry field.
+ UseInfo use_info = input_type->Is(Type::ExternalPointer())
+ ? UseInfo::PointerInt()
+ : UseInfo::Any();
+ EnqueueInput(node, i, use_info);
}
} else if (lower()) {
Zone* zone = jsgraph_->zone();
@@ -1026,15 +1016,22 @@ class RepresentationSelector {
Node* input = node->InputAt(i);
NodeInfo* input_info = GetInfo(input);
Type* input_type = TypeOf(input);
- MachineRepresentation rep = input_type->IsInhabited()
- ? input_info->representation()
- : MachineRepresentation::kNone;
- MachineType machine_type(rep, DeoptValueSemanticOf(input_type));
- DCHECK(machine_type.representation() !=
- MachineRepresentation::kWord32 ||
- machine_type.semantic() == MachineSemantic::kInt32 ||
- machine_type.semantic() == MachineSemantic::kUint32);
- (*types)[i] = machine_type;
+ // TODO(turbofan): Special treatment for ExternalPointer here,
+ // to avoid incompatible truncations. We really need a story
+ // for the JSFunction::entry field.
+ if (input_type->Is(Type::ExternalPointer())) {
+ (*types)[i] = MachineType::Pointer();
+ } else {
+ MachineRepresentation rep = input_type->IsInhabited()
+ ? input_info->representation()
+ : MachineRepresentation::kNone;
+ MachineType machine_type(rep, DeoptValueSemanticOf(input_type));
+ DCHECK(machine_type.representation() !=
+ MachineRepresentation::kWord32 ||
+ machine_type.semantic() == MachineSemantic::kInt32 ||
+ machine_type.semantic() == MachineSemantic::kUint32);
+ (*types)[i] = machine_type;
+ }
}
NodeProperties::ChangeOp(node,
jsgraph_->common()->TypedObjectState(types));
@@ -1384,6 +1381,14 @@ class RepresentationSelector {
return VisitLeaf(node, MachineRepresentation::kTagged);
case IrOpcode::kHeapConstant:
return VisitLeaf(node, MachineRepresentation::kTaggedPointer);
+ case IrOpcode::kPointerConstant: {
+ VisitLeaf(node, MachineType::PointerRepresentation());
+ if (lower()) {
+ intptr_t const value = OpParameter<intptr_t>(node);
+ DeferReplacement(node, lowering->jsgraph()->IntPtrConstant(value));
+ }
+ return;
+ }
case IrOpcode::kBranch:
ProcessInput(node, 0, UseInfo::Bool());
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698