| OLD | NEW |
| 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 "vm/bootstrap.h" | 5 #include "vm/bootstrap.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 #include "vm/object_store.h" | 12 #include "vm/object_store.h" |
| 13 #include "vm/service_isolate.h" | 13 #include "vm/service_isolate.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Helper macros for declaring and defining native entries. | 17 // Helper macros for declaring and defining native entries. |
| 18 #define REGISTER_NATIVE_ENTRY(name, count) \ | 18 #define REGISTER_NATIVE_ENTRY(name, count) \ |
| 19 {"" #name, BootstrapNatives::DN_##name, count}, | 19 {"" #name, BootstrapNatives::DN_##name, count}, |
| 20 | 20 |
| 21 | 21 |
| 22 // List all native functions implemented in the vm or core bootstrap dart | 22 // List all native functions implemented in the vm or core bootstrap dart |
| 23 // libraries so that we can resolve the native function to it's entry | 23 // libraries so that we can resolve the native function to it's entry |
| 24 // point. | 24 // point. |
| 25 static struct NativeEntries { | 25 static struct NativeEntries { |
| 26 const char* name_; | 26 const char* name_; |
| 27 Dart_NativeFunction function_; | 27 Dart_NativeFunction function_; |
| 28 int argument_count_; | 28 int argument_count_; |
| 29 } BootStrapEntries[] = {BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) | 29 } BootStrapEntries[] = {BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) |
| 30 #ifndef PRODUCT | 30 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 31 MIRRORS_BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) | 31 MIRRORS_BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) |
| 32 #endif // !PRODUCT | 32 #endif // !PRODUCT && !DART_PRECOMPILED_RUNTIME |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 | 35 |
| 36 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, | 36 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, |
| 37 int argument_count, | 37 int argument_count, |
| 38 bool* auto_setup_scope) { | 38 bool* auto_setup_scope) { |
| 39 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 39 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 40 if (!obj.IsString()) { | 40 if (!obj.IsString()) { |
| 41 return NULL; | 41 return NULL; |
| 42 } | 42 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 library.set_native_entry_symbol_resolver(symbol_resolver); | 140 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { | 144 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { |
| 145 return (resolver == | 145 return (resolver == |
| 146 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); | 146 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace dart | 149 } // namespace dart |
| OLD | NEW |