| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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[] = { | 29 } BootStrapEntries[] = { |
| 30 BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) | 30 BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) |
| 31 #ifndef PRODUCT |
| 32 MIRRORS_BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) |
| 33 #endif // !PRODUCT |
| 31 }; | 34 }; |
| 32 | 35 |
| 33 | 36 |
| 34 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, | 37 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, |
| 35 int argument_count, | 38 int argument_count, |
| 36 bool* auto_setup_scope) { | 39 bool* auto_setup_scope) { |
| 37 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 40 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 38 if (!obj.IsString()) { | 41 if (!obj.IsString()) { |
| 39 return NULL; | 42 return NULL; |
| 40 } | 43 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 library = Library::IsolateLibrary(); | 112 library = Library::IsolateLibrary(); |
| 110 ASSERT(!library.IsNull()); | 113 ASSERT(!library.IsNull()); |
| 111 library.set_native_entry_resolver(resolver); | 114 library.set_native_entry_resolver(resolver); |
| 112 library.set_native_entry_symbol_resolver(symbol_resolver); | 115 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 113 | 116 |
| 114 library = Library::MathLibrary(); | 117 library = Library::MathLibrary(); |
| 115 ASSERT(!library.IsNull()); | 118 ASSERT(!library.IsNull()); |
| 116 library.set_native_entry_resolver(resolver); | 119 library.set_native_entry_resolver(resolver); |
| 117 library.set_native_entry_symbol_resolver(symbol_resolver); | 120 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 118 | 121 |
| 122 NOT_IN_PRODUCT( |
| 119 library = Library::MirrorsLibrary(); | 123 library = Library::MirrorsLibrary(); |
| 120 ASSERT(!library.IsNull()); | 124 ASSERT(!library.IsNull()); |
| 121 library.set_native_entry_resolver(resolver); | 125 library.set_native_entry_resolver(resolver); |
| 122 library.set_native_entry_symbol_resolver(symbol_resolver); | 126 library.set_native_entry_symbol_resolver(symbol_resolver)); |
| 123 | 127 |
| 124 library = Library::ProfilerLibrary(); | 128 library = Library::ProfilerLibrary(); |
| 125 ASSERT(!library.IsNull()); | 129 ASSERT(!library.IsNull()); |
| 126 library.set_native_entry_resolver(resolver); | 130 library.set_native_entry_resolver(resolver); |
| 127 library.set_native_entry_symbol_resolver(symbol_resolver); | 131 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 128 | 132 |
| 129 library = Library::TypedDataLibrary(); | 133 library = Library::TypedDataLibrary(); |
| 130 ASSERT(!library.IsNull()); | 134 ASSERT(!library.IsNull()); |
| 131 library.set_native_entry_resolver(resolver); | 135 library.set_native_entry_resolver(resolver); |
| 132 library.set_native_entry_symbol_resolver(symbol_resolver); | 136 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 133 | 137 |
| 134 library = Library::VMServiceLibrary(); | 138 library = Library::VMServiceLibrary(); |
| 135 ASSERT(!library.IsNull()); | 139 ASSERT(!library.IsNull()); |
| 136 library.set_native_entry_resolver(resolver); | 140 library.set_native_entry_resolver(resolver); |
| 137 library.set_native_entry_symbol_resolver(symbol_resolver); | 141 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 138 } | 142 } |
| 139 | 143 |
| 140 | 144 |
| 141 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { | 145 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { |
| 142 return (resolver == | 146 return (resolver == |
| 143 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); | 147 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); |
| 144 } | 148 } |
| 145 | 149 |
| 146 } // namespace dart | 150 } // namespace dart |
| OLD | NEW |