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

Unified 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 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 a190a5adc0ecb14cf0c0996765be9a16ee050990..3d0776065ce761ba4609047cb9ed12004ee55d5e 100644
--- a/src/compiler/escape-analysis.cc
+++ b/src/compiler/escape-analysis.cc
@@ -1339,9 +1339,19 @@ bool EscapeAnalysis::CompareVirtualObjects(Node* left, Node* right) {
namespace {
+bool IsOffsetForFieldAccessCorrect(const FieldAccess& access) {
+#if V8_TARGET_LITTLE_ENDIAN
+ return (access.offset % kPointerSize) == 0;
+#else
+ return ((access.offset +
+ (1 << ElementSizeLog2Of(access.machine_type.representation()))) %
+ kPointerSize) == 0;
+#endif
+}
+
int OffsetForFieldAccess(Node* node) {
FieldAccess access = FieldAccessOf(node->op());
- DCHECK_EQ(access.offset % kPointerSize, 0);
+ DCHECK(IsOffsetForFieldAccessCorrect(access));
return access.offset / kPointerSize;
}
@@ -1407,7 +1417,7 @@ void EscapeAnalysis::ProcessLoadField(Node* node) {
// Record that the load has this alias.
UpdateReplacement(state, node, value);
} else if (from->opcode() == IrOpcode::kPhi &&
- FieldAccessOf(node->op()).offset % kPointerSize == 0) {
+ IsOffsetForFieldAccessCorrect(FieldAccessOf(node->op()))) {
int offset = OffsetForFieldAccess(node);
// Only binary phis are supported for now.
ProcessLoadFromPhi(offset, from, node, state);
« 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