Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: runtime/vm/native_entry.cc

Issue 268853003: Fix library snapshotting breakage with native entry symbol resolver (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
11 #include "vm/object_store.h" 11 #include "vm/object_store.h"
12 #include "vm/reusable_handles.h"
12 #include "vm/tags.h" 13 #include "vm/tags.h"
13 14
14 15
15 namespace dart { 16 namespace dart {
16 17
17 DEFINE_FLAG(bool, trace_natives, false, 18 DEFINE_FLAG(bool, trace_natives, false,
18 "Trace invocation of natives (debug mode only)"); 19 "Trace invocation of natives (debug mode only)");
19 20
20 21
21 static ExternalLabel native_call_label( 22 static ExternalLabel native_call_label(
(...skipping 16 matching lines...) Expand all
38 Dart_NativeFunction native_function = 39 Dart_NativeFunction native_function =
39 resolver(Api::NewHandle(Isolate::Current(), function_name.raw()), 40 resolver(Api::NewHandle(Isolate::Current(), function_name.raw()),
40 number_of_arguments, auto_setup_scope); 41 number_of_arguments, auto_setup_scope);
41 Dart_ExitScope(); // Exit the Dart API scope. 42 Dart_ExitScope(); // Exit the Dart API scope.
42 return reinterpret_cast<NativeFunction>(native_function); 43 return reinterpret_cast<NativeFunction>(native_function);
43 } 44 }
44 45
45 46
46 const uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library, 47 const uint8_t* NativeEntry::ResolveSymbolInLibrary(const Library& library,
47 uword pc) { 48 uword pc) {
48 if (library.native_entry_symbol_resolver() == 0) { 49 Dart_NativeEntrySymbol symbol_resolver =
50 library.native_entry_symbol_resolver();
51 if (symbol_resolver == 0) {
49 // Cannot reverse lookup native entries. 52 // Cannot reverse lookup native entries.
50 return NULL; 53 return NULL;
51 } 54 }
52 Dart_NativeEntrySymbol symbol_resolver =
53 library.native_entry_symbol_resolver();
54 return symbol_resolver(reinterpret_cast<Dart_NativeFunction>(pc)); 55 return symbol_resolver(reinterpret_cast<Dart_NativeFunction>(pc));
55 } 56 }
56 57
57 58
58 const uint8_t* NativeEntry::ResolveSymbol(uword pc) { 59 const uint8_t* NativeEntry::ResolveSymbol(uword pc) {
59 Isolate* isolate = Isolate::Current(); 60 Isolate* isolate = Isolate::Current();
60 const GrowableObjectArray& libs = 61 REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(isolate);
61 GrowableObjectArray::Handle(isolate->object_store()->libraries()); 62 GrowableObjectArray& libs = reused_growable_object_array_handle.Handle();
63 libs ^= isolate->object_store()->libraries();
62 ASSERT(!libs.IsNull()); 64 ASSERT(!libs.IsNull());
63 intptr_t num_libs = libs.Length(); 65 intptr_t num_libs = libs.Length();
64 Library& lib = Library::Handle();
65 for (intptr_t i = 0; i < num_libs; i++) { 66 for (intptr_t i = 0; i < num_libs; i++) {
67 REUSABLE_LIBRARY_HANDLESCOPE(isolate);
68 Library& lib = reused_library_handle.Handle();
66 lib ^= libs.At(i); 69 lib ^= libs.At(i);
67 ASSERT(!lib.IsNull()); 70 ASSERT(!lib.IsNull());
68 const uint8_t* r = ResolveSymbolInLibrary(lib, pc); 71 const uint8_t* r = ResolveSymbolInLibrary(lib, pc);
69 if (r != NULL) { 72 if (r != NULL) {
70 return r; 73 return r;
71 } 74 }
72 } 75 }
73 return NULL; 76 return NULL;
74 } 77 }
75 78
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 state->set_reusable_scope(scope); 115 state->set_reusable_scope(scope);
113 } else { 116 } else {
114 ASSERT(state->reusable_scope() != scope); 117 ASSERT(state->reusable_scope() != scope);
115 delete scope; 118 delete scope;
116 } 119 }
117 DEOPTIMIZE_ALOT; 120 DEOPTIMIZE_ALOT;
118 VERIFY_ON_TRANSITION; 121 VERIFY_ON_TRANSITION;
119 } 122 }
120 123
121 } // namespace dart 124 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698