| 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" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 " return middleMan(5, limit, stop);\n" | 458 " return middleMan(5, limit, stop);\n" |
| 459 "}\n"; | 459 "}\n"; |
| 460 | 460 |
| 461 LoadScript(kScriptChars); | 461 LoadScript(kScriptChars); |
| 462 | 462 |
| 463 // Save/restore some compiler flags. | 463 // Save/restore some compiler flags. |
| 464 Dart_Handle dart_args[2]; | 464 Dart_Handle dart_args[2]; |
| 465 int saved_threshold = FLAG_optimization_counter_threshold; | 465 int saved_threshold = FLAG_optimization_counter_threshold; |
| 466 const int kLowThreshold = 100; | 466 const int kLowThreshold = 100; |
| 467 const int kHighThreshold = 10000; | 467 const int kHighThreshold = 10000; |
| 468 bool saved_osr = FLAG_use_osr; | 468 Isolate* isolate = Isolate::Current(); |
| 469 FLAG_use_osr = false; | 469 const bool saved_use_osr = isolate->use_osr(); |
| 470 isolate->set_use_osr(false); |
| 470 | 471 |
| 471 if (optimize) { | 472 if (optimize) { |
| 472 // Warm up the code to make sure it gets optimized. We ignore any | 473 // Warm up the code to make sure it gets optimized. We ignore any |
| 473 // breakpoints that get hit during warm-up. | 474 // breakpoints that get hit during warm-up. |
| 474 FLAG_optimization_counter_threshold = kLowThreshold; | 475 FLAG_optimization_counter_threshold = kLowThreshold; |
| 475 dart_args[0] = Dart_False(); | 476 dart_args[0] = Dart_False(); |
| 476 dart_args[1] = Dart_NewInteger(kLowThreshold); | 477 dart_args[1] = Dart_NewInteger(kLowThreshold); |
| 477 EXPECT_VALID(Dart_Invoke(script_lib, NewString("test"), 2, dart_args)); | 478 EXPECT_VALID(Dart_Invoke(script_lib, NewString("test"), 2, dart_args)); |
| 478 } else { | 479 } else { |
| 479 // Try to ensure that none of the test code gets optimized. | 480 // Try to ensure that none of the test code gets optimized. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 504 "[0] breakpointNow { }\n" | 505 "[0] breakpointNow { }\n" |
| 505 "[1] helper { a = 5 b = 99 stop = true }\n" | 506 "[1] helper { a = 5 b = 99 stop = true }\n" |
| 506 "[2] anotherMiddleMan { one = 5 two = 99 stop = true }\n" | 507 "[2] anotherMiddleMan { one = 5 two = 99 stop = true }\n" |
| 507 "[3] middleMan { x = 5 limit = 100 stop = true value = 24255" | 508 "[3] middleMan { x = 5 limit = 100 stop = true value = 24255" |
| 508 " i = 99 }\n" | 509 " i = 99 }\n" |
| 509 "[4] test { stop = true limit = 100 }\n", | 510 "[4] test { stop = true limit = 100 }\n", |
| 510 stack_buffer); | 511 stack_buffer); |
| 511 } | 512 } |
| 512 | 513 |
| 513 FLAG_optimization_counter_threshold = saved_threshold; | 514 FLAG_optimization_counter_threshold = saved_threshold; |
| 514 FLAG_use_osr = saved_osr; | 515 isolate->set_use_osr(saved_use_osr); |
| 515 } | 516 } |
| 516 | 517 |
| 517 | 518 |
| 518 TEST_CASE(Debug_InspectStack_NotOptimized) { | 519 TEST_CASE(Debug_InspectStack_NotOptimized) { |
| 519 InspectStackTest(false); | 520 InspectStackTest(false); |
| 520 } | 521 } |
| 521 | 522 |
| 522 | 523 |
| 523 TEST_CASE(Debug_InspectStack_Optimized) { | 524 TEST_CASE(Debug_InspectStack_Optimized) { |
| 524 // Ensure code gets optimized. | 525 // Ensure code gets optimized. |
| (...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 " null, 5, 17, 5, 18, 9, 19, 12," | 2357 " null, 5, 17, 5, 18, 9, 19, 12," |
| 2357 " null, 6, 21, 1," | 2358 " null, 6, 21, 1," |
| 2358 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2359 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
| 2359 " null, 9, 29, 1]", | 2360 " null, 9, 29, 1]", |
| 2360 tokens_cstr); | 2361 tokens_cstr); |
| 2361 } | 2362 } |
| 2362 | 2363 |
| 2363 #endif | 2364 #endif |
| 2364 | 2365 |
| 2365 } // namespace dart | 2366 } // namespace dart |
| OLD | NEW |