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

Unified Diff: src/compiler/escape-analysis.cc

Issue 2008883002: [turbofan] Fix escape analysis of sub-word element access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/escape-analysis.cc
diff --git a/src/compiler/escape-analysis.cc b/src/compiler/escape-analysis.cc
index b8a9188701fcb4bf832795d760a0a4be968e41a3..9409a271daaffb7bbd87caa73c6684022a550bc8 100644
--- a/src/compiler/escape-analysis.cc
+++ b/src/compiler/escape-analysis.cc
@@ -1388,11 +1388,9 @@ void EscapeAnalysis::ProcessLoadField(Node* node) {
Node* from = ResolveReplacement(NodeProperties::GetValueInput(node, 0));
VirtualState* state = virtual_states_[node->id()];
if (VirtualObject* object = GetVirtualObject(state, from)) {
+ if (!object->IsTracked()) return;
int offset = OffsetForFieldAccess(node);
- if (!object->IsTracked() ||
- static_cast<size_t>(offset) >= object->field_count()) {
- return;
- }
+ if (static_cast<size_t>(offset) >= object->field_count()) return;
Node* value = object->GetField(offset);
if (value) {
value = ResolveReplacement(value);
@@ -1422,11 +1420,9 @@ void EscapeAnalysis::ProcessLoadElement(Node* node) {
index_node->opcode() != IrOpcode::kFloat64Constant);
if (index.HasValue()) {
if (VirtualObject* object = GetVirtualObject(state, from)) {
+ if (!object->IsTracked()) return;
int offset = OffsetForElementAccess(node, index.Value());
- if (!object->IsTracked() ||
- static_cast<size_t>(offset) >= object->field_count()) {
- return;
- }
+ if (static_cast<size_t>(offset) >= object->field_count()) return;
Node* value = object->GetField(offset);
if (value) {
value = ResolveReplacement(value);
@@ -1456,10 +1452,10 @@ void EscapeAnalysis::ProcessStoreField(Node* node) {
ForwardVirtualState(node);
Node* to = ResolveReplacement(NodeProperties::GetValueInput(node, 0));
VirtualState* state = virtual_states_[node->id()];
- VirtualObject* obj = GetVirtualObject(state, to);
- int offset = OffsetForFieldAccess(node);
- if (obj && obj->IsTracked() &&
- static_cast<size_t>(offset) < obj->field_count()) {
+ if (VirtualObject* object = GetVirtualObject(state, to)) {
+ if (!object->IsTracked()) return;
+ int offset = OffsetForFieldAccess(node);
+ if (static_cast<size_t>(offset) >= object->field_count()) return;
Node* val = ResolveReplacement(NodeProperties::GetValueInput(node, 1));
// TODO(mstarzinger): The following is a workaround to not track the code
// entry field in virtual JSFunction objects. We only ever store the inner
@@ -1470,9 +1466,9 @@ void EscapeAnalysis::ProcessStoreField(Node* node) {
DCHECK_EQ(JSFunction::kCodeEntryOffset, FieldAccessOf(node->op()).offset);
val = slot_not_analyzed_;
}
- if (obj->GetField(offset) != val) {
- obj = CopyForModificationAt(obj, state, node);
- obj->SetField(offset, val);
+ if (object->GetField(offset) != val) {
+ object = CopyForModificationAt(object, state, node);
+ object->SetField(offset, val);
}
}
}
@@ -1488,15 +1484,15 @@ void EscapeAnalysis::ProcessStoreElement(Node* node) {
index_node->opcode() != IrOpcode::kFloat32Constant &&
index_node->opcode() != IrOpcode::kFloat64Constant);
VirtualState* state = virtual_states_[node->id()];
- VirtualObject* obj = GetVirtualObject(state, to);
if (index.HasValue()) {
- int offset = OffsetForElementAccess(node, index.Value());
- if (obj && obj->IsTracked() &&
- static_cast<size_t>(offset) < obj->field_count()) {
+ if (VirtualObject* object = GetVirtualObject(state, to)) {
+ if (!object->IsTracked()) return;
+ int offset = OffsetForElementAccess(node, index.Value());
+ if (static_cast<size_t>(offset) >= object->field_count()) return;
Node* val = ResolveReplacement(NodeProperties::GetValueInput(node, 2));
- if (obj->GetField(offset) != val) {
- obj = CopyForModificationAt(obj, state, node);
- obj->SetField(offset, val);
+ if (object->GetField(offset) != val) {
+ object = CopyForModificationAt(object, state, node);
+ object->SetField(offset, val);
}
}
} else {
@@ -1508,12 +1504,13 @@ void EscapeAnalysis::ProcessStoreElement(Node* node) {
to->id(), to->op()->mnemonic(), node->id(), index_node->id(),
index_node->op()->mnemonic());
}
- if (obj && obj->IsTracked()) {
- if (!obj->AllFieldsClear()) {
- obj = CopyForModificationAt(obj, state, node);
- obj->ClearAllFields();
+ if (VirtualObject* object = GetVirtualObject(state, to)) {
+ if (!object->IsTracked()) return;
+ if (!object->AllFieldsClear()) {
+ object = CopyForModificationAt(object, state, node);
+ object->ClearAllFields();
TRACE("Cleared all fields of @%d:#%d\n",
- status_analysis_->GetAlias(obj->id()), obj->id());
+ status_analysis_->GetAlias(object->id()), object->id());
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698