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

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
« no previous file with comments | « runtime/vm/native_entry.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_entry.cc
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 525bfea164a5eba73389f193caf306ad0a8ee975..9e5fa8e8bdebc99aa58a759f6f2936b1a83d865b 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 uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library,
+ uword pc) {
+ if (library.native_entry_symbol_resolver() == 0) {
+ // Cannot reverse lookup native entries.
+ return NULL;
+ }
+ Dart_NativeEntrySymbol symbol_resolver =
+ library.native_entry_symbol_resolver();
+ return symbol_resolver(reinterpret_cast<Dart_NativeFunction>(pc));
+}
+
+
+const uint8_t* NativeEntry::ResolveSymbol(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 uint8_t* r = ResolveSymbolInLibrary(lib, pc);
+ if (r != NULL) {
+ return r;
+ }
+ }
+ return NULL;
+}
+
+
const ExternalLabel& NativeEntry::NativeCallWrapperLabel() {
return native_call_label;
}
« no previous file with comments | « runtime/vm/native_entry.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698