OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 "var x = 5;\n" | 285 "var x = 5;\n" |
286 "var y = 5;\n" | 286 "var y = 5;\n" |
287 "main() {\n" | 287 "main() {\n" |
288 " var z = x + y;\n" | 288 " var z = x + y;\n" |
289 " return z;\n" | 289 " return z;\n" |
290 "}\n"; | 290 "}\n"; |
291 | 291 |
292 SourcePositionTest spt(thread, kScript); | 292 SourcePositionTest spt(thread, kScript); |
293 spt.BuildGraphFor("main"); | 293 spt.BuildGraphFor("main"); |
294 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 294 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
295 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 295 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
296 spt.InstanceCallAt(4, 13, Token::kADD); | 296 spt.InstanceCallAt(4, 13, Token::kADD); |
297 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 3); | 297 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 3); |
298 spt.FuzzyInstructionMatchAt("Return", 5, 3); | 298 spt.FuzzyInstructionMatchAt("Return", 5, 3); |
299 | 299 |
300 spt.EnsureSourcePositions(); | 300 spt.EnsureSourcePositions(); |
301 } | 301 } |
302 | 302 |
303 TEST_CASE(SourcePosition_If) { | 303 TEST_CASE(SourcePosition_If) { |
304 const char* kScript = | 304 const char* kScript = |
305 "var x = 5;\n" | 305 "var x = 5;\n" |
306 "var y = 5;\n" | 306 "var y = 5;\n" |
307 "main() {\n" | 307 "main() {\n" |
308 " if (x != 0) {\n" | 308 " if (x != 0) {\n" |
309 " return x;\n" | 309 " return x;\n" |
310 " }\n" | 310 " }\n" |
311 " return y;\n" | 311 " return y;\n" |
312 "}\n"; | 312 "}\n"; |
313 | 313 |
314 SourcePositionTest spt(thread, kScript); | 314 SourcePositionTest spt(thread, kScript); |
315 spt.BuildGraphFor("main"); | 315 spt.BuildGraphFor("main"); |
316 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 316 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
317 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 317 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
318 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 7); | 318 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 7); |
319 spt.InstanceCallAt(4, 9, Token::kEQ); | 319 spt.InstanceCallAt(4, 9, Token::kEQ); |
320 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 9); | 320 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 9); |
321 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 12); | 321 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 12); |
322 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 5); | 322 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 5); |
323 spt.FuzzyInstructionMatchAt("Return", 5, 5); | 323 spt.FuzzyInstructionMatchAt("Return", 5, 5); |
324 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 10); | 324 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 10); |
325 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 3); | 325 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 3); |
326 spt.FuzzyInstructionMatchAt("Return", 7, 3); | 326 spt.FuzzyInstructionMatchAt("Return", 7, 3); |
327 | 327 |
328 spt.EnsureSourcePositions(); | 328 spt.EnsureSourcePositions(); |
329 } | 329 } |
330 | 330 |
331 TEST_CASE(SourcePosition_ForLoop) { | 331 TEST_CASE(SourcePosition_ForLoop) { |
332 const char* kScript = | 332 const char* kScript = |
333 "var x = 0;\n" | 333 "var x = 0;\n" |
334 "var y = 5;\n" | 334 "var y = 5;\n" |
335 "main() {\n" | 335 "main() {\n" |
336 " for (var i = 0; i < 10; i++) {\n" | 336 " for (var i = 0; i < 10; i++) {\n" |
337 " x += i;\n" | 337 " x += i;\n" |
338 " }\n" | 338 " }\n" |
339 " return x;\n" | 339 " return x;\n" |
340 "}\n"; | 340 "}\n"; |
341 | 341 |
342 SourcePositionTest spt(thread, kScript); | 342 SourcePositionTest spt(thread, kScript); |
343 spt.BuildGraphFor("main"); | 343 spt.BuildGraphFor("main"); |
344 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 344 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
345 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 345 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
346 spt.FuzzyInstructionMatchAt("StoreLocal", 4, 14); | 346 spt.FuzzyInstructionMatchAt("StoreLocal", 4, 14); |
347 spt.FuzzyInstructionMatchAt("LoadLocal", 4, 19); | 347 spt.FuzzyInstructionMatchAt("LoadLocal", 4, 19); |
348 spt.InstanceCallAt(4, 21, Token::kLT); | 348 spt.InstanceCallAt(4, 21, Token::kLT); |
349 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 21); | 349 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 21); |
350 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 5); | 350 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 5); |
351 spt.FuzzyInstructionMatchAt("StoreStaticField", 5, 5); | 351 spt.FuzzyInstructionMatchAt("StoreStaticField", 5, 5); |
352 spt.InstanceCallAt(5, 7, Token::kADD); | 352 spt.InstanceCallAt(5, 7, Token::kADD); |
353 spt.FuzzyInstructionMatchAt("LoadLocal", 5, 10); | 353 spt.FuzzyInstructionMatchAt("LoadLocal", 5, 10); |
354 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 10); | 354 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 10); |
355 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 3); | 355 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 3); |
(...skipping 12 matching lines...) Expand all Loading... |
368 " return y;\n" | 368 " return y;\n" |
369 " }\n" | 369 " }\n" |
370 " x++;\n" | 370 " x++;\n" |
371 " }\n" | 371 " }\n" |
372 " return x;\n" | 372 " return x;\n" |
373 "}\n"; | 373 "}\n"; |
374 | 374 |
375 SourcePositionTest spt(thread, kScript); | 375 SourcePositionTest spt(thread, kScript); |
376 spt.BuildGraphFor("main"); | 376 spt.BuildGraphFor("main"); |
377 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 377 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
378 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 378 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
379 | 379 |
380 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 4, 3); | 380 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 4, 3); |
381 spt.FuzzyInstructionMatchAt("Constant", 4, 10); | 381 spt.FuzzyInstructionMatchAt("Constant", 4, 10); |
382 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 10); | 382 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 10); |
383 spt.InstanceCallAt(4, 12, Token::kLT); | 383 spt.InstanceCallAt(4, 12, Token::kLT); |
384 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 12); | 384 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 12); |
385 | 385 |
386 spt.FuzzyInstructionMatchAt("Constant", 5, 9); | 386 spt.FuzzyInstructionMatchAt("Constant", 5, 9); |
387 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 9); | 387 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 9); |
388 spt.InstanceCallAt(5, 11, Token::kEQ); | 388 spt.InstanceCallAt(5, 11, Token::kEQ); |
(...skipping 27 matching lines...) Expand all Loading... |
416 " continue;\n" | 416 " continue;\n" |
417 " }\n" | 417 " }\n" |
418 " break;\n" | 418 " break;\n" |
419 " }\n" | 419 " }\n" |
420 " return x;\n" | 420 " return x;\n" |
421 "}\n"; | 421 "}\n"; |
422 | 422 |
423 SourcePositionTest spt(thread, kScript); | 423 SourcePositionTest spt(thread, kScript); |
424 spt.BuildGraphFor("main"); | 424 spt.BuildGraphFor("main"); |
425 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 425 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
426 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 426 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
427 | 427 |
428 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 4, 3); | 428 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 4, 3); |
429 spt.FuzzyInstructionMatchAt("Constant(#Field", 4, 10); | 429 spt.FuzzyInstructionMatchAt("Constant(#Field", 4, 10); |
430 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 10); | 430 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 10); |
431 spt.FuzzyInstructionMatchAt("Constant(#10", 4, 14); | 431 spt.FuzzyInstructionMatchAt("Constant(#10", 4, 14); |
432 spt.InstanceCallAt(4, 12, Token::kLT); | 432 spt.InstanceCallAt(4, 12, Token::kLT); |
433 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 12); | 433 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 12); |
434 | 434 |
435 spt.FuzzyInstructionMatchAt("Constant(#Field", 5, 9); | 435 spt.FuzzyInstructionMatchAt("Constant(#Field", 5, 9); |
436 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 9); | 436 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 9); |
(...skipping 14 matching lines...) Expand all Loading... |
451 "var z = new List(3);\n" | 451 "var z = new List(3);\n" |
452 "main() {\n" | 452 "main() {\n" |
453 " z[0];\n" | 453 " z[0];\n" |
454 " var y = z[0] + z[1] + z[2];\n" | 454 " var y = z[0] + z[1] + z[2];\n" |
455 "}\n"; | 455 "}\n"; |
456 | 456 |
457 SourcePositionTest spt(thread, kScript); | 457 SourcePositionTest spt(thread, kScript); |
458 spt.BuildGraphFor("main"); | 458 spt.BuildGraphFor("main"); |
459 | 459 |
460 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 460 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
461 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 461 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
462 spt.StaticCallAt("get:z", 4, 3); | 462 spt.StaticCallAt("get:z", 4, 3); |
463 spt.FuzzyInstructionMatchAt("Constant(#0)", 4, 5); | 463 spt.FuzzyInstructionMatchAt("Constant(#0)", 4, 5); |
464 spt.InstanceCallAt(4, 4, Token::kINDEX); | 464 spt.InstanceCallAt(4, 4, Token::kINDEX); |
465 | 465 |
466 spt.FuzzyInstructionMatchAt("Constant(#0)", 5, 13); | 466 spt.FuzzyInstructionMatchAt("Constant(#0)", 5, 13); |
467 spt.InstanceCallAt(5, 12, Token::kINDEX); | 467 spt.InstanceCallAt(5, 12, Token::kINDEX); |
468 spt.FuzzyInstructionMatchAt("Constant(#1)", 5, 20); | 468 spt.FuzzyInstructionMatchAt("Constant(#1)", 5, 20); |
469 spt.InstanceCallAt(5, 19, Token::kINDEX); | 469 spt.InstanceCallAt(5, 19, Token::kINDEX); |
470 | 470 |
471 spt.InstanceCallAt(5, 16, Token::kADD); | 471 spt.InstanceCallAt(5, 16, Token::kADD); |
(...skipping 17 matching lines...) Expand all Loading... |
489 "var z = new List(4);\n" | 489 "var z = new List(4);\n" |
490 "main() {\n" | 490 "main() {\n" |
491 " z[0];\n" | 491 " z[0];\n" |
492 " z[3] = z[0] + z[1] + z[2];\n" | 492 " z[3] = z[0] + z[1] + z[2];\n" |
493 "}\n"; | 493 "}\n"; |
494 | 494 |
495 SourcePositionTest spt(thread, kScript); | 495 SourcePositionTest spt(thread, kScript); |
496 spt.BuildGraphFor("main"); | 496 spt.BuildGraphFor("main"); |
497 | 497 |
498 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 498 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
499 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 499 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
500 spt.StaticCallAt("get:z", 4, 3); | 500 spt.StaticCallAt("get:z", 4, 3); |
501 spt.FuzzyInstructionMatchAt("Constant(#0)", 4, 5); | 501 spt.FuzzyInstructionMatchAt("Constant(#0)", 4, 5); |
502 spt.InstanceCallAt(4, 4, Token::kINDEX); | 502 spt.InstanceCallAt(4, 4, Token::kINDEX); |
503 | 503 |
504 spt.FuzzyInstructionMatchAt("Constant(#3)", 5, 5); | 504 spt.FuzzyInstructionMatchAt("Constant(#3)", 5, 5); |
505 | 505 |
506 spt.StaticCallAt("get:z", 5, 10); | 506 spt.StaticCallAt("get:z", 5, 10); |
507 spt.FuzzyInstructionMatchAt("Constant(#0)", 5, 12); | 507 spt.FuzzyInstructionMatchAt("Constant(#0)", 5, 12); |
508 spt.InstanceCallAt(5, 11, Token::kINDEX); | 508 spt.InstanceCallAt(5, 11, Token::kINDEX); |
509 | 509 |
(...skipping 26 matching lines...) Expand all Loading... |
536 " z = x | y;\n" | 536 " z = x | y;\n" |
537 " z = x ^ y;\n" | 537 " z = x ^ y;\n" |
538 " z = ~z;\n" | 538 " z = ~z;\n" |
539 " return z;\n" | 539 " return z;\n" |
540 "}\n"; | 540 "}\n"; |
541 | 541 |
542 SourcePositionTest spt(thread, kScript); | 542 SourcePositionTest spt(thread, kScript); |
543 spt.BuildGraphFor("main"); | 543 spt.BuildGraphFor("main"); |
544 | 544 |
545 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 545 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
546 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 546 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
547 | 547 |
548 spt.FuzzyInstructionMatchAt("DebugStepCheck", 4, 7); | 548 spt.FuzzyInstructionMatchAt("DebugStepCheck", 4, 7); |
549 spt.FuzzyInstructionMatchAt("Constant(#null", 4, 7); | 549 spt.FuzzyInstructionMatchAt("Constant(#null", 4, 7); |
550 spt.FuzzyInstructionMatchAt("StoreLocal(z", 4, 7); | 550 spt.FuzzyInstructionMatchAt("StoreLocal(z", 4, 7); |
551 | 551 |
552 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 7); | 552 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 7); |
553 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 11); | 553 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 11); |
554 spt.InstanceCallAt(5, 9, Token::kBIT_AND); | 554 spt.InstanceCallAt(5, 9, Token::kBIT_AND); |
555 spt.FuzzyInstructionMatchAt("StoreLocal(z", 5, 3); | 555 spt.FuzzyInstructionMatchAt("StoreLocal(z", 5, 3); |
556 | 556 |
(...skipping 26 matching lines...) Expand all Loading... |
583 " if (x != 0) {\n" | 583 " if (x != 0) {\n" |
584 " return x;\n" | 584 " return x;\n" |
585 " } else {\n" | 585 " } else {\n" |
586 " return y;\n" | 586 " return y;\n" |
587 " }\n" | 587 " }\n" |
588 "}\n"; | 588 "}\n"; |
589 | 589 |
590 SourcePositionTest spt(thread, kScript); | 590 SourcePositionTest spt(thread, kScript); |
591 spt.BuildGraphFor("main"); | 591 spt.BuildGraphFor("main"); |
592 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 592 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
593 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 593 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
594 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 7); | 594 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 7); |
595 spt.InstanceCallAt(4, 9, Token::kEQ); | 595 spt.InstanceCallAt(4, 9, Token::kEQ); |
596 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 9); | 596 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 9); |
597 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 12); | 597 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 12); |
598 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 5); | 598 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 5); |
599 spt.FuzzyInstructionMatchAt("Return", 5, 5); | 599 spt.FuzzyInstructionMatchAt("Return", 5, 5); |
600 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 12); | 600 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 12); |
601 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 5); | 601 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 5); |
602 spt.FuzzyInstructionMatchAt("Return", 7, 5); | 602 spt.FuzzyInstructionMatchAt("Return", 7, 5); |
603 | 603 |
604 spt.EnsureSourcePositions(); | 604 spt.EnsureSourcePositions(); |
605 } | 605 } |
606 | 606 |
607 TEST_CASE(SourcePosition_Switch) { | 607 TEST_CASE(SourcePosition_Switch) { |
608 const char* kScript = | 608 const char* kScript = |
609 "var x = 5;\n" | 609 "var x = 5;\n" |
610 "var y = 5;\n" | 610 "var y = 5;\n" |
611 "main() {\n" | 611 "main() {\n" |
612 " switch (x) {\n" | 612 " switch (x) {\n" |
613 " case 1: return 3;\n" | 613 " case 1: return 3;\n" |
614 " case 2: return 4;\n" | 614 " case 2: return 4;\n" |
615 " default: return 5;\n" | 615 " default: return 5;\n" |
616 " }\n" | 616 " }\n" |
617 "}\n"; | 617 "}\n"; |
618 | 618 |
619 SourcePositionTest spt(thread, kScript); | 619 SourcePositionTest spt(thread, kScript); |
620 spt.BuildGraphFor("main"); | 620 spt.BuildGraphFor("main"); |
621 | 621 |
622 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 622 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
623 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 623 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
624 spt.FuzzyInstructionMatchAt("Constant(#Field", 4, 11); | 624 spt.FuzzyInstructionMatchAt("Constant(#Field", 4, 11); |
625 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 11); | 625 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 11); |
626 spt.FuzzyInstructionMatchAt("StoreLocal(:switch_expr", 4, 11); | 626 spt.FuzzyInstructionMatchAt("StoreLocal(:switch_expr", 4, 11); |
627 | 627 |
628 spt.FuzzyInstructionMatchAt("Constant(#1", 5, 10); | 628 spt.FuzzyInstructionMatchAt("Constant(#1", 5, 10); |
629 spt.FuzzyInstructionMatchAt("LoadLocal(:switch_expr", 5, 5); // 'c' | 629 spt.FuzzyInstructionMatchAt("LoadLocal(:switch_expr", 5, 5); // 'c' |
630 spt.InstanceCallAt(5, 10, Token::kEQ); // '1' | 630 spt.InstanceCallAt(5, 10, Token::kEQ); // '1' |
631 | 631 |
632 spt.FuzzyInstructionMatchAt("Constant(#3", 5, 20); // '3' | 632 spt.FuzzyInstructionMatchAt("Constant(#3", 5, 20); // '3' |
633 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 13); | 633 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 13); |
(...skipping 26 matching lines...) Expand all Loading... |
660 " return 77;\n" | 660 " return 77;\n" |
661 " } finally {\n" | 661 " } finally {\n" |
662 " return 99;\n" | 662 " return 99;\n" |
663 " }\n" | 663 " }\n" |
664 "}\n"; | 664 "}\n"; |
665 | 665 |
666 SourcePositionTest spt(thread, kScript); | 666 SourcePositionTest spt(thread, kScript); |
667 spt.BuildGraphFor("main"); | 667 spt.BuildGraphFor("main"); |
668 | 668 |
669 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); | 669 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
670 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); | 670 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 8); |
671 | 671 |
672 spt.FuzzyInstructionMatchAt("LoadLocal(:current_context", 4, 3); // 't' | 672 spt.FuzzyInstructionMatchAt("LoadLocal(:current_context", 4, 3); // 't' |
673 spt.FuzzyInstructionMatchAt("StoreLocal(:saved_try_context", 4, 3); | 673 spt.FuzzyInstructionMatchAt("StoreLocal(:saved_try_context", 4, 3); |
674 | 674 |
675 spt.FuzzyInstructionMatchAt("Constant(#A", 5, 11); // 'A' | 675 spt.FuzzyInstructionMatchAt("Constant(#A", 5, 11); // 'A' |
676 spt.FuzzyInstructionMatchAt("Throw", 5, 5); // 't' | 676 spt.FuzzyInstructionMatchAt("Throw", 5, 5); // 't' |
677 | 677 |
678 spt.FuzzyInstructionMatchAt("LoadLocal(:saved_try_context", 6, 5); // 'c' | 678 spt.FuzzyInstructionMatchAt("LoadLocal(:saved_try_context", 6, 5); // 'c' |
679 spt.FuzzyInstructionMatchAt("StoreLocal(:current_context", 6, 5); // 'c' | 679 spt.FuzzyInstructionMatchAt("StoreLocal(:current_context", 6, 5); // 'c' |
680 spt.FuzzyInstructionMatchAt("LoadLocal(:exception_var", 6, 5); // 'c' | 680 spt.FuzzyInstructionMatchAt("LoadLocal(:exception_var", 6, 5); // 'c' |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 EXPECT(TokenPosition(9).ToSynthetic().IsSynthetic()); | 767 EXPECT(TokenPosition(9).ToSynthetic().IsSynthetic()); |
768 EXPECT(!TokenPosition(-1).FromSynthetic().IsSynthetic()); | 768 EXPECT(!TokenPosition(-1).FromSynthetic().IsSynthetic()); |
769 EXPECT(!TokenPosition::kNoSource.IsSynthetic()); | 769 EXPECT(!TokenPosition::kNoSource.IsSynthetic()); |
770 EXPECT(!TokenPosition::kLast.IsSynthetic()); | 770 EXPECT(!TokenPosition::kLast.IsSynthetic()); |
771 EXPECT(SyntheticRoundTripTest(TokenPosition(0))); | 771 EXPECT(SyntheticRoundTripTest(TokenPosition(0))); |
772 EXPECT(SyntheticRoundTripTest(TokenPosition::kMaxSource)); | 772 EXPECT(SyntheticRoundTripTest(TokenPosition::kMaxSource)); |
773 EXPECT(SyntheticRoundTripTest(TokenPosition::kMinSource)); | 773 EXPECT(SyntheticRoundTripTest(TokenPosition::kMinSource)); |
774 } | 774 } |
775 | 775 |
776 } // namespace dart | 776 } // namespace dart |
OLD | NEW |