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

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: whitespace 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 String& class_name = String::Handle(Z); 305 String& class_name = String::Handle(Z);
306 String& function_name = String::Handle(Z); 306 String& function_name = String::Handle(Z);
307 307
308 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) { 308 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) {
309 library_uri = Symbols::New(entry_points[i].library_uri); 309 library_uri = Symbols::New(entry_points[i].library_uri);
310 class_name = Symbols::New(entry_points[i].class_name); 310 class_name = Symbols::New(entry_points[i].class_name);
311 function_name = Symbols::New(entry_points[i].function_name); 311 function_name = Symbols::New(entry_points[i].function_name);
312 312
313 lib = Library::LookupLibrary(library_uri); 313 lib = Library::LookupLibrary(library_uri);
314 if (lib.IsNull()) { 314 if (lib.IsNull()) {
315 if (FLAG_trace_precompiler) { 315 String& msg = String::Handle(Z, String::NewFormatted(
316 THR_Print("WARNING: Missing %s\n", entry_points[i].library_uri); 316 "Cannot find entry point %s\n", entry_points[i].library_uri));
317 } 317 Jump(Error::Handle(Z, ApiError::New(msg)));
318 continue; 318 UNREACHABLE();
319 } 319 }
320 320
321 if (class_name.raw() == Symbols::TopLevel().raw()) { 321 if (class_name.raw() == Symbols::TopLevel().raw()) {
322 func = lib.LookupFunctionAllowPrivate(function_name); 322 if (Library::IsPrivate(function_name)) {
323 field = lib.LookupFieldAllowPrivate(function_name); 323 function_name = lib.PrivateName(function_name);
324 }
325 func = lib.LookupLocalFunction(function_name);
326 field = lib.LookupLocalField(function_name);
324 } else { 327 } else {
325 cls = lib.LookupClassAllowPrivate(class_name); 328 if (Library::IsPrivate(class_name)) {
329 class_name = lib.PrivateName(class_name);
330 }
331 cls = lib.LookupLocalClass(class_name);
326 if (cls.IsNull()) { 332 if (cls.IsNull()) {
327 if (FLAG_trace_precompiler) { 333 String& msg = String::Handle(Z, String::NewFormatted(
328 THR_Print("WARNING: Missing %s %s\n", 334 "Cannot find entry point %s %s\n",
329 entry_points[i].library_uri, 335 entry_points[i].library_uri,
330 entry_points[i].class_name); 336 entry_points[i].class_name));
331 } 337 Jump(Error::Handle(Z, ApiError::New(msg)));
332 continue; 338 UNREACHABLE();
333 } 339 }
334 340
335 ASSERT(!cls.IsNull()); 341 ASSERT(!cls.IsNull());
336 func = cls.LookupFunctionAllowPrivate(function_name); 342 func = cls.LookupFunctionAllowPrivate(function_name);
337 field = cls.LookupField(function_name); 343 field = cls.LookupField(function_name);
338 } 344 }
339 345
340 if (func.IsNull() && field.IsNull()) { 346 if (func.IsNull() && field.IsNull()) {
341 if (FLAG_trace_precompiler) { 347 String& msg = String::Handle(Z, String::NewFormatted(
342 THR_Print("WARNING: Missing %s %s %s\n", 348 "Cannot find entry point %s %s %s\n",
343 entry_points[i].library_uri, 349 entry_points[i].library_uri,
344 entry_points[i].class_name, 350 entry_points[i].class_name,
345 entry_points[i].function_name); 351 entry_points[i].function_name));
346 } 352 Jump(Error::Handle(Z, ApiError::New(msg)));
353 UNREACHABLE();
347 } 354 }
348 355
349 if (!func.IsNull()) { 356 if (!func.IsNull()) {
350 AddFunction(func); 357 AddFunction(func);
351 if (func.IsGenerativeConstructor()) { 358 if (func.IsGenerativeConstructor()) {
352 // Allocation stubs are referenced from the call site of the 359 // Allocation stubs are referenced from the call site of the
353 // constructor, not in the constructor itself. So compiling the 360 // constructor, not in the constructor itself. So compiling the
354 // constructor isn't enough for us to discover the class is 361 // constructor isn't enough for us to discover the class is
355 // instantiated if the class isn't otherwise instantiated from Dart 362 // instantiated if the class isn't otherwise instantiated from Dart
356 // code and only instantiated from C++. 363 // code and only instantiated from C++.
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 cls = it.GetNextClass(); 1292 cls = it.GetNextClass();
1286 if (cls.IsDynamicClass()) { 1293 if (cls.IsDynamicClass()) {
1287 continue; // class 'dynamic' is in the read-only VM isolate. 1294 continue; // class 'dynamic' is in the read-only VM isolate.
1288 } 1295 }
1289 cls.set_is_allocated(false); 1296 cls.set_is_allocated(false);
1290 } 1297 }
1291 } 1298 }
1292 } 1299 }
1293 1300
1294 } // namespace dart 1301 } // 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