| 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 13 matching lines...) Expand all Loading... |
| 24 static struct NativeEntries { | 24 static struct NativeEntries { |
| 25 const char* name_; | 25 const char* name_; |
| 26 Dart_NativeFunction function_; | 26 Dart_NativeFunction function_; |
| 27 int argument_count_; | 27 int argument_count_; |
| 28 } BootStrapEntries[] = { | 28 } BootStrapEntries[] = { |
| 29 BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) | 29 BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY) |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 | 32 |
| 33 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, | 33 Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, |
| 34 int argument_count) { | 34 int argument_count, |
| 35 bool* auto_setup_scope) { |
| 35 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); | 36 const Object& obj = Object::Handle(Api::UnwrapHandle(name)); |
| 36 if (!obj.IsString()) { | 37 if (!obj.IsString()) { |
| 37 return NULL; | 38 return NULL; |
| 38 } | 39 } |
| 40 ASSERT(auto_setup_scope); |
| 41 *auto_setup_scope = false; |
| 39 const char* function_name = obj.ToCString(); | 42 const char* function_name = obj.ToCString(); |
| 40 ASSERT(function_name != NULL); | 43 ASSERT(function_name != NULL); |
| 41 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); | 44 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); |
| 42 for (int i = 0; i < num_entries; i++) { | 45 for (int i = 0; i < num_entries; i++) { |
| 43 struct NativeEntries* entry = &(BootStrapEntries[i]); | 46 struct NativeEntries* entry = &(BootStrapEntries[i]); |
| 44 if ((strcmp(function_name, entry->name_) == 0) && | 47 if ((strcmp(function_name, entry->name_) == 0) && |
| 45 (entry->argument_count_ == argument_count)) { | 48 (entry->argument_count_ == argument_count)) { |
| 46 return reinterpret_cast<Dart_NativeFunction>(entry->function_); | 49 return reinterpret_cast<Dart_NativeFunction>(entry->function_); |
| 47 } | 50 } |
| 48 } | 51 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 library.set_native_entry_resolver(resolver); | 84 library.set_native_entry_resolver(resolver); |
| 82 } | 85 } |
| 83 | 86 |
| 84 | 87 |
| 85 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { | 88 bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) { |
| 86 return (resolver == | 89 return (resolver == |
| 87 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); | 90 reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup)); |
| 88 } | 91 } |
| 89 | 92 |
| 90 } // namespace dart | 93 } // namespace dart |
| OLD | NEW |