OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/native_entry.h" | 5 #include "vm/native_entry.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 library.native_entry_symbol_resolver(); | 49 library.native_entry_symbol_resolver(); |
50 if (symbol_resolver == 0) { | 50 if (symbol_resolver == 0) { |
51 // Cannot reverse lookup native entries. | 51 // Cannot reverse lookup native entries. |
52 return NULL; | 52 return NULL; |
53 } | 53 } |
54 return symbol_resolver(reinterpret_cast<Dart_NativeFunction>(pc)); | 54 return symbol_resolver(reinterpret_cast<Dart_NativeFunction>(pc)); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 const uint8_t* NativeEntry::ResolveSymbol(uword pc) { | 58 const uint8_t* NativeEntry::ResolveSymbol(uword pc) { |
59 Isolate* isolate = Isolate::Current(); | 59 Thread* thread = Thread::Current(); |
60 REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(isolate); | 60 REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(thread); |
61 GrowableObjectArray& libs = reused_growable_object_array_handle.Handle(); | 61 GrowableObjectArray& libs = reused_growable_object_array_handle.Handle(); |
62 libs ^= isolate->object_store()->libraries(); | 62 libs ^= thread->isolate()->object_store()->libraries(); |
63 ASSERT(!libs.IsNull()); | 63 ASSERT(!libs.IsNull()); |
64 intptr_t num_libs = libs.Length(); | 64 intptr_t num_libs = libs.Length(); |
65 for (intptr_t i = 0; i < num_libs; i++) { | 65 for (intptr_t i = 0; i < num_libs; i++) { |
66 REUSABLE_LIBRARY_HANDLESCOPE(isolate); | 66 REUSABLE_LIBRARY_HANDLESCOPE(thread); |
67 Library& lib = reused_library_handle.Handle(); | 67 Library& lib = reused_library_handle.Handle(); |
68 lib ^= libs.At(i); | 68 lib ^= libs.At(i); |
69 ASSERT(!lib.IsNull()); | 69 ASSERT(!lib.IsNull()); |
70 const uint8_t* r = ResolveSymbolInLibrary(lib, pc); | 70 const uint8_t* r = ResolveSymbolInLibrary(lib, pc); |
71 if (r != NULL) { | 71 if (r != NULL) { |
72 return r; | 72 return r; |
73 } | 73 } |
74 } | 74 } |
75 return NULL; | 75 return NULL; |
76 } | 76 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (call_through_wrapper) { | 268 if (call_through_wrapper) { |
269 NativeEntry::NativeCallWrapper( | 269 NativeEntry::NativeCallWrapper( |
270 args, reinterpret_cast<Dart_NativeFunction>(target_function)); | 270 args, reinterpret_cast<Dart_NativeFunction>(target_function)); |
271 } else { | 271 } else { |
272 target_function(arguments); | 272 target_function(arguments); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 | 276 |
277 } // namespace dart | 277 } // namespace dart |
OLD | NEW |