| 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 23 matching lines...) Expand all Loading... |
| 34 int argument_count) { | 34 int argument_count) { |
| 35 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 35 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 36 if (!obj.IsString()) { | 36 if (!obj.IsString()) { |
| 37 return NULL; | 37 return NULL; |
| 38 } | 38 } |
| 39 const char* function_name = obj.ToCString(); | 39 const char* function_name = obj.ToCString(); |
| 40 ASSERT(function_name != NULL); | 40 ASSERT(function_name != NULL); |
| 41 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); | 41 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); |
| 42 for (int i = 0; i < num_entries; i++) { | 42 for (int i = 0; i < num_entries; i++) { |
| 43 struct NativeEntries* entry = &(BootStrapEntries[i]); | 43 struct NativeEntries* entry = &(BootStrapEntries[i]); |
| 44 if (!strncmp(function_name, entry->name_, strlen(entry->name_)) && | 44 if ((strcmp(function_name, entry->name_) == 0) && |
| 45 (entry->argument_count_ == argument_count)) { | 45 (entry->argument_count_ == argument_count)) { |
| 46 return reinterpret_cast<Dart_NativeFunction>(entry->function_); | 46 return reinterpret_cast<Dart_NativeFunction>(entry->function_); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 return NULL; | 49 return NULL; |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 void Bootstrap::SetupNativeResolver() { | 53 void Bootstrap::SetupNativeResolver() { |
| 54 Library& library = Library::Handle(); | 54 Library& library = Library::Handle(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 library = Library::IsolateLibrary(); | 75 library = Library::IsolateLibrary(); |
| 76 ASSERT(!library.IsNull()); | 76 ASSERT(!library.IsNull()); |
| 77 library.set_native_entry_resolver(resolver); | 77 library.set_native_entry_resolver(resolver); |
| 78 | 78 |
| 79 library = Library::ScalarlistLibrary(); | 79 library = Library::ScalarlistLibrary(); |
| 80 ASSERT(!library.IsNull()); | 80 ASSERT(!library.IsNull()); |
| 81 library.set_native_entry_resolver(resolver); | 81 library.set_native_entry_resolver(resolver); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace dart | 84 } // namespace dart |
| OLD | NEW |