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

Side by Side Diff: src/compiler/escape-analysis.cc

Issue 2453333002: MIPS64: Fix VirtualObject field offset calculation on Big-endian architectures (Closed)
Patch Set: Address code reveiw remarks 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 left = ResolveReplacement(left); 1332 left = ResolveReplacement(left);
1333 right = ResolveReplacement(right); 1333 right = ResolveReplacement(right);
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 bool IsOffsetForFieldAccessCorrect(const FieldAccess& access) {
1343 #if V8_TARGET_LITTLE_ENDIAN
1344 return (access.offset % kPointerSize) == 0;
1345 #else
1346 return ((access.offset +
1347 (1 << ElementSizeLog2Of(access.machine_type.representation()))) %
1348 kPointerSize) == 0;
1349 #endif
1350 }
1351
1342 int OffsetForFieldAccess(Node* node) { 1352 int OffsetForFieldAccess(Node* node) {
1343 FieldAccess access = FieldAccessOf(node->op()); 1353 FieldAccess access = FieldAccessOf(node->op());
1344 DCHECK_EQ(access.offset % kPointerSize, 0); 1354 DCHECK(IsOffsetForFieldAccessCorrect(access));
1345 return access.offset / kPointerSize; 1355 return access.offset / kPointerSize;
1346 } 1356 }
1347 1357
1348 int OffsetForElementAccess(Node* node, int index) { 1358 int OffsetForElementAccess(Node* node, int index) {
1349 ElementAccess access = ElementAccessOf(node->op()); 1359 ElementAccess access = ElementAccessOf(node->op());
1350 DCHECK_GE(ElementSizeLog2Of(access.machine_type.representation()), 1360 DCHECK_GE(ElementSizeLog2Of(access.machine_type.representation()),
1351 kPointerSizeLog2); 1361 kPointerSizeLog2);
1352 DCHECK_EQ(access.header_size % kPointerSize, 0); 1362 DCHECK_EQ(access.header_size % kPointerSize, 0);
1353 return access.header_size / kPointerSize + index; 1363 return access.header_size / kPointerSize + index;
1354 } 1364 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 if (!object->IsTracked()) return; 1410 if (!object->IsTracked()) return;
1401 int offset = OffsetForFieldAccess(node); 1411 int offset = OffsetForFieldAccess(node);
1402 if (static_cast<size_t>(offset) >= object->field_count()) return; 1412 if (static_cast<size_t>(offset) >= object->field_count()) return;
1403 Node* value = object->GetField(offset); 1413 Node* value = object->GetField(offset);
1404 if (value) { 1414 if (value) {
1405 value = ResolveReplacement(value); 1415 value = ResolveReplacement(value);
1406 } 1416 }
1407 // Record that the load has this alias. 1417 // Record that the load has this alias.
1408 UpdateReplacement(state, node, value); 1418 UpdateReplacement(state, node, value);
1409 } else if (from->opcode() == IrOpcode::kPhi && 1419 } else if (from->opcode() == IrOpcode::kPhi &&
1410 FieldAccessOf(node->op()).offset % kPointerSize == 0) { 1420 IsOffsetForFieldAccessCorrect(FieldAccessOf(node->op()))) {
1411 int offset = OffsetForFieldAccess(node); 1421 int offset = OffsetForFieldAccess(node);
1412 // Only binary phis are supported for now. 1422 // Only binary phis are supported for now.
1413 ProcessLoadFromPhi(offset, from, node, state); 1423 ProcessLoadFromPhi(offset, from, node, state);
1414 } else { 1424 } else {
1415 UpdateReplacement(state, node, nullptr); 1425 UpdateReplacement(state, node, nullptr);
1416 } 1426 }
1417 } 1427 }
1418 1428
1419 void EscapeAnalysis::ProcessLoadElement(Node* node) { 1429 void EscapeAnalysis::ProcessLoadElement(Node* node) {
1420 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); 1430 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 } 1646 }
1637 } 1647 }
1638 return false; 1648 return false;
1639 } 1649 }
1640 1650
1641 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } 1651 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); }
1642 1652
1643 } // namespace compiler 1653 } // namespace compiler
1644 } // namespace internal 1654 } // namespace internal
1645 } // namespace v8 1655 } // namespace v8
OLDNEW
« 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