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

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

Issue 968773004: [turbofan] Use the typer to statically detect Smis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months 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/simplified-lowering.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 69d1d1ac79a40cbd3f55f836c64742b68a8219b7..88ce773216b4a5f3019cbb639a87b67dd7977e10 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1135,12 +1135,13 @@ Node* SimplifiedLowering::OffsetMinusTagConstant(int32_t offset) {
}
-WriteBarrierKind SimplifiedLowering::ComputeWriteBarrierKind(
- BaseTaggedness base_is_tagged, MachineType representation, Node* value) {
- // TODO(turbofan): skip write barriers for Smis, etc.
- if (machine()->Is64() && value->opcode() == IrOpcode::kChangeInt32ToTagged) {
- // TODO(bmeurer): Remove this hack once we have a way to represent "sminess"
- // of values, either in types or representations.
+namespace {
+
+WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
+ MachineType representation,
+ Type* type) {
+ if (type->Is(Type::TaggedSigned())) {
+ // Write barriers are only for writes of heap objects.
return kNoWriteBarrier;
}
if (base_is_tagged == kTaggedBase &&
@@ -1151,6 +1152,8 @@ WriteBarrierKind SimplifiedLowering::ComputeWriteBarrierKind(
return kNoWriteBarrier;
}
+} // namespace
+
void SimplifiedLowering::DoLoadField(Node* node) {
const FieldAccess& access = FieldAccessOf(node->op());
@@ -1162,8 +1165,9 @@ void SimplifiedLowering::DoLoadField(Node* node) {
void SimplifiedLowering::DoStoreField(Node* node) {
const FieldAccess& access = FieldAccessOf(node->op());
- WriteBarrierKind kind = ComputeWriteBarrierKind(
- access.base_is_tagged, access.machine_type, node->InputAt(1));
+ Type* type = NodeProperties::GetBounds(node->InputAt(1)).upper;
+ WriteBarrierKind kind =
+ ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type);
node->set_op(
machine()->Store(StoreRepresentation(access.machine_type, kind)));
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
@@ -1268,10 +1272,11 @@ void SimplifiedLowering::DoLoadElement(Node* node) {
void SimplifiedLowering::DoStoreElement(Node* node) {
const ElementAccess& access = ElementAccessOf(node->op());
- node->set_op(machine()->Store(StoreRepresentation(
- access.machine_type,
- ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type,
- node->InputAt(2)))));
+ Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper;
+ node->set_op(machine()->Store(
+ StoreRepresentation(access.machine_type,
+ ComputeWriteBarrierKind(access.base_is_tagged,
+ access.machine_type, type))));
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
}
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698