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 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 TestCase::CreateTestIsolate(); | 2212 TestCase::CreateTestIsolate(); |
2213 Isolate* isolate = Isolate::Current(); | 2213 Isolate* isolate = Isolate::Current(); |
2214 EXPECT(isolate != NULL); | 2214 EXPECT(isolate != NULL); |
2215 ApiState* state = isolate->api_state(); | 2215 ApiState* state = isolate->api_state(); |
2216 EXPECT(state != NULL); | 2216 EXPECT(state != NULL); |
2217 ApiLocalScope* scope = state->top_scope(); | 2217 ApiLocalScope* scope = state->top_scope(); |
2218 { | 2218 { |
2219 // Start a new scope and allocate some memory. | 2219 // Start a new scope and allocate some memory. |
2220 Dart_EnterScope(); | 2220 Dart_EnterScope(); |
2221 for (int i = 0; i < 100; i++) { | 2221 for (int i = 0; i < 100; i++) { |
2222 Api::Allocate(isolate, 16); | 2222 Dart_ScopeAllocate(16); |
2223 } | 2223 } |
2224 EXPECT_EQ(1600, state->ZoneSizeInBytes()); | 2224 EXPECT_EQ(1600, state->ZoneSizeInBytes()); |
2225 // Start another scope and allocate some more memory. | 2225 // Start another scope and allocate some more memory. |
2226 { | 2226 { |
2227 Dart_EnterScope(); | 2227 Dart_EnterScope(); |
2228 for (int i = 0; i < 100; i++) { | 2228 for (int i = 0; i < 100; i++) { |
2229 Api::Allocate(isolate, 16); | 2229 Dart_ScopeAllocate(16); |
2230 } | 2230 } |
2231 EXPECT_EQ(3200, state->ZoneSizeInBytes()); | 2231 EXPECT_EQ(3200, state->ZoneSizeInBytes()); |
2232 { | 2232 { |
2233 // Start another scope and allocate some more memory. | 2233 // Start another scope and allocate some more memory. |
2234 { | 2234 { |
2235 Dart_EnterScope(); | 2235 Dart_EnterScope(); |
2236 for (int i = 0; i < 200; i++) { | 2236 for (int i = 0; i < 200; i++) { |
2237 Api::Allocate(isolate, 16); | 2237 Dart_ScopeAllocate(16); |
2238 } | 2238 } |
2239 EXPECT_EQ(6400, state->ZoneSizeInBytes()); | 2239 EXPECT_EQ(6400, state->ZoneSizeInBytes()); |
2240 Dart_ExitScope(); | 2240 Dart_ExitScope(); |
2241 } | 2241 } |
2242 } | 2242 } |
2243 EXPECT_EQ(3200, state->ZoneSizeInBytes()); | 2243 EXPECT_EQ(3200, state->ZoneSizeInBytes()); |
2244 Dart_ExitScope(); | 2244 Dart_ExitScope(); |
2245 } | 2245 } |
2246 EXPECT_EQ(1600, state->ZoneSizeInBytes()); | 2246 EXPECT_EQ(1600, state->ZoneSizeInBytes()); |
2247 Dart_ExitScope(); | 2247 Dart_ExitScope(); |
(...skipping 4285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6533 EXPECT(Dart_IsString(str)); | 6533 EXPECT(Dart_IsString(str)); |
6534 len = -1; | 6534 len = -1; |
6535 EXPECT_VALID(Dart_StringLength(str, &len)); | 6535 EXPECT_VALID(Dart_StringLength(str, &len)); |
6536 EXPECT_EQ(0, len); | 6536 EXPECT_EQ(0, len); |
6537 } | 6537 } |
6538 | 6538 |
6539 | 6539 |
6540 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 6540 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
6541 | 6541 |
6542 } // namespace dart | 6542 } // namespace dart |
OLD | NEW |