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/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 CHECK(result->IsMap()); | 200 CHECK(result->IsMap()); |
201 CHECK_EQ(*src_map, result); | 201 CHECK_EQ(*src_map, result); |
202 CHECK(*src_map == dst->map()); | 202 CHECK(*src_map == dst->map()); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 | 206 |
207 TEST(RunLoadStoreFixedArrayIndex) { | 207 TEST(RunLoadStoreFixedArrayIndex) { |
208 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); | 208 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); |
209 ElementAccess access = AccessBuilder::ForFixedArrayElement(); | 209 ElementAccess access = AccessBuilder::ForFixedArrayElement(); |
210 Node* load = t.LoadElement(access, t.Parameter(0), t.Int32Constant(0)); | 210 Node* load = t.LoadElement(access, t.Parameter(0), t.Int32Constant(0), |
211 t.StoreElement(access, t.Parameter(0), t.Int32Constant(1), load); | 211 t.Int32Constant(2)); |
| 212 t.StoreElement(access, t.Parameter(0), t.Int32Constant(1), t.Int32Constant(2), |
| 213 load); |
212 t.Return(load); | 214 t.Return(load); |
213 | 215 |
214 t.LowerAllNodes(); | 216 t.LowerAllNodes(); |
215 t.GenerateCode(); | 217 t.GenerateCode(); |
216 | 218 |
217 if (Pipeline::SupportedTarget()) { | 219 if (Pipeline::SupportedTarget()) { |
218 Handle<FixedArray> array = t.factory()->NewFixedArray(2); | 220 Handle<FixedArray> array = t.factory()->NewFixedArray(2); |
219 Handle<JSObject> src = TestObject(); | 221 Handle<JSObject> src = TestObject(); |
220 Handle<JSObject> dst = TestObject(); | 222 Handle<JSObject> dst = TestObject(); |
221 array->set(0, *src); | 223 array->set(0, *src); |
222 array->set(1, *dst); | 224 array->set(1, *dst); |
223 Object* result = t.Call(*array); | 225 Object* result = t.Call(*array); |
224 CHECK_EQ(*src, result); | 226 CHECK_EQ(*src, result); |
225 CHECK_EQ(*src, array->get(0)); | 227 CHECK_EQ(*src, array->get(0)); |
226 CHECK_EQ(*src, array->get(1)); | 228 CHECK_EQ(*src, array->get(1)); |
227 } | 229 } |
228 } | 230 } |
229 | 231 |
230 | 232 |
231 TEST(RunLoadStoreArrayBuffer) { | 233 TEST(RunLoadStoreArrayBuffer) { |
232 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); | 234 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); |
233 const int index = 12; | 235 const int index = 12; |
| 236 const int array_length = 2 * index; |
234 ElementAccess buffer_access = | 237 ElementAccess buffer_access = |
235 AccessBuilder::ForBackingStoreElement(kMachInt8); | 238 AccessBuilder::ForBackingStoreElement(kMachInt8); |
236 Node* backing_store = t.LoadField( | 239 Node* backing_store = t.LoadField( |
237 AccessBuilder::ForJSArrayBufferBackingStore(), t.Parameter(0)); | 240 AccessBuilder::ForJSArrayBufferBackingStore(), t.Parameter(0)); |
238 Node* load = | 241 Node* load = |
239 t.LoadElement(buffer_access, backing_store, t.Int32Constant(index)); | 242 t.LoadElement(buffer_access, backing_store, t.Int32Constant(index), |
| 243 t.Int32Constant(array_length)); |
240 t.StoreElement(buffer_access, backing_store, t.Int32Constant(index + 1), | 244 t.StoreElement(buffer_access, backing_store, t.Int32Constant(index + 1), |
241 load); | 245 t.Int32Constant(array_length), load); |
242 t.Return(t.jsgraph.TrueConstant()); | 246 t.Return(t.jsgraph.TrueConstant()); |
243 | 247 |
244 t.LowerAllNodes(); | 248 t.LowerAllNodes(); |
245 t.GenerateCode(); | 249 t.GenerateCode(); |
246 | 250 |
247 if (Pipeline::SupportedTarget()) { | 251 if (Pipeline::SupportedTarget()) { |
248 Handle<JSArrayBuffer> array = t.factory()->NewJSArrayBuffer(); | 252 Handle<JSArrayBuffer> array = t.factory()->NewJSArrayBuffer(); |
249 const int array_length = 2 * index; | |
250 Runtime::SetupArrayBufferAllocatingData(t.isolate(), array, array_length); | 253 Runtime::SetupArrayBufferAllocatingData(t.isolate(), array, array_length); |
251 uint8_t* data = reinterpret_cast<uint8_t*>(array->backing_store()); | 254 uint8_t* data = reinterpret_cast<uint8_t*>(array->backing_store()); |
252 for (int i = 0; i < array_length; i++) { | 255 for (int i = 0; i < array_length; i++) { |
253 data[i] = i; | 256 data[i] = i; |
254 } | 257 } |
255 | 258 |
256 // TODO(titzer): raw pointers in call | 259 // TODO(titzer): raw pointers in call |
257 Object* result = t.Call(*array); | 260 Object* result = t.Call(*array); |
258 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 261 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
259 for (int i = 0; i < array_length; i++) { | 262 for (int i = 0; i < array_length; i++) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), | 322 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), |
320 Smi::FromInt(4), Smi::FromInt(5)}; | 323 Smi::FromInt(4), Smi::FromInt(5)}; |
321 | 324 |
322 for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes | 325 for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes |
323 for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index | 326 for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index |
324 int offset = static_cast<int>(i * sizeof(Smi*)); | 327 int offset = static_cast<int>(i * sizeof(Smi*)); |
325 ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), | 328 ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), |
326 kMachAnyTagged}; | 329 kMachAnyTagged}; |
327 | 330 |
328 SimplifiedLoweringTester<Object*> t; | 331 SimplifiedLoweringTester<Object*> t; |
329 Node* load = t.LoadElement(access, t.PointerConstant(smis), | 332 Node* load = t.LoadElement( |
330 t.Int32Constant(static_cast<int>(j))); | 333 access, t.PointerConstant(smis), t.Int32Constant(static_cast<int>(j)), |
| 334 t.Int32Constant(static_cast<int>(arraysize(smis)))); |
331 t.Return(load); | 335 t.Return(load); |
332 t.LowerAllNodes(); | 336 t.LowerAllNodes(); |
333 | 337 |
334 if (!Pipeline::SupportedTarget()) continue; | 338 if (!Pipeline::SupportedTarget()) continue; |
335 | 339 |
336 for (int k = -5; k <= 5; k++) { | 340 for (int k = -5; k <= 5; k++) { |
337 Smi* expected = Smi::FromInt(k); | 341 Smi* expected = Smi::FromInt(k); |
338 smis[i + j] = expected; | 342 smis[i + j] = expected; |
339 CHECK_EQ(expected, t.Call()); | 343 CHECK_EQ(expected, t.Call()); |
340 } | 344 } |
341 } | 345 } |
342 } | 346 } |
343 } | 347 } |
344 | 348 |
345 | 349 |
346 TEST(RunStoreElementFromUntaggedBase) { | 350 TEST(RunStoreElementFromUntaggedBase) { |
347 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), | 351 Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), |
348 Smi::FromInt(4), Smi::FromInt(5)}; | 352 Smi::FromInt(4), Smi::FromInt(5)}; |
349 | 353 |
350 for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes | 354 for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes |
351 for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index | 355 for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index |
352 int offset = static_cast<int>(i * sizeof(Smi*)); | 356 int offset = static_cast<int>(i * sizeof(Smi*)); |
353 ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), | 357 ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), |
354 kMachAnyTagged}; | 358 kMachAnyTagged}; |
355 | 359 |
356 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); | 360 SimplifiedLoweringTester<Object*> t(kMachAnyTagged); |
357 Node* p0 = t.Parameter(0); | 361 Node* p0 = t.Parameter(0); |
358 t.StoreElement(access, t.PointerConstant(smis), | 362 t.StoreElement(access, t.PointerConstant(smis), |
359 t.Int32Constant(static_cast<int>(j)), p0); | 363 t.Int32Constant(static_cast<int>(j)), |
| 364 t.Int32Constant(static_cast<int>(arraysize(smis))), p0); |
360 t.Return(p0); | 365 t.Return(p0); |
361 t.LowerAllNodes(); | 366 t.LowerAllNodes(); |
362 | 367 |
363 if (!Pipeline::SupportedTarget()) continue; | 368 if (!Pipeline::SupportedTarget()) continue; |
364 | 369 |
365 for (int k = -5; k <= 5; k++) { | 370 for (int k = -5; k <= 5; k++) { |
366 Smi* expected = Smi::FromInt(k); | 371 Smi* expected = Smi::FromInt(k); |
367 smis[i + j] = Smi::FromInt(-100); | 372 smis[i + j] = Smi::FromInt(-100); |
368 CHECK_EQ(expected, t.Call(expected)); | 373 CHECK_EQ(expected, t.Call(expected)); |
369 CHECK_EQ(expected, smis[i + j]); | 374 CHECK_EQ(expected, smis[i + j]); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 // or {tagged_array} at index {from_index} to index {to_index}. | 420 // or {tagged_array} at index {from_index} to index {to_index}. |
416 void RunCopyElement(int from_index, int to_index) { | 421 void RunCopyElement(int from_index, int to_index) { |
417 // TODO(titzer): test element and field accesses where the base is not | 422 // TODO(titzer): test element and field accesses where the base is not |
418 // a constant in the code. | 423 // a constant in the code. |
419 BoundsCheck(from_index); | 424 BoundsCheck(from_index); |
420 BoundsCheck(to_index); | 425 BoundsCheck(to_index); |
421 ElementAccess access = GetElementAccess(); | 426 ElementAccess access = GetElementAccess(); |
422 | 427 |
423 SimplifiedLoweringTester<Object*> t; | 428 SimplifiedLoweringTester<Object*> t; |
424 Node* ptr = GetBaseNode(&t); | 429 Node* ptr = GetBaseNode(&t); |
425 Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index)); | 430 Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index), |
426 t.StoreElement(access, ptr, t.Int32Constant(to_index), load); | 431 t.Int32Constant(num_elements)); |
| 432 t.StoreElement(access, ptr, t.Int32Constant(to_index), |
| 433 t.Int32Constant(num_elements), load); |
427 t.Return(t.jsgraph.TrueConstant()); | 434 t.Return(t.jsgraph.TrueConstant()); |
428 t.LowerAllNodes(); | 435 t.LowerAllNodes(); |
429 t.GenerateCode(); | 436 t.GenerateCode(); |
430 | 437 |
431 if (Pipeline::SupportedTarget()) { | 438 if (Pipeline::SupportedTarget()) { |
432 Object* result = t.Call(); | 439 Object* result = t.Call(); |
433 CHECK_EQ(t.isolate()->heap()->true_value(), result); | 440 CHECK_EQ(t.isolate()->heap()->true_value(), result); |
434 } | 441 } |
435 } | 442 } |
436 | 443 |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 } | 1341 } |
1335 | 1342 |
1336 | 1343 |
1337 TEST(LowerLoadElement_to_load) { | 1344 TEST(LowerLoadElement_to_load) { |
1338 TestingGraph t(Type::Any(), Type::Signed32()); | 1345 TestingGraph t(Type::Any(), Type::Signed32()); |
1339 | 1346 |
1340 for (size_t i = 0; i < arraysize(machine_reps); i++) { | 1347 for (size_t i = 0; i < arraysize(machine_reps); i++) { |
1341 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1348 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
1342 Type::Any(), machine_reps[i]}; | 1349 Type::Any(), machine_reps[i]}; |
1343 | 1350 |
1344 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, | 1351 Node* load = |
1345 t.p1, t.start); | 1352 t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1, |
| 1353 t.jsgraph.Int32Constant(1024), t.start); |
1346 Node* use = t.Use(load, machine_reps[i]); | 1354 Node* use = t.Use(load, machine_reps[i]); |
1347 t.Return(use); | 1355 t.Return(use); |
1348 t.Lower(); | 1356 t.Lower(); |
1349 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1357 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
1350 CHECK_EQ(t.p0, load->InputAt(0)); | 1358 CHECK_EQ(t.p0, load->InputAt(0)); |
1351 CheckElementAccessArithmetic(access, load); | 1359 CheckElementAccessArithmetic(access, load); |
1352 | 1360 |
1353 MachineType rep = OpParameter<MachineType>(load); | 1361 MachineType rep = OpParameter<MachineType>(load); |
1354 CHECK_EQ(machine_reps[i], rep); | 1362 CHECK_EQ(machine_reps[i], rep); |
1355 } | 1363 } |
1356 } | 1364 } |
1357 | 1365 |
1358 | 1366 |
1359 TEST(LowerStoreElement_to_store) { | 1367 TEST(LowerStoreElement_to_store) { |
1360 TestingGraph t(Type::Any(), Type::Signed32()); | 1368 TestingGraph t(Type::Any(), Type::Signed32()); |
1361 | 1369 |
1362 for (size_t i = 0; i < arraysize(machine_reps); i++) { | 1370 for (size_t i = 0; i < arraysize(machine_reps); i++) { |
1363 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 1371 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
1364 Type::Any(), machine_reps[i]}; | 1372 Type::Any(), machine_reps[i]}; |
1365 | 1373 |
1366 Node* val = t.ExampleWithOutput(machine_reps[i]); | 1374 Node* val = t.ExampleWithOutput(machine_reps[i]); |
1367 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, | 1375 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, |
1368 t.p1, val, t.start, t.start); | 1376 t.p1, t.jsgraph.Int32Constant(1024), val, |
| 1377 t.start, t.start); |
1369 t.Effect(store); | 1378 t.Effect(store); |
1370 t.Lower(); | 1379 t.Lower(); |
1371 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1380 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1372 CHECK_EQ(val, store->InputAt(2)); | 1381 CHECK_EQ(val, store->InputAt(2)); |
1373 CheckElementAccessArithmetic(access, store); | 1382 CheckElementAccessArithmetic(access, store); |
1374 | 1383 |
1375 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); | 1384 StoreRepresentation rep = OpParameter<StoreRepresentation>(store); |
1376 if (machine_reps[i] & kRepTagged) { | 1385 if (machine_reps[i] & kRepTagged) { |
1377 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); | 1386 CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind()); |
1378 } | 1387 } |
1379 CHECK_EQ(machine_reps[i], rep.machine_type()); | 1388 CHECK_EQ(machine_reps[i], rep.machine_type()); |
1380 } | 1389 } |
1381 } | 1390 } |
1382 | 1391 |
1383 | 1392 |
1384 TEST(InsertChangeForLoadElementIndex) { | 1393 TEST(InsertChangeForLoadElementIndex) { |
1385 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged) => | 1394 // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged) => |
1386 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) | 1395 // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) |
1387 TestingGraph t(Type::Any(), Type::Signed32()); | 1396 TestingGraph t(Type::Any(), Type::Signed32()); |
1388 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1397 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
1389 kMachAnyTagged}; | 1398 kMachAnyTagged}; |
1390 | 1399 |
1391 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, | 1400 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, |
1392 t.p1, t.start); | 1401 t.p1, t.jsgraph.Int32Constant(1024), t.start); |
1393 t.Return(load); | 1402 t.Return(load); |
1394 t.Lower(); | 1403 t.Lower(); |
1395 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1404 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
1396 CHECK_EQ(t.p0, load->InputAt(0)); | 1405 CHECK_EQ(t.p0, load->InputAt(0)); |
1397 | 1406 |
1398 Node* index = CheckElementAccessArithmetic(access, load); | 1407 Node* index = CheckElementAccessArithmetic(access, load); |
1399 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); | 1408 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); |
1400 } | 1409 } |
1401 | 1410 |
1402 | 1411 |
1403 TEST(InsertChangeForStoreElementIndex) { | 1412 TEST(InsertChangeForStoreElementIndex) { |
1404 // StoreElement(obj: Tagged, index: kTypeInt32 | kRepTagged, val) => | 1413 // StoreElement(obj: Tagged, index: kTypeInt32 | kRepTagged, val) => |
1405 // Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val) | 1414 // Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val) |
1406 TestingGraph t(Type::Any(), Type::Signed32()); | 1415 TestingGraph t(Type::Any(), Type::Signed32()); |
1407 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1416 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
1408 kMachAnyTagged}; | 1417 kMachAnyTagged}; |
1409 | 1418 |
1410 Node* store = | 1419 Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, |
1411 t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1, | 1420 t.p1, t.jsgraph.Int32Constant(1024), |
1412 t.jsgraph.TrueConstant(), t.start, t.start); | 1421 t.jsgraph.TrueConstant(), t.start, t.start); |
1413 t.Effect(store); | 1422 t.Effect(store); |
1414 t.Lower(); | 1423 t.Lower(); |
1415 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1424 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1416 CHECK_EQ(t.p0, store->InputAt(0)); | 1425 CHECK_EQ(t.p0, store->InputAt(0)); |
1417 | 1426 |
1418 Node* index = CheckElementAccessArithmetic(access, store); | 1427 Node* index = CheckElementAccessArithmetic(access, store); |
1419 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); | 1428 CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index); |
1420 } | 1429 } |
1421 | 1430 |
1422 | 1431 |
1423 TEST(InsertChangeForLoadElement) { | 1432 TEST(InsertChangeForLoadElement) { |
1424 // TODO(titzer): test all load/store representation change insertions. | 1433 // TODO(titzer): test all load/store representation change insertions. |
1425 TestingGraph t(Type::Any(), Type::Signed32()); | 1434 TestingGraph t(Type::Any(), Type::Signed32()); |
1426 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1435 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
1427 kMachFloat64}; | 1436 kMachFloat64}; |
1428 | 1437 |
1429 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, | 1438 Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, |
1430 t.p1, t.start); | 1439 t.p1, t.jsgraph.Int32Constant(1024), t.start); |
1431 t.Return(load); | 1440 t.Return(load); |
1432 t.Lower(); | 1441 t.Lower(); |
1433 CHECK_EQ(IrOpcode::kLoad, load->opcode()); | 1442 CHECK_EQ(IrOpcode::kLoad, load->opcode()); |
1434 CHECK_EQ(t.p0, load->InputAt(0)); | 1443 CHECK_EQ(t.p0, load->InputAt(0)); |
1435 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); | 1444 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
1436 } | 1445 } |
1437 | 1446 |
1438 | 1447 |
1439 TEST(InsertChangeForLoadField) { | 1448 TEST(InsertChangeForLoadField) { |
1440 // TODO(titzer): test all load/store representation change insertions. | 1449 // TODO(titzer): test all load/store representation change insertions. |
(...skipping 10 matching lines...) Expand all Loading... |
1451 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); | 1460 CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); |
1452 } | 1461 } |
1453 | 1462 |
1454 | 1463 |
1455 TEST(InsertChangeForStoreElement) { | 1464 TEST(InsertChangeForStoreElement) { |
1456 // TODO(titzer): test all load/store representation change insertions. | 1465 // TODO(titzer): test all load/store representation change insertions. |
1457 TestingGraph t(Type::Any(), Type::Signed32()); | 1466 TestingGraph t(Type::Any(), Type::Signed32()); |
1458 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), | 1467 ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), |
1459 kMachFloat64}; | 1468 kMachFloat64}; |
1460 | 1469 |
1461 Node* store = | 1470 Node* store = t.graph()->NewNode( |
1462 t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, | 1471 t.simplified()->StoreElement(access), t.p0, t.jsgraph.Int32Constant(0), |
1463 t.jsgraph.Int32Constant(0), t.p1, t.start, t.start); | 1472 t.jsgraph.Int32Constant(1024), t.p1, t.start, t.start); |
1464 t.Effect(store); | 1473 t.Effect(store); |
1465 t.Lower(); | 1474 t.Lower(); |
1466 | 1475 |
1467 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1476 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1468 CHECK_EQ(t.p0, store->InputAt(0)); | 1477 CHECK_EQ(t.p0, store->InputAt(0)); |
1469 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1478 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
1470 } | 1479 } |
1471 | 1480 |
1472 | 1481 |
1473 TEST(InsertChangeForStoreField) { | 1482 TEST(InsertChangeForStoreField) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 | 1547 |
1539 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1548 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
1540 t.p1, t.start, t.start); | 1549 t.p1, t.start, t.start); |
1541 t.Effect(store); | 1550 t.Effect(store); |
1542 t.Lower(); | 1551 t.Lower(); |
1543 | 1552 |
1544 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1553 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
1545 CHECK_EQ(t.p0, store->InputAt(0)); | 1554 CHECK_EQ(t.p0, store->InputAt(0)); |
1546 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1555 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
1547 } | 1556 } |
OLD | NEW |