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

Unified Diff: runtime/vm/native_entry.cc

Issue 227433004: Add runtime and native entry tags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/native_entry.cc
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 525bfea164a5eba73389f193caf306ad0a8ee975..f08053b5369fa74c31a025316c1ad23b6cbeb6d8 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -8,6 +8,7 @@
#include "vm/dart_api_impl.h"
#include "vm/dart_api_state.h"
+#include "vm/object_store.h"
#include "vm/tags.h"
@@ -42,6 +43,37 @@ NativeFunction NativeEntry::ResolveNative(const Library& library,
}
+const char* NativeEntry::ReverseLookupInLibrary(const Library& library,
+ uword pc) {
+ if (library.native_entry_reverse_resolver() == 0) {
+ // Cannot reverse lookup native entries.
+ return NULL;
+ }
+ Dart_NativeEntryReverseResolver reverse_resolver =
+ library.native_entry_reverse_resolver();
+ return reverse_resolver(reinterpret_cast<Dart_NativeFunction>(pc));
+}
+
+
+const char* NativeEntry::ReverseLookup(uword pc) {
+ Isolate* isolate = Isolate::Current();
+ const GrowableObjectArray& libs =
+ GrowableObjectArray::Handle(isolate->object_store()->libraries());
+ ASSERT(!libs.IsNull());
+ intptr_t num_libs = libs.Length();
+ Library& lib = Library::Handle();
+ for (intptr_t i = 0; i < num_libs; i++) {
+ lib ^= libs.At(i);
+ ASSERT(!lib.IsNull());
+ const char* r = ReverseLookupInLibrary(lib, pc);
+ if (r != NULL) {
+ return r;
+ }
+ }
+ return NULL;
+}
+
+
const ExternalLabel& NativeEntry::NativeCallWrapperLabel() {
return native_call_label;
}

Powered by Google App Engine
This is Rietveld 408576698