Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 9347040: Add API function Dart_ZoneAllocate (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from turnidge@ Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index ecf07cf967a51e0faf122ea65c30c0169527d7a1..c99f3649708c377b5e82ad957a87638a825dab8c 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -224,7 +224,7 @@ uword Api::Allocate(intptr_t size) {
ASSERT(state != NULL);
ApiLocalScope* scope = state->top_scope();
ASSERT(scope != NULL);
- return scope->zone().Allocate(size);
+ return scope->zone()->Allocate(size);
}
@@ -235,7 +235,7 @@ uword Api::Reallocate(uword ptr, intptr_t old_size, intptr_t new_size) {
ASSERT(state != NULL);
ApiLocalScope* scope = state->top_scope();
ASSERT(scope != NULL);
- return scope->zone().Reallocate(ptr, old_size, new_size);
+ return scope->zone()->Reallocate(ptr, old_size, new_size);
}
@@ -836,6 +836,23 @@ DART_EXPORT void Dart_ExitScope() {
}
+DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size) {
+ ApiZone* zone;
+ Isolate* isolate = Isolate::Current();
+ if (isolate != NULL) {
+ ApiState* state = isolate->api_state();
+ if (state == NULL) return NULL;
+ ApiLocalScope* scope = state->top_scope();
+ zone = scope->zone();
+ } else {
+ ApiNativeScope* scope = ApiNativeScope::Current();
+ if (scope == NULL) return NULL;
+ zone = scope->zone();
+ }
+ return reinterpret_cast<uint8_t*>(zone->Allocate(size));
+}
+
+
// --- Objects ----

Powered by Google App Engine
This is Rietveld 408576698