| 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 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 uword Api::Allocate(intptr_t size) { | 220 uword Api::Allocate(intptr_t size) { |
| 221 Isolate* isolate = Isolate::Current(); | 221 Isolate* isolate = Isolate::Current(); |
| 222 ASSERT(isolate != NULL); | 222 ASSERT(isolate != NULL); |
| 223 ApiState* state = isolate->api_state(); | 223 ApiState* state = isolate->api_state(); |
| 224 ASSERT(state != NULL); | 224 ASSERT(state != NULL); |
| 225 ApiLocalScope* scope = state->top_scope(); | 225 ApiLocalScope* scope = state->top_scope(); |
| 226 ASSERT(scope != NULL); | 226 ASSERT(scope != NULL); |
| 227 return scope->zone().Allocate(size); | 227 return scope->zone()->Allocate(size); |
| 228 } | 228 } |
| 229 | 229 |
| 230 | 230 |
| 231 uword Api::Reallocate(uword ptr, intptr_t old_size, intptr_t new_size) { | 231 uword Api::Reallocate(uword ptr, intptr_t old_size, intptr_t new_size) { |
| 232 Isolate* isolate = Isolate::Current(); | 232 Isolate* isolate = Isolate::Current(); |
| 233 ASSERT(isolate != NULL); | 233 ASSERT(isolate != NULL); |
| 234 ApiState* state = isolate->api_state(); | 234 ApiState* state = isolate->api_state(); |
| 235 ASSERT(state != NULL); | 235 ASSERT(state != NULL); |
| 236 ApiLocalScope* scope = state->top_scope(); | 236 ApiLocalScope* scope = state->top_scope(); |
| 237 ASSERT(scope != NULL); | 237 ASSERT(scope != NULL); |
| 238 return scope->zone().Reallocate(ptr, old_size, new_size); | 238 return scope->zone()->Reallocate(ptr, old_size, new_size); |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 void Api::InitOnce() { | 242 void Api::InitOnce() { |
| 243 ASSERT(api_native_key_ == Thread::kUnsetThreadLocalKey); | 243 ASSERT(api_native_key_ == Thread::kUnsetThreadLocalKey); |
| 244 api_native_key_ = Thread::CreateThreadLocal(); | 244 api_native_key_ = Thread::CreateThreadLocal(); |
| 245 ASSERT(api_native_key_ != Thread::kUnsetThreadLocalKey); | 245 ASSERT(api_native_key_ != Thread::kUnsetThreadLocalKey); |
| 246 } | 246 } |
| 247 | 247 |
| 248 | 248 |
| (...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 } else { | 2687 } else { |
| 2688 *buffer = NULL; | 2688 *buffer = NULL; |
| 2689 } | 2689 } |
| 2690 delete debug_region; | 2690 delete debug_region; |
| 2691 } else { | 2691 } else { |
| 2692 *buffer = NULL; | 2692 *buffer = NULL; |
| 2693 *buffer_size = 0; | 2693 *buffer_size = 0; |
| 2694 } | 2694 } |
| 2695 } | 2695 } |
| 2696 | 2696 |
| 2697 |
| 2698 DART_EXPORT uint8_t* Dart_ZoneAllocate(intptr_t size) { |
| 2699 ApiZone* zone; |
| 2700 Isolate* isolate = Isolate::Current(); |
| 2701 if (isolate != NULL) { |
| 2702 ApiState* state = isolate->api_state(); |
| 2703 if (state == NULL) return NULL; |
| 2704 ApiLocalScope* scope = state->top_scope(); |
| 2705 zone = scope->zone(); |
| 2706 } else { |
| 2707 ApiNativeScope* scope = ApiNativeScope::Current(); |
| 2708 if (scope == NULL) return NULL; |
| 2709 zone = scope->zone(); |
| 2710 } |
| 2711 return reinterpret_cast<uint8_t*>(zone->Allocate(size)); |
| 2712 } |
| 2713 |
| 2697 } // namespace dart | 2714 } // namespace dart |
| OLD | NEW |