| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_mirrors_api.h" | 5 #include "include/dart_mirrors_api.h" |
| 6 #include "include/dart_tools_api.h" | 6 #include "include/dart_tools_api.h" |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 DECLARE_FLAG(bool, background_compilation); |
| 14 DECLARE_FLAG(int, optimization_counter_threshold); | 15 DECLARE_FLAG(int, optimization_counter_threshold); |
| 15 DECLARE_FLAG(bool, use_osr); | 16 DECLARE_FLAG(bool, use_osr); |
| 16 | 17 |
| 17 static bool breakpoint_hit = false; | 18 static bool breakpoint_hit = false; |
| 18 static int breakpoint_hit_counter = 0; | 19 static int breakpoint_hit_counter = 0; |
| 19 static Dart_Handle script_lib = NULL; | 20 static Dart_Handle script_lib = NULL; |
| 20 | 21 |
| 21 static const bool verbose = true; | 22 static const bool verbose = true; |
| 22 | 23 |
| 23 static void LoadScript(const char* source) { | 24 static void LoadScript(const char* source) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 FLAG_use_osr = saved_osr; | 487 FLAG_use_osr = saved_osr; |
| 487 } | 488 } |
| 488 | 489 |
| 489 | 490 |
| 490 TEST_CASE(Debug_InspectStack_NotOptimized) { | 491 TEST_CASE(Debug_InspectStack_NotOptimized) { |
| 491 InspectStackTest(false); | 492 InspectStackTest(false); |
| 492 } | 493 } |
| 493 | 494 |
| 494 | 495 |
| 495 TEST_CASE(Debug_InspectStack_Optimized) { | 496 TEST_CASE(Debug_InspectStack_Optimized) { |
| 497 // Ensure code gets optimized. |
| 498 FLAG_background_compilation = false; |
| 496 InspectStackTest(true); | 499 InspectStackTest(true); |
| 497 } | 500 } |
| 498 | 501 |
| 499 | 502 |
| 500 static void InspectStackWithClosureTest(bool optimize) { | 503 static void InspectStackWithClosureTest(bool optimize) { |
| 501 const char* kScriptChars = | 504 const char* kScriptChars = |
| 502 "void breakpointNow() {\n" | 505 "void breakpointNow() {\n" |
| 503 "}\n" | 506 "}\n" |
| 504 "int helper(int a, int b, bool stop) {\n" | 507 "int helper(int a, int b, bool stop) {\n" |
| 505 " if (b == 99 && stop) {\n" | 508 " if (b == 99 && stop) {\n" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 FLAG_use_osr = saved_osr; | 585 FLAG_use_osr = saved_osr; |
| 583 } | 586 } |
| 584 | 587 |
| 585 | 588 |
| 586 TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { | 589 TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { |
| 587 InspectStackWithClosureTest(false); | 590 InspectStackWithClosureTest(false); |
| 588 } | 591 } |
| 589 | 592 |
| 590 | 593 |
| 591 TEST_CASE(Debug_InspectStackWithClosure_Optimized) { | 594 TEST_CASE(Debug_InspectStackWithClosure_Optimized) { |
| 595 // Ensure code gets optimized. |
| 596 FLAG_background_compilation = false; |
| 592 InspectStackWithClosureTest(true); | 597 InspectStackWithClosureTest(true); |
| 593 } | 598 } |
| 594 | 599 |
| 595 | 600 |
| 596 void TestStepOutHandler(Dart_IsolateId isolate_id, | 601 void TestStepOutHandler(Dart_IsolateId isolate_id, |
| 597 intptr_t bp_id, | 602 intptr_t bp_id, |
| 598 const Dart_CodeLocation& location) { | 603 const Dart_CodeLocation& location) { |
| 599 Dart_StackTrace trace; | 604 Dart_StackTrace trace; |
| 600 Dart_GetStackTrace(&trace); | 605 Dart_GetStackTrace(&trace); |
| 601 const char* expected_bpts[] = {"f1", "foo", "main"}; | 606 const char* expected_bpts[] = {"f1", "foo", "main"}; |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," | 2321 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," |
| 2317 " null, 4, 13, 3, 14, 10," | 2322 " null, 4, 13, 3, 14, 10," |
| 2318 " null, 5, 17, 5, 18, 9, 19, 12," | 2323 " null, 5, 17, 5, 18, 9, 19, 12," |
| 2319 " null, 6, 21, 1," | 2324 " null, 6, 21, 1," |
| 2320 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2325 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
| 2321 " null, 9, 29, 1]", | 2326 " null, 9, 29, 1]", |
| 2322 tokens_cstr); | 2327 tokens_cstr); |
| 2323 } | 2328 } |
| 2324 | 2329 |
| 2325 } // namespace dart | 2330 } // namespace dart |
| OLD | NEW |