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_api.h" | 5 #include "include/dart_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "platform/json.h" | 7 #include "platform/json.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 | 2007 |
2008 // Garbage collect old space. This should invoke the prologue | 2008 // Garbage collect old space. This should invoke the prologue |
2009 // callback. The prologue status value should change. | 2009 // callback. The prologue status value should change. |
2010 global_prologue_callback_status = 3; | 2010 global_prologue_callback_status = 3; |
2011 global_epilogue_callback_status = 7; | 2011 global_epilogue_callback_status = 7; |
2012 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2012 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
2013 EXPECT_EQ(6, global_prologue_callback_status); | 2013 EXPECT_EQ(6, global_prologue_callback_status); |
2014 EXPECT_EQ(7, global_epilogue_callback_status); | 2014 EXPECT_EQ(7, global_epilogue_callback_status); |
2015 | 2015 |
2016 // Garbage collect old space again. Callbacks are persistent so the | 2016 // Garbage collect old space again. Callbacks are persistent so the |
2017 // prolog status value should change again. | 2017 // prologue status value should change again. |
2018 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 2018 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
2019 EXPECT_EQ(12, global_prologue_callback_status); | 2019 EXPECT_EQ(12, global_prologue_callback_status); |
2020 EXPECT_EQ(7, global_epilogue_callback_status); | 2020 EXPECT_EQ(7, global_epilogue_callback_status); |
2021 | 2021 |
2022 // Add an epilogue callback. | 2022 // Add an epilogue callback. |
2023 EXPECT_VALID(Dart_AddGcEpilogueCallback(&EpilogueCallbackTimes4)); | 2023 EXPECT_VALID(Dart_AddGcEpilogueCallback(&EpilogueCallbackTimes4)); |
2024 | 2024 |
2025 // Garbage collect new space. This should not invoke the prologue | 2025 // Garbage collect new space. This should not invoke the prologue |
2026 // or the epilogue callback. No status values should change. | 2026 // or the epilogue callback. No status values should change. |
2027 global_prologue_callback_status = 3; | 2027 global_prologue_callback_status = 3; |
(...skipping 5352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7380 Dart_LoadSource(TestCase::lib(), url, source); | 7380 Dart_LoadSource(TestCase::lib(), url, source); |
7381 | 7381 |
7382 dart_args[0] = Dart_NewInteger(1); | 7382 dart_args[0] = Dart_NewInteger(1); |
7383 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); | 7383 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); |
7384 EXPECT_VALID(result); | 7384 EXPECT_VALID(result); |
7385 } | 7385 } |
7386 | 7386 |
7387 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 7387 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
7388 | 7388 |
7389 } // namespace dart | 7389 } // namespace dart |
OLD | NEW |