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

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

Issue 1663893002: Precompilation: Make missing entry points an error. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « runtime/bin/main.cc ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/cha.h" 7 #include "vm/cha.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/hash_table.h" 10 #include "vm/hash_table.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 String& class_name = String::Handle(Z); 304 String& class_name = String::Handle(Z);
305 String& function_name = String::Handle(Z); 305 String& function_name = String::Handle(Z);
306 306
307 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) { 307 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) {
308 library_uri = Symbols::New(entry_points[i].library_uri); 308 library_uri = Symbols::New(entry_points[i].library_uri);
309 class_name = Symbols::New(entry_points[i].class_name); 309 class_name = Symbols::New(entry_points[i].class_name);
310 function_name = Symbols::New(entry_points[i].function_name); 310 function_name = Symbols::New(entry_points[i].function_name);
311 311
312 lib = Library::LookupLibrary(library_uri); 312 lib = Library::LookupLibrary(library_uri);
313 if (lib.IsNull()) { 313 if (lib.IsNull()) {
314 if (FLAG_trace_precompiler) { 314 String& msg = String::Handle(Z, String::NewFormatted(
315 THR_Print("WARNING: Missing %s\n", entry_points[i].library_uri); 315 "Cannot find entry point %s\n", entry_points[i].library_uri));
316 } 316 Jump(Error::Handle(Z, ApiError::New(msg)));
317 continue; 317 UNREACHABLE();
318 } 318 }
319 319
320 if (class_name.raw() == Symbols::TopLevel().raw()) { 320 if (class_name.raw() == Symbols::TopLevel().raw()) {
321 func = lib.LookupFunctionAllowPrivate(function_name); 321 if (Library::IsPrivate(function_name)) {
322 field = lib.LookupFieldAllowPrivate(function_name); 322 function_name = lib.PrivateName(function_name);
323 }
324 func = lib.LookupLocalFunction(function_name);
325 field = lib.LookupLocalField(function_name);
323 } else { 326 } else {
324 cls = lib.LookupClassAllowPrivate(class_name); 327 if (Library::IsPrivate(class_name)) {
328 class_name = lib.PrivateName(class_name);
329 }
330 cls = lib.LookupLocalClass(class_name);
325 if (cls.IsNull()) { 331 if (cls.IsNull()) {
326 if (FLAG_trace_precompiler) { 332 String& msg = String::Handle(Z, String::NewFormatted(
327 THR_Print("WARNING: Missing %s %s\n", 333 "Cannot find entry point %s %s\n",
328 entry_points[i].library_uri, 334 entry_points[i].library_uri,
329 entry_points[i].class_name); 335 entry_points[i].class_name));
330 } 336 Jump(Error::Handle(Z, ApiError::New(msg)));
331 continue; 337 UNREACHABLE();
332 } 338 }
333 339
334 ASSERT(!cls.IsNull()); 340 ASSERT(!cls.IsNull());
335 func = cls.LookupFunctionAllowPrivate(function_name); 341 func = cls.LookupFunctionAllowPrivate(function_name);
336 field = cls.LookupField(function_name); 342 field = cls.LookupField(function_name);
337 } 343 }
338 344
339 if (func.IsNull() && field.IsNull()) { 345 if (func.IsNull() && field.IsNull()) {
340 if (FLAG_trace_precompiler) { 346 String& msg = String::Handle(Z, String::NewFormatted(
Florian Schneider 2016/02/04 21:51:48 Uneven indentation?
rmacnak 2016/02/04 22:25:57 Fixed
341 THR_Print("WARNING: Missing %s %s %s\n", 347 "Cannot find entry point %s %s %s\n",
342 entry_points[i].library_uri, 348 entry_points[i].library_uri,
343 entry_points[i].class_name, 349 entry_points[i].class_name,
344 entry_points[i].function_name); 350 entry_points[i].function_name));
345 } 351 Jump(Error::Handle(Z, ApiError::New(msg)));
352 UNREACHABLE();
346 } 353 }
347 354
348 if (!func.IsNull()) { 355 if (!func.IsNull()) {
349 AddFunction(func); 356 AddFunction(func);
350 if (func.IsGenerativeConstructor()) { 357 if (func.IsGenerativeConstructor()) {
351 // Allocation stubs are referenced from the call site of the 358 // Allocation stubs are referenced from the call site of the
352 // constructor, not in the constructor itself. So compiling the 359 // constructor, not in the constructor itself. So compiling the
353 // constructor isn't enough for us to discover the class is 360 // constructor isn't enough for us to discover the class is
354 // instantiated if the class isn't otherwise instantiated from Dart 361 // instantiated if the class isn't otherwise instantiated from Dart
355 // code and only instantiated from C++. 362 // code and only instantiated from C++.
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 cls = it.GetNextClass(); 1273 cls = it.GetNextClass();
1267 if (cls.IsDynamicClass()) { 1274 if (cls.IsDynamicClass()) {
1268 continue; // class 'dynamic' is in the read-only VM isolate. 1275 continue; // class 'dynamic' is in the read-only VM isolate.
1269 } 1276 }
1270 cls.set_is_allocated(false); 1277 cls.set_is_allocated(false);
1271 } 1278 }
1272 } 1279 }
1273 } 1280 }
1274 1281
1275 } // namespace dart 1282 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698