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

Unified Diff: vm/bootstrap_natives.cc

Issue 10874072: Use the return value of vm native methods to set the return value, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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: vm/bootstrap_natives.cc
===================================================================
--- vm/bootstrap_natives.cc (revision 11528)
+++ vm/bootstrap_natives.cc (working copy)
@@ -13,6 +13,11 @@
namespace dart {
+// Helper macros for declaring and defining native entries.
+#define REGISTER_NATIVE_ENTRY(name, count) \
+ { ""#name, BootstrapNatives::DN_##name, count },
+
+
// List all native functions implemented in the vm or core bootstrap dart
// libraries so that we can resolve the native function to it's entry
// point.
@@ -25,8 +30,8 @@
};
-static Dart_NativeFunction NativeLookup(Dart_Handle name,
- int argument_count) {
+Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name,
+ int argument_count) {
const Object& obj = Object::Handle(Api::UnwrapHandle(name));
if (!obj.IsString()) {
return NULL;
@@ -48,25 +53,24 @@
void Bootstrap::SetupNativeResolver() {
Library& library = Library::Handle();
+ Dart_NativeEntryResolver resolver =
+ reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup);
+
library = Library::CoreLibrary();
ASSERT(!library.IsNull());
- library.set_native_entry_resolver(
- reinterpret_cast<Dart_NativeEntryResolver>(NativeLookup));
+ library.set_native_entry_resolver(resolver);
library = Library::CoreImplLibrary();
ASSERT(!library.IsNull());
- library.set_native_entry_resolver(
- reinterpret_cast<Dart_NativeEntryResolver>(NativeLookup));
+ library.set_native_entry_resolver(resolver);
library = Library::MirrorsLibrary();
ASSERT(!library.IsNull());
- library.set_native_entry_resolver(
- reinterpret_cast<Dart_NativeEntryResolver>(NativeLookup));
+ library.set_native_entry_resolver(resolver);
library = Library::IsolateLibrary();
ASSERT(!library.IsNull());
- library.set_native_entry_resolver(
- reinterpret_cast<Dart_NativeEntryResolver>(NativeLookup));
+ library.set_native_entry_resolver(resolver);
}
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698