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

Side by Side Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 2033703002: [compiler] Deal with some old TODOs in the typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: another one Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/compiler/typer.cc ('k') | test/unittests/compiler/simplified-operator-reducer-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <limits> 5 #include <limits>
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/effect-control-linearizer.h" 10 #include "src/compiler/effect-control-linearizer.h"
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 CheckChangeInsertion(IrOpcode::kTruncateFloat64ToWord32, 1160 CheckChangeInsertion(IrOpcode::kTruncateFloat64ToWord32,
1161 MachineType::Float64(), MachineType::Uint32(), 1161 MachineType::Float64(), MachineType::Uint32(),
1162 Type::Integral32()); 1162 Type::Integral32());
1163 CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, MachineType::AnyTagged(), 1163 CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, MachineType::AnyTagged(),
1164 MachineType::Int32(), Type::Signed32()); 1164 MachineType::Int32(), Type::Signed32());
1165 CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32, 1165 CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32,
1166 MachineType::AnyTagged(), MachineType::Uint32(), 1166 MachineType::AnyTagged(), MachineType::Uint32(),
1167 Type::Unsigned32()); 1167 Type::Unsigned32());
1168 1168
1169 CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, MachineType::Float64(), 1169 CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, MachineType::Float64(),
1170 MachineType::AnyTagged()); 1170 MachineType::AnyTagged(), Type::Number());
1171 CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, 1171 CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64,
1172 MachineType::AnyTagged(), MachineType::Float64(), 1172 MachineType::AnyTagged(), MachineType::Float64(),
1173 Type::Number()); 1173 Type::Number());
1174 1174
1175 CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, MachineType::Int32(), 1175 CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, MachineType::Int32(),
1176 MachineType::Float64(), Type::Signed32()); 1176 MachineType::Float64(), Type::Signed32());
1177 CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, MachineType::Int32(), 1177 CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, MachineType::Int32(),
1178 MachineType::AnyTagged(), Type::Signed32()); 1178 MachineType::AnyTagged(), Type::Signed32());
1179 1179
1180 CheckChangeInsertion(IrOpcode::kChangeUint32ToFloat64, MachineType::Uint32(), 1180 CheckChangeInsertion(IrOpcode::kChangeUint32ToFloat64, MachineType::Uint32(),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 TestingGraph t(Type::Number(), Type::Number()); 1251 TestingGraph t(Type::Number(), Type::Number());
1252 1252
1253 const Operator* ops[] = { 1253 const Operator* ops[] = {
1254 t.machine()->Float64Add(), t.machine()->Float64Sub(), 1254 t.machine()->Float64Add(), t.machine()->Float64Sub(),
1255 t.machine()->Float64Mul(), t.machine()->Float64Div(), 1255 t.machine()->Float64Mul(), t.machine()->Float64Div(),
1256 t.machine()->Float64Mod(), 1256 t.machine()->Float64Mod(),
1257 }; 1257 };
1258 1258
1259 for (size_t i = 0; i < arraysize(ops); i++) { 1259 for (size_t i = 0; i < arraysize(ops); i++) {
1260 CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64, 1260 CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64,
1261 IrOpcode::kChangeFloat64ToTagged); 1261 IrOpcode::kChangeFloat64ToTagged, Type::Number());
1262 } 1262 }
1263 } 1263 }
1264 1264
1265 1265
1266 TEST(InsertChangesAroundFloat64Cmp) { 1266 TEST(InsertChangesAroundFloat64Cmp) {
1267 TestingGraph t(Type::Number(), Type::Number()); 1267 TestingGraph t(Type::Number(), Type::Number());
1268 1268
1269 const Operator* ops[] = {t.machine()->Float64Equal(), 1269 const Operator* ops[] = {t.machine()->Float64Equal(),
1270 t.machine()->Float64LessThan(), 1270 t.machine()->Float64LessThan(),
1271 t.machine()->Float64LessThanOrEqual()}; 1271 t.machine()->Float64LessThanOrEqual()};
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 t.Lower(); 1481 t.Lower();
1482 CHECK_EQ(IrOpcode::kStoreElement, store->opcode()); 1482 CHECK_EQ(IrOpcode::kStoreElement, store->opcode());
1483 CHECK_EQ(t.p0, store->InputAt(0)); 1483 CHECK_EQ(t.p0, store->InputAt(0));
1484 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, store->InputAt(1)); 1484 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, store->InputAt(1));
1485 } 1485 }
1486 1486
1487 1487
1488 TEST(InsertChangeForLoadElement) { 1488 TEST(InsertChangeForLoadElement) {
1489 // TODO(titzer): test all load/store representation change insertions. 1489 // TODO(titzer): test all load/store representation change insertions.
1490 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); 1490 TestingGraph t(Type::Any(), Type::Signed32(), Type::Any());
1491 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), 1491 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
1492 MachineType::Float64(), kNoWriteBarrier}; 1492 Type::Number(), MachineType::Float64(),
1493 kNoWriteBarrier};
1493 1494
1494 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, 1495 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
1495 t.p1, t.start, t.start); 1496 t.p1, t.start, t.start);
1496 t.Return(load); 1497 t.Return(load);
1497 t.Lower(); 1498 t.Lower();
1498 CHECK_EQ(IrOpcode::kLoadElement, load->opcode()); 1499 CHECK_EQ(IrOpcode::kLoadElement, load->opcode());
1499 CHECK_EQ(t.p0, load->InputAt(0)); 1500 CHECK_EQ(t.p0, load->InputAt(0));
1500 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); 1501 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0));
1501 } 1502 }
1502 1503
1503 1504
1504 TEST(InsertChangeForLoadField) { 1505 TEST(InsertChangeForLoadField) {
1505 // TODO(titzer): test all load/store representation change insertions. 1506 // TODO(titzer): test all load/store representation change insertions.
1506 TestingGraph t(Type::Any(), Type::Signed32()); 1507 TestingGraph t(Type::Any(), Type::Signed32());
1507 FieldAccess access = { 1508 FieldAccess access = {
1508 kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), 1509 kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
1509 Type::Any(), MachineType::Float64(), kNoWriteBarrier}; 1510 Type::Number(), MachineType::Float64(), kNoWriteBarrier};
1510 1511
1511 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, 1512 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0,
1512 t.start, t.start); 1513 t.start, t.start);
1513 t.Return(load); 1514 t.Return(load);
1514 t.Lower(); 1515 t.Lower();
1515 CHECK_EQ(IrOpcode::kLoadField, load->opcode()); 1516 CHECK_EQ(IrOpcode::kLoadField, load->opcode());
1516 CHECK_EQ(t.p0, load->InputAt(0)); 1517 CHECK_EQ(t.p0, load->InputAt(0));
1517 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); 1518 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0));
1518 } 1519 }
1519 1520
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 t.Return(use); 1951 t.Return(use);
1951 t.Lower(); 1952 t.Lower();
1952 1953
1953 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); 1954 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op()));
1954 } 1955 }
1955 } 1956 }
1956 1957
1957 } // namespace compiler 1958 } // namespace compiler
1958 } // namespace internal 1959 } // namespace internal
1959 } // namespace v8 1960 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/typer.cc ('k') | test/unittests/compiler/simplified-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698