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

Unified Diff: runtime/vm/dart.cc

Issue 1186353004: Move allocation of static API handles Dart_True, etc. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add LocalHandle::apiHandle Created 5 years, 6 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
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 4d39b00acd22675aa26b1ad87826b9e0c66eab05..9f7c474e2ad13ff329605191731fcb71fe728334 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -70,6 +70,7 @@ class ReadOnlyHandles {
private:
VMHandles handles_;
+ LocalHandles api_handles_;
friend class Dart;
DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles);
@@ -178,10 +179,8 @@ const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
vm_isolate_->heap()->Verify(kRequireMarked);
#endif
}
- // There is a planned and known asymmetry here: We enter one scope for the VM
- // isolate so that we can allocate the "persistent" scoped handles for the
- // predefined API values (such as Dart_True, Dart_False and Dart_Null).
- Dart_EnterScope();
+ // Allocate the "persistent" scoped handles for the predefined API
+ // values (such as Dart_True, Dart_False and Dart_Null).
Api::InitHandles();
Thread::ExitIsolate(); // Unregister the VM isolate from this thread.
@@ -360,6 +359,13 @@ uword Dart::AllocateReadOnlyHandle() {
}
+LocalHandle* Dart::AllocateReadOnlyApiHandle() {
+ ASSERT(Isolate::Current() == Dart::vm_isolate());
+ ASSERT(predefined_handles_ != NULL);
+ return predefined_handles_->api_handles_.AllocateHandle();
+}
+
+
bool Dart::IsReadOnlyHandle(uword address) {
ASSERT(predefined_handles_ != NULL);
return predefined_handles_->handles_.IsValidScopedHandle(address);
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698