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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } else { 2515 } else {
2516 *buffer = NULL; 2516 *buffer = NULL;
2517 } 2517 }
2518 delete debug_region; 2518 delete debug_region;
2519 } else { 2519 } else {
2520 *buffer = NULL; 2520 *buffer = NULL;
2521 *buffer_size = 0; 2521 *buffer_size = 0;
2522 } 2522 }
2523 } 2523 }
2524 2524
2525
2526 DART_EXPORT uint8_t* Dart_ZoneAllocate(intptr_t size) {
2527 ApiZone* zone;
2528 Isolate* isolate = Isolate::Current();
2529 if (isolate != NULL) {
2530 ApiState* state = isolate->api_state();
2531 if (state == NULL) return NULL;
2532 ApiLocalScope* scope = state->top_scope();
2533 zone = &scope->zone();
2534 } else {
2535 ApiNativeScope* scope = ApiNativeScope::Current();
2536 if (scope == NULL) return NULL;
2537 zone = &scope->zone();
2538 }
2539 return reinterpret_cast<uint8_t*>(zone->Allocate(size));
2540 }
2541
2525 } // namespace dart 2542 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698