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

Side by Side Diff: vm/class_finalizer.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
OLDNEW
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/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
11 #include "vm/object_store.h" 11 #include "vm/object_store.h"
12 #include "vm/parser.h" 12 #include "vm/parser.h"
13 #include "vm/symbols.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DEFINE_FLAG(bool, print_classes, false, "Prints details about loaded classes."); 17 DEFINE_FLAG(bool, print_classes, false, "Prints details about loaded classes.");
17 DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization."); 18 DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization.");
18 DEFINE_FLAG(bool, trace_type_finalization, false, "Trace type finalization."); 19 DEFINE_FLAG(bool, trace_type_finalization, false, "Trace type finalization.");
19 DEFINE_FLAG(bool, verify_implements, false, 20 DEFINE_FLAG(bool, verify_implements, false,
20 "Verify that all classes implement their interface."); 21 "Verify that all classes implement their interface.");
21 DECLARE_FLAG(bool, enable_type_checks); 22 DECLARE_FLAG(bool, enable_type_checks);
22 23
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // If cls belongs to core lib or to core lib's implementation, restrictions 335 // If cls belongs to core lib or to core lib's implementation, restrictions
335 // about allowed interfaces are lifted. 336 // about allowed interfaces are lifted.
336 if ((cls.library() != Library::CoreLibrary()) && 337 if ((cls.library() != Library::CoreLibrary()) &&
337 (cls.library() != Library::CoreImplLibrary())) { 338 (cls.library() != Library::CoreImplLibrary())) {
338 // Prevent extending core implementation classes Bool, Double, ObjectArray, 339 // Prevent extending core implementation classes Bool, Double, ObjectArray,
339 // ImmutableArray, GrowableObjectArray, IntegerImplementation, Smi, Mint, 340 // ImmutableArray, GrowableObjectArray, IntegerImplementation, Smi, Mint,
340 // BigInt, OneByteString, TwoByteString, FourByteString. 341 // BigInt, OneByteString, TwoByteString, FourByteString.
341 ObjectStore* object_store = Isolate::Current()->object_store(); 342 ObjectStore* object_store = Isolate::Current()->object_store();
342 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 343 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
343 const String& integer_implementation_name = 344 const String& integer_implementation_name =
344 String::Handle(String::NewSymbol("IntegerImplementation")); 345 String::Handle(Symbols::New("IntegerImplementation"));
345 const Class& integer_implementation_class = 346 const Class& integer_implementation_class =
346 Class::Handle(core_impl_lib.LookupClass(integer_implementation_name)); 347 Class::Handle(core_impl_lib.LookupClass(integer_implementation_name));
347 const String& growable_object_array_name = 348 const String& growable_object_array_name =
348 String::Handle(String::NewSymbol("GrowableObjectArray")); 349 String::Handle(Symbols::New("GrowableObjectArray"));
349 const Class& growable_object_array_class = 350 const Class& growable_object_array_class =
350 Class::Handle(core_impl_lib.LookupClass(growable_object_array_name)); 351 Class::Handle(core_impl_lib.LookupClass(growable_object_array_name));
351 if ((super_class.raw() == object_store->bool_class()) || 352 if ((super_class.raw() == object_store->bool_class()) ||
352 (super_class.raw() == object_store->double_class()) || 353 (super_class.raw() == object_store->double_class()) ||
353 (super_class.raw() == object_store->array_class()) || 354 (super_class.raw() == object_store->array_class()) ||
354 (super_class.raw() == object_store->immutable_array_class()) || 355 (super_class.raw() == object_store->immutable_array_class()) ||
355 (super_class.raw() == growable_object_array_class.raw()) || 356 (super_class.raw() == growable_object_array_class.raw()) ||
356 (super_class.raw() == object_store->int8_array_class()) || 357 (super_class.raw() == object_store->int8_array_class()) ||
357 (super_class.raw() == object_store->uint8_array_class()) || 358 (super_class.raw() == object_store->uint8_array_class()) ||
358 (super_class.raw() == object_store->int16_array_class()) || 359 (super_class.raw() == object_store->int16_array_class()) ||
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 void ClassFinalizer::ReportError(const char* format, ...) { 1506 void ClassFinalizer::ReportError(const char* format, ...) {
1506 va_list args; 1507 va_list args;
1507 va_start(args, format); 1508 va_start(args, format);
1508 const Error& error = Error::Handle( 1509 const Error& error = Error::Handle(
1509 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); 1510 Parser::FormatError(Script::Handle(), -1, "Error", format, args));
1510 va_end(args); 1511 va_end(args);
1511 ReportError(error); 1512 ReportError(error);
1512 } 1513 }
1513 1514
1514 } // namespace dart 1515 } // namespace dart
OLDNEW
« no previous file with comments | « lib/string.cc ('k') | vm/class_finalizer_test.cc » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698