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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/dart.h" | 6 #include "vm/dart.h" |
7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 #include "vm/zone.h" | 9 #include "vm/zone.h" |
10 | 10 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 zone.CapacityInBytes(), zone.SizeInBytes()); | 221 zone.CapacityInBytes(), zone.SizeInBytes()); |
222 EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes()); | 222 EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes()); |
223 EXPECT_SUBSTRING(size_buf, json); | 223 EXPECT_SUBSTRING(size_buf, json); |
224 } | 224 } |
225 } | 225 } |
226 EXPECT(thread->zone() == NULL); | 226 EXPECT(thread->zone() == NULL); |
227 Dart_ShutdownIsolate(); | 227 Dart_ShutdownIsolate(); |
228 } | 228 } |
229 #endif | 229 #endif |
230 | 230 |
| 231 |
| 232 UNIT_TEST_CASE(NativeScopeZoneAllocation) { |
| 233 ASSERT(ApiNativeScope::Current() == NULL); |
| 234 ASSERT(Thread::Current() == NULL); |
| 235 EXPECT_EQ(0, ApiNativeScope::current_memory_usage()); |
| 236 { |
| 237 ApiNativeScope scope; |
| 238 EXPECT_EQ(scope.zone()->CapacityInBytes(), |
| 239 ApiNativeScope::current_memory_usage()); |
| 240 (void)Dart_ScopeAllocate(2048); |
| 241 EXPECT_EQ(scope.zone()->CapacityInBytes(), |
| 242 ApiNativeScope::current_memory_usage()); |
| 243 } |
| 244 EXPECT_EQ(0, ApiNativeScope::current_memory_usage()); |
| 245 } |
| 246 |
231 } // namespace dart | 247 } // namespace dart |
OLD | NEW |