| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_debugger_api.h" | 7 #include "include/dart_debugger_api.h" |
| 8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
| 9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 weak = Dart_NewWeakPersistentHandle(dead, | 2636 weak = Dart_NewWeakPersistentHandle(dead, |
| 2637 NULL, | 2637 NULL, |
| 2638 kSmallExternalSize, | 2638 kSmallExternalSize, |
| 2639 NopCallback); | 2639 NopCallback); |
| 2640 EXPECT_VALID(AsHandle(weak)); | 2640 EXPECT_VALID(AsHandle(weak)); |
| 2641 Dart_ExitScope(); | 2641 Dart_ExitScope(); |
| 2642 } | 2642 } |
| 2643 EXPECT_EQ(kSmallExternalSize, | 2643 EXPECT_EQ(kSmallExternalSize, |
| 2644 isolate->heap()->ExternalInWords(Heap::kOld) * kWordSize); | 2644 isolate->heap()->ExternalInWords(Heap::kOld) * kWordSize); |
| 2645 // Large enough to trigger GC in old space. Not actually allocated. | 2645 // Large enough to trigger GC in old space. Not actually allocated. |
| 2646 const intptr_t kHugeExternalSize = Heap::kHeapSizeInMB * MB; | 2646 const intptr_t kHugeExternalSize = (kWordSize == 4) ? 513 * MB : 1025 * MB; |
| 2647 Dart_NewWeakPersistentHandle(live, | 2647 Dart_NewWeakPersistentHandle(live, |
| 2648 NULL, | 2648 NULL, |
| 2649 kHugeExternalSize, | 2649 kHugeExternalSize, |
| 2650 NopCallback); | 2650 NopCallback); |
| 2651 // Expect small garbage to be collected. | 2651 // Expect small garbage to be collected. |
| 2652 EXPECT_EQ(kHugeExternalSize, | 2652 EXPECT_EQ(kHugeExternalSize, |
| 2653 isolate->heap()->ExternalInWords(Heap::kOld) * kWordSize); | 2653 isolate->heap()->ExternalInWords(Heap::kOld) * kWordSize); |
| 2654 Dart_DeleteWeakPersistentHandle(reinterpret_cast<Dart_Isolate>(isolate), | 2654 Dart_DeleteWeakPersistentHandle(reinterpret_cast<Dart_Isolate>(isolate), |
| 2655 weak); | 2655 weak); |
| 2656 Dart_ExitScope(); | 2656 Dart_ExitScope(); |
| (...skipping 6060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8717 NewString("main"), | 8717 NewString("main"), |
| 8718 1, | 8718 1, |
| 8719 dart_args); | 8719 dart_args); |
| 8720 int64_t value = 0; | 8720 int64_t value = 0; |
| 8721 result = Dart_IntegerToInt64(result, &value); | 8721 result = Dart_IntegerToInt64(result, &value); |
| 8722 EXPECT_VALID(result); | 8722 EXPECT_VALID(result); |
| 8723 EXPECT_EQ(6, value); | 8723 EXPECT_EQ(6, value); |
| 8724 } | 8724 } |
| 8725 | 8725 |
| 8726 } // namespace dart | 8726 } // namespace dart |
| OLD | NEW |