OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/escape-analysis.h" | 5 #include "src/compiler/escape-analysis.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1334 if (IsEquivalentPhi(left, right)) { | 1334 if (IsEquivalentPhi(left, right)) { |
1335 return true; | 1335 return true; |
1336 } | 1336 } |
1337 return false; | 1337 return false; |
1338 } | 1338 } |
1339 | 1339 |
1340 namespace { | 1340 namespace { |
1341 | 1341 |
1342 int OffsetForFieldAccess(Node* node) { | 1342 int OffsetForFieldAccess(Node* node) { |
1343 FieldAccess access = FieldAccessOf(node->op()); | 1343 FieldAccess access = FieldAccessOf(node->op()); |
1344 #if V8_TARGET_LITTLE_ENDIAN | |
1344 DCHECK_EQ(access.offset % kPointerSize, 0); | 1345 DCHECK_EQ(access.offset % kPointerSize, 0); |
1346 #else | |
1347 DCHECK_EQ((access.offset + | |
1348 (1 << ElementSizeLog2Of(access.machine_type.representation()))) % | |
1349 kPointerSize, | |
1350 0); | |
1351 #endif | |
1345 return access.offset / kPointerSize; | 1352 return access.offset / kPointerSize; |
1346 } | 1353 } |
1347 | 1354 |
1348 int OffsetForElementAccess(Node* node, int index) { | 1355 int OffsetForElementAccess(Node* node, int index) { |
1349 ElementAccess access = ElementAccessOf(node->op()); | 1356 ElementAccess access = ElementAccessOf(node->op()); |
1350 DCHECK_GE(ElementSizeLog2Of(access.machine_type.representation()), | 1357 DCHECK_GE(ElementSizeLog2Of(access.machine_type.representation()), |
1351 kPointerSizeLog2); | 1358 kPointerSizeLog2); |
1352 DCHECK_EQ(access.header_size % kPointerSize, 0); | 1359 DCHECK_EQ(access.header_size % kPointerSize, 0); |
1353 return access.header_size / kPointerSize + index; | 1360 return access.header_size / kPointerSize + index; |
1354 } | 1361 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1400 if (!object->IsTracked()) return; | 1407 if (!object->IsTracked()) return; |
1401 int offset = OffsetForFieldAccess(node); | 1408 int offset = OffsetForFieldAccess(node); |
1402 if (static_cast<size_t>(offset) >= object->field_count()) return; | 1409 if (static_cast<size_t>(offset) >= object->field_count()) return; |
1403 Node* value = object->GetField(offset); | 1410 Node* value = object->GetField(offset); |
1404 if (value) { | 1411 if (value) { |
1405 value = ResolveReplacement(value); | 1412 value = ResolveReplacement(value); |
1406 } | 1413 } |
1407 // Record that the load has this alias. | 1414 // Record that the load has this alias. |
1408 UpdateReplacement(state, node, value); | 1415 UpdateReplacement(state, node, value); |
1409 } else if (from->opcode() == IrOpcode::kPhi && | 1416 } else if (from->opcode() == IrOpcode::kPhi && |
1410 FieldAccessOf(node->op()).offset % kPointerSize == 0) { | 1417 FieldAccessOf(node->op()).offset % kPointerSize == 0) { |
Michael Starzinger
2016/11/03 14:29:55
It seems this implies that the above predicate fai
ivica.bogosavljevic
2016/11/03 15:47:30
This is certainly true, but no tests are failing b
| |
1411 int offset = OffsetForFieldAccess(node); | 1418 int offset = OffsetForFieldAccess(node); |
1412 // Only binary phis are supported for now. | 1419 // Only binary phis are supported for now. |
1413 ProcessLoadFromPhi(offset, from, node, state); | 1420 ProcessLoadFromPhi(offset, from, node, state); |
1414 } else { | 1421 } else { |
1415 UpdateReplacement(state, node, nullptr); | 1422 UpdateReplacement(state, node, nullptr); |
1416 } | 1423 } |
1417 } | 1424 } |
1418 | 1425 |
1419 void EscapeAnalysis::ProcessLoadElement(Node* node) { | 1426 void EscapeAnalysis::ProcessLoadElement(Node* node) { |
1420 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); | 1427 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1636 } | 1643 } |
1637 } | 1644 } |
1638 return false; | 1645 return false; |
1639 } | 1646 } |
1640 | 1647 |
1641 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1648 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
1642 | 1649 |
1643 } // namespace compiler | 1650 } // namespace compiler |
1644 } // namespace internal | 1651 } // namespace internal |
1645 } // namespace v8 | 1652 } // namespace v8 |
OLD | NEW |