| OLD | NEW |
| 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/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 | 94 |
| 95 // TODO(titzer): factor these tests out to test-run-simplifiedops.cc. | 95 // TODO(titzer): factor these tests out to test-run-simplifiedops.cc. |
| 96 // TODO(titzer): test tagged representation for input to NumberToInt32. | 96 // TODO(titzer): test tagged representation for input to NumberToInt32. |
| 97 TEST(RunNumberToInt32_float64) { | 97 TEST(RunNumberToInt32_float64) { |
| 98 // TODO(titzer): explicit load/stores here are only because of representations | 98 // TODO(titzer): explicit load/stores here are only because of representations |
| 99 double input; | 99 double input; |
| 100 int32_t result; | 100 int32_t result; |
| 101 SimplifiedLoweringTester<Object*> t; | 101 SimplifiedLoweringTester<Object*> t; |
| 102 FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(), | 102 FieldAccess load = {kUntaggedBase, 0, nullptr, Type::Number(), |
| 103 MachineType::Float64()}; | 103 MachineType::Float64()}; |
| 104 Node* loaded = t.LoadField(load, t.PointerConstant(&input)); | 104 Node* loaded = t.LoadField(load, t.PointerConstant(&input)); |
| 105 NodeProperties::SetType(loaded, Type::Number()); | 105 NodeProperties::SetType(loaded, Type::Number()); |
| 106 Node* convert = t.NumberToInt32(loaded); | 106 Node* convert = t.NumberToInt32(loaded); |
| 107 FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(), | 107 FieldAccess store = {kUntaggedBase, 0, nullptr, Type::Signed32(), |
| 108 MachineType::Int32()}; | 108 MachineType::Int32()}; |
| 109 t.StoreField(store, t.PointerConstant(&result), convert); | 109 t.StoreField(store, t.PointerConstant(&result), convert); |
| 110 t.Return(t.jsgraph.TrueConstant()); | 110 t.Return(t.jsgraph.TrueConstant()); |
| 111 t.LowerAllNodesAndLowerChanges(); | 111 t.LowerAllNodesAndLowerChanges(); |
| 112 t.GenerateCode(); | 112 t.GenerateCode(); |
| 113 | 113 |
| 114 FOR_FLOAT64_INPUTS(i) { | 114 FOR_FLOAT64_INPUTS(i) { |
| 115 input = *i; | 115 input = *i; |
| 116 int32_t expected = DoubleToInt32(*i); | 116 int32_t expected = DoubleToInt32(*i); |
| 117 t.Call(); | 117 t.Call(); |
| 118 CHECK_EQ(expected, result); | 118 CHECK_EQ(expected, result); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 // TODO(titzer): test tagged representation for input to NumberToUint32. | 123 // TODO(titzer): test tagged representation for input to NumberToUint32. |
| 124 TEST(RunNumberToUint32_float64) { | 124 TEST(RunNumberToUint32_float64) { |
| 125 // TODO(titzer): explicit load/stores here are only because of representations | 125 // TODO(titzer): explicit load/stores here are only because of representations |
| 126 double input; | 126 double input; |
| 127 uint32_t result; | 127 uint32_t result; |
| 128 SimplifiedLoweringTester<Object*> t; | 128 SimplifiedLoweringTester<Object*> t; |
| 129 FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(), | 129 FieldAccess load = {kUntaggedBase, 0, nullptr, Type::Number(), |
| 130 MachineType::Float64()}; | 130 MachineType::Float64()}; |
| 131 Node* loaded = t.LoadField(load, t.PointerConstant(&input)); | 131 Node* loaded = t.LoadField(load, t.PointerConstant(&input)); |
| 132 NodeProperties::SetType(loaded, Type::Number()); | 132 NodeProperties::SetType(loaded, Type::Number()); |
| 133 Node* convert = t.NumberToUint32(loaded); | 133 Node* convert = t.NumberToUint32(loaded); |
| 134 FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(), | 134 FieldAccess store = {kUntaggedBase, 0, nullptr, Type::Unsigned32(), |
| 135 MachineType::Uint32()}; | 135 MachineType::Uint32()}; |
| 136 t.StoreField(store, t.PointerConstant(&result), convert); | 136 t.StoreField(store, t.PointerConstant(&result), convert); |
| 137 t.Return(t.jsgraph.TrueConstant()); | 137 t.Return(t.jsgraph.TrueConstant()); |
| 138 t.LowerAllNodesAndLowerChanges(); | 138 t.LowerAllNodesAndLowerChanges(); |
| 139 t.GenerateCode(); | 139 t.GenerateCode(); |
| 140 | 140 |
| 141 FOR_FLOAT64_INPUTS(i) { | 141 FOR_FLOAT64_INPUTS(i) { |
| 142 input = *i; | 142 input = *i; |
| 143 uint32_t expected = DoubleToUint32(*i); | 143 uint32_t expected = DoubleToUint32(*i); |
| 144 t.Call(); | 144 t.Call(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 CHECK_EQ(data[i], expected); | 284 CHECK_EQ(data[i], expected); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 TEST(RunLoadFieldFromUntaggedBase) { | 289 TEST(RunLoadFieldFromUntaggedBase) { |
| 290 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; | 290 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; |
| 291 | 291 |
| 292 for (size_t i = 0; i < arraysize(smis); i++) { | 292 for (size_t i = 0; i < arraysize(smis); i++) { |
| 293 int offset = static_cast<int>(i * sizeof(Smi*)); | 293 int offset = static_cast<int>(i * sizeof(Smi*)); |
| 294 FieldAccess access = {kUntaggedBase, offset, Handle<Name>(), | 294 FieldAccess access = {kUntaggedBase, offset, nullptr, Type::Integral32(), |
| 295 Type::Integral32(), MachineType::AnyTagged()}; | 295 MachineType::AnyTagged()}; |
| 296 | 296 |
| 297 SimplifiedLoweringTester<Object*> t; | 297 SimplifiedLoweringTester<Object*> t; |
| 298 Node* load = t.LoadField(access, t.PointerConstant(smis)); | 298 Node* load = t.LoadField(access, t.PointerConstant(smis)); |
| 299 t.Return(load); | 299 t.Return(load); |
| 300 t.LowerAllNodesAndLowerChanges(); | 300 t.LowerAllNodesAndLowerChanges(); |
| 301 | 301 |
| 302 for (int j = -5; j <= 5; j++) { | 302 for (int j = -5; j <= 5; j++) { |
| 303 Smi* expected = Smi::FromInt(j); | 303 Smi* expected = Smi::FromInt(j); |
| 304 smis[i] = expected; | 304 smis[i] = expected; |
| 305 CHECK_EQ(expected, t.Call()); | 305 CHECK_EQ(expected, t.Call()); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 | 310 |
| 311 TEST(RunStoreFieldToUntaggedBase) { | 311 TEST(RunStoreFieldToUntaggedBase) { |
| 312 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; | 312 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; |
| 313 | 313 |
| 314 for (size_t i = 0; i < arraysize(smis); i++) { | 314 for (size_t i = 0; i < arraysize(smis); i++) { |
| 315 int offset = static_cast<int>(i * sizeof(Smi*)); | 315 int offset = static_cast<int>(i * sizeof(Smi*)); |
| 316 FieldAccess access = {kUntaggedBase, offset, Handle<Name>(), | 316 FieldAccess access = {kUntaggedBase, offset, nullptr, Type::Integral32(), |
| 317 Type::Integral32(), MachineType::AnyTagged()}; | 317 MachineType::AnyTagged()}; |
| 318 | 318 |
| 319 SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); | 319 SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); |
| 320 Node* p0 = t.Parameter(0); | 320 Node* p0 = t.Parameter(0); |
| 321 t.StoreField(access, t.PointerConstant(smis), p0); | 321 t.StoreField(access, t.PointerConstant(smis), p0); |
| 322 t.Return(p0); | 322 t.Return(p0); |
| 323 t.LowerAllNodesAndLowerChanges(); | 323 t.LowerAllNodesAndLowerChanges(); |
| 324 | 324 |
| 325 for (int j = -5; j <= 5; j++) { | 325 for (int j = -5; j <= 5; j++) { |
| 326 Smi* expected = Smi::FromInt(j); | 326 Smi* expected = Smi::FromInt(j); |
| 327 smis[i] = Smi::FromInt(-100); | 327 smis[i] = Smi::FromInt(-100); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, | 519 ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, |
| 520 tagged ? FixedArrayBase::kHeaderSize : 0, | 520 tagged ? FixedArrayBase::kHeaderSize : 0, |
| 521 Type::Any(), rep}; | 521 Type::Any(), rep}; |
| 522 return access; | 522 return access; |
| 523 } | 523 } |
| 524 | 524 |
| 525 FieldAccess GetFieldAccess(int field) { | 525 FieldAccess GetFieldAccess(int field) { |
| 526 int offset = field * sizeof(E); | 526 int offset = field * sizeof(E); |
| 527 FieldAccess access = {tagged ? kTaggedBase : kUntaggedBase, | 527 FieldAccess access = {tagged ? kTaggedBase : kUntaggedBase, |
| 528 offset + (tagged ? FixedArrayBase::kHeaderSize : 0), | 528 offset + (tagged ? FixedArrayBase::kHeaderSize : 0), |
| 529 Handle<Name>(), Type::Any(), rep}; | 529 nullptr, Type::Any(), rep}; |
| 530 return access; | 530 return access; |
| 531 } | 531 } |
| 532 | 532 |
| 533 template <typename T> | 533 template <typename T> |
| 534 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { | 534 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { |
| 535 return tagged ? t->HeapConstant(tagged_array) | 535 return tagged ? t->HeapConstant(tagged_array) |
| 536 : t->PointerConstant(untagged_array); | 536 : t->PointerConstant(untagged_array); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void BoundsCheck(int index) { | 539 void BoundsCheck(int index) { |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(), | 1328 MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(), |
| 1329 MachineType::AnyTagged()}; | 1329 MachineType::AnyTagged()}; |
| 1330 | 1330 |
| 1331 } // namespace | 1331 } // namespace |
| 1332 | 1332 |
| 1333 | 1333 |
| 1334 TEST(LowerLoadField_to_load) { | 1334 TEST(LowerLoadField_to_load) { |
| 1335 TestingGraph t(Type::Any(), Type::Signed32()); | 1335 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1336 | 1336 |
| 1337 for (size_t i = 0; i < arraysize(kMachineReps); i++) { | 1337 for (size_t i = 0; i < arraysize(kMachineReps); i++) { |
| 1338 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1338 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1339 Handle<Name>::null(), Type::Any(), kMachineReps[i]}; | 1339 Type::Any(), kMachineReps[i]}; |
| 1340 | 1340 |
| 1341 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, | 1341 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, |
| 1342 t.start, t.start); | 1342 t.start, t.start); |
| 1343 Node* use = t.Use(load, kMachineReps[i]); | 1343 Node* use = t.Use(load, kMachineReps[i]); |
| 1344 t.Return(use); | 1344 t.Return(use); |
| 1345 t.LowerAllNodesAndLowerChanges(); | 1345 t.LowerAllNodesAndLowerChanges(); |
| 1346 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1346 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
| 1347 CHECK_EQ(t.p0, load->InputAt(0)); | 1347 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1348 CheckFieldAccessArithmetic(access, load); | 1348 CheckFieldAccessArithmetic(access, load); |
| 1349 | 1349 |
| 1350 MachineType rep = LoadRepresentationOf(load->op()); | 1350 MachineType rep = LoadRepresentationOf(load->op()); |
| 1351 CHECK_EQ(kMachineReps[i], rep); | 1351 CHECK_EQ(kMachineReps[i], rep); |
| 1352 } | 1352 } |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 | 1355 |
| 1356 TEST(LowerStoreField_to_store) { | 1356 TEST(LowerStoreField_to_store) { |
| 1357 { | 1357 { |
| 1358 TestingGraph t(Type::Any(), Type::Signed32()); | 1358 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1359 | 1359 |
| 1360 for (size_t i = 0; i < arraysize(kMachineReps); i++) { | 1360 for (size_t i = 0; i < arraysize(kMachineReps); i++) { |
| 1361 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1361 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1362 Handle<Name>::null(), Type::Any(), kMachineReps[i]}; | 1362 Type::Any(), kMachineReps[i]}; |
| 1363 | 1363 |
| 1364 | 1364 |
| 1365 Node* val = t.ExampleWithOutput(kMachineReps[i]); | 1365 Node* val = t.ExampleWithOutput(kMachineReps[i]); |
| 1366 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1366 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1367 val, t.start, t.start); | 1367 val, t.start, t.start); |
| 1368 t.Effect(store); | 1368 t.Effect(store); |
| 1369 t.LowerAllNodesAndLowerChanges(); | 1369 t.LowerAllNodesAndLowerChanges(); |
| 1370 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1370 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1371 CHECK_EQ(val, store->InputAt(2)); | 1371 CHECK_EQ(val, store->InputAt(2)); |
| 1372 CheckFieldAccessArithmetic(access, store); | 1372 CheckFieldAccessArithmetic(access, store); |
| 1373 | 1373 |
| 1374 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); | 1374 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); |
| 1375 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { | 1375 if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { |
| 1376 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1376 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); |
| 1377 } | 1377 } |
| 1378 CHECK_EQ(kMachineReps[i], rep.machine_type()); | 1378 CHECK_EQ(kMachineReps[i], rep.machine_type()); |
| 1379 } | 1379 } |
| 1380 } | 1380 } |
| 1381 { | 1381 { |
| 1382 HandleAndZoneScope scope; | 1382 HandleAndZoneScope scope; |
| 1383 Zone* z = scope.main_zone(); | 1383 Zone* z = scope.main_zone(); |
| 1384 TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), | 1384 TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), |
| 1385 Type::TaggedSigned(), z)); | 1385 Type::TaggedSigned(), z)); |
| 1386 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1386 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1387 Handle<Name>::null(), Type::Any(), | 1387 Type::Any(), MachineType::AnyTagged()}; |
| 1388 MachineType::AnyTagged()}; | |
| 1389 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1388 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1390 t.p1, t.start, t.start); | 1389 t.p1, t.start, t.start); |
| 1391 t.Effect(store); | 1390 t.Effect(store); |
| 1392 t.LowerAllNodesAndLowerChanges(); | 1391 t.LowerAllNodesAndLowerChanges(); |
| 1393 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1392 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1394 CHECK_EQ(t.p1, store->InputAt(2)); | 1393 CHECK_EQ(t.p1, store->InputAt(2)); |
| 1395 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); | 1394 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); |
| 1396 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); | 1395 CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); |
| 1397 } | 1396 } |
| 1398 } | 1397 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 t.Lower(); | 1510 t.Lower(); |
| 1512 CHECK_EQ(IrOpcode::kLoadElement, load->opcode()); | 1511 CHECK_EQ(IrOpcode::kLoadElement, load->opcode()); |
| 1513 CHECK_EQ(t.p0, load->InputAt(0)); | 1512 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1514 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); | 1513 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
| 1515 } | 1514 } |
| 1516 | 1515 |
| 1517 | 1516 |
| 1518 TEST(InsertChangeForLoadField) { | 1517 TEST(InsertChangeForLoadField) { |
| 1519 // TODO(titzer): test all load/store representation change insertions. | 1518 // TODO(titzer): test all load/store representation change insertions. |
| 1520 TestingGraph t(Type::Any(), Type::Signed32()); | 1519 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1521 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1520 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1522 Handle<Name>::null(), Type::Any(), | 1521 Type::Any(), MachineType::Float64()}; |
| 1523 MachineType::Float64()}; | |
| 1524 | 1522 |
| 1525 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, | 1523 Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, |
| 1526 t.start, t.start); | 1524 t.start, t.start); |
| 1527 t.Return(load); | 1525 t.Return(load); |
| 1528 t.Lower(); | 1526 t.Lower(); |
| 1529 CHECK_EQ(IrOpcode::kLoadField, load->opcode()); | 1527 CHECK_EQ(IrOpcode::kLoadField, load->opcode()); |
| 1530 CHECK_EQ(t.p0, load->InputAt(0)); | 1528 CHECK_EQ(t.p0, load->InputAt(0)); |
| 1531 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); | 1529 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
| 1532 } | 1530 } |
| 1533 | 1531 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1546 | 1544 |
| 1547 CHECK_EQ(IrOpcode::kStoreElement, store->opcode()); | 1545 CHECK_EQ(IrOpcode::kStoreElement, store->opcode()); |
| 1548 CHECK_EQ(t.p0, store->InputAt(0)); | 1546 CHECK_EQ(t.p0, store->InputAt(0)); |
| 1549 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1547 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
| 1550 } | 1548 } |
| 1551 | 1549 |
| 1552 | 1550 |
| 1553 TEST(InsertChangeForStoreField) { | 1551 TEST(InsertChangeForStoreField) { |
| 1554 // TODO(titzer): test all load/store representation change insertions. | 1552 // TODO(titzer): test all load/store representation change insertions. |
| 1555 TestingGraph t(Type::Any(), Type::Signed32()); | 1553 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1556 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1554 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1557 Handle<Name>::null(), Type::Any(), | 1555 Type::Any(), MachineType::Float64()}; |
| 1558 MachineType::Float64()}; | |
| 1559 | 1556 |
| 1560 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1557 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1561 t.p1, t.start, t.start); | 1558 t.p1, t.start, t.start); |
| 1562 t.Effect(store); | 1559 t.Effect(store); |
| 1563 t.Lower(); | 1560 t.Lower(); |
| 1564 | 1561 |
| 1565 CHECK_EQ(IrOpcode::kStoreField, store->opcode()); | 1562 CHECK_EQ(IrOpcode::kStoreField, store->opcode()); |
| 1566 CHECK_EQ(t.p0, store->InputAt(0)); | 1563 CHECK_EQ(t.p0, store->InputAt(0)); |
| 1567 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(1)); | 1564 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(1)); |
| 1568 } | 1565 } |
| 1569 | 1566 |
| 1570 | 1567 |
| 1571 TEST(UpdatePhi) { | 1568 TEST(UpdatePhi) { |
| 1572 TestingGraph t(Type::Any(), Type::Signed32()); | 1569 TestingGraph t(Type::Any(), Type::Signed32()); |
| 1573 static const MachineType kMachineTypes[] = { | 1570 static const MachineType kMachineTypes[] = { |
| 1574 MachineType::Int32(), MachineType::Uint32(), MachineType::Float64()}; | 1571 MachineType::Int32(), MachineType::Uint32(), MachineType::Float64()}; |
| 1575 Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()}; | 1572 Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()}; |
| 1576 | 1573 |
| 1577 for (size_t i = 0; i < arraysize(kMachineTypes); i++) { | 1574 for (size_t i = 0; i < arraysize(kMachineTypes); i++) { |
| 1578 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1575 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, nullptr, |
| 1579 Handle<Name>::null(), kTypes[i], kMachineTypes[i]}; | 1576 kTypes[i], kMachineTypes[i]}; |
| 1580 | 1577 |
| 1581 Node* load0 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, | 1578 Node* load0 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, |
| 1582 t.start, t.start); | 1579 t.start, t.start); |
| 1583 Node* load1 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p1, | 1580 Node* load1 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p1, |
| 1584 t.start, t.start); | 1581 t.start, t.start); |
| 1585 Node* phi = | 1582 Node* phi = |
| 1586 t.graph()->NewNode(t.common()->Phi(MachineRepresentation::kTagged, 2), | 1583 t.graph()->NewNode(t.common()->Phi(MachineRepresentation::kTagged, 2), |
| 1587 load0, load1, t.start); | 1584 load0, load1, t.start); |
| 1588 t.Return(t.Use(phi, kMachineTypes[i])); | 1585 t.Return(t.Use(phi, kMachineTypes[i])); |
| 1589 t.Lower(); | 1586 t.Lower(); |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 t.Return(use); | 1960 t.Return(use); |
| 1964 t.Lower(); | 1961 t.Lower(); |
| 1965 | 1962 |
| 1966 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1963 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
| 1967 } | 1964 } |
| 1968 } | 1965 } |
| 1969 | 1966 |
| 1970 } // namespace compiler | 1967 } // namespace compiler |
| 1971 } // namespace internal | 1968 } // namespace internal |
| 1972 } // namespace v8 | 1969 } // namespace v8 |
| OLD | NEW |