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

Side by Side Diff: dart/runtime/vm/class_finalizer.cc

Issue 75123002: Version 1.0.0.6 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | « dart/runtime/lib/mirrors.cc ('k') | dart/runtime/vm/dart_api_impl.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/code_generator.h"
7 #include "vm/flags.h" 8 #include "vm/flags.h"
8 #include "vm/heap.h" 9 #include "vm/heap.h"
9 #include "vm/isolate.h" 10 #include "vm/isolate.h"
10 #include "vm/longjump.h" 11 #include "vm/longjump.h"
11 #include "vm/object_store.h" 12 #include "vm/object_store.h"
12 #include "vm/parser.h"
13 #include "vm/symbols.h" 13 #include "vm/symbols.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DEFINE_FLAG(bool, error_on_bad_override, false, 17 DEFINE_FLAG(bool, error_on_bad_override, false,
18 "Report error for bad overrides."); 18 "Report error for bad overrides.");
19 DEFINE_FLAG(bool, error_on_bad_type, false, 19 DEFINE_FLAG(bool, error_on_bad_type, false,
20 "Report error for malformed types."); 20 "Report error for malformed types.");
21 DEFINE_FLAG(bool, print_classes, false, "Prints details about loaded classes."); 21 DEFINE_FLAG(bool, print_classes, false, "Prints details about loaded classes.");
22 DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization."); 22 DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization.");
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 OS::Print(" %s\n", field.ToCString()); 2616 OS::Print(" %s\n", field.ToCString());
2617 } 2617 }
2618 } 2618 }
2619 2619
2620 // Either report an error or mark the type as malformed. 2620 // Either report an error or mark the type as malformed.
2621 void ClassFinalizer::ReportMalformedType(const Error& prev_error, 2621 void ClassFinalizer::ReportMalformedType(const Error& prev_error,
2622 const Script& script, 2622 const Script& script,
2623 const Type& type, 2623 const Type& type,
2624 const char* format, 2624 const char* format,
2625 va_list args) { 2625 va_list args) {
2626 LanguageError& error = LanguageError::Handle(); 2626 LanguageError& error = LanguageError::Handle(
2627 if (prev_error.IsNull()) { 2627 LanguageError::NewFormattedV(
2628 error ^= Parser::FormatError( 2628 prev_error, script, type.token_pos(),
2629 script, type.token_pos(), "Error", format, args); 2629 LanguageError::kMalformedType, Heap::kOld,
2630 } else { 2630 format, args));
2631 error ^= Parser::FormatErrorWithAppend(
2632 prev_error, script, type.token_pos(), "Error", format, args);
2633 }
2634 if (FLAG_error_on_bad_type) { 2631 if (FLAG_error_on_bad_type) {
2635 ReportError(error); 2632 ReportError(error);
2636 } 2633 }
2637 type.set_malformed_error(error); 2634 type.set_malformed_error(error);
2638 // Make the type raw, since it may not be possible to 2635 // Make the type raw, since it may not be possible to
2639 // properly finalize its type arguments. 2636 // properly finalize its type arguments.
2640 type.set_type_class(Class::Handle(Object::dynamic_class())); 2637 type.set_type_class(Class::Handle(Object::dynamic_class()));
2641 type.set_arguments(Object::null_abstract_type_arguments()); 2638 type.set_arguments(Object::null_abstract_type_arguments());
2642 if (!type.IsFinalized()) { 2639 if (!type.IsFinalized()) {
2643 type.SetIsFinalized(); 2640 type.SetIsFinalized();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 UNREACHABLE(); 2683 UNREACHABLE();
2687 } 2684 }
2688 2685
2689 2686
2690 void ClassFinalizer::ReportError(const Error& prev_error, 2687 void ClassFinalizer::ReportError(const Error& prev_error,
2691 const Script& script, 2688 const Script& script,
2692 intptr_t token_pos, 2689 intptr_t token_pos,
2693 const char* format, ...) { 2690 const char* format, ...) {
2694 va_list args; 2691 va_list args;
2695 va_start(args, format); 2692 va_start(args, format);
2696 Error& error = Error::Handle(); 2693 Error& error = Error::Handle(
2697 if (prev_error.IsNull()) { 2694 LanguageError::NewFormattedV(
2698 error ^= Parser::FormatError(script, token_pos, "Error", format, args); 2695 prev_error, script, token_pos,
2699 } else { 2696 LanguageError::kError, Heap::kNew,
2700 error ^= Parser::FormatErrorWithAppend( 2697 format, args));
2701 prev_error, script, token_pos, "Error", format, args);
2702 }
2703 va_end(args); 2698 va_end(args);
2704 ReportError(error); 2699 ReportError(error);
2705 } 2700 }
2706 2701
2707 2702
2708 void ClassFinalizer::VerifyImplicitFieldOffsets() { 2703 void ClassFinalizer::VerifyImplicitFieldOffsets() {
2709 #ifdef DEBUG 2704 #ifdef DEBUG
2710 Isolate* isolate = Isolate::Current(); 2705 Isolate* isolate = Isolate::Current();
2711 const ClassTable& class_table = *(isolate->class_table()); 2706 const ClassTable& class_table = *(isolate->class_table());
2712 Class& cls = Class::Handle(isolate); 2707 Class& cls = Class::Handle(isolate);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 expected_name ^= String::New("_offset"); 2753 expected_name ^= String::New("_offset");
2759 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 2754 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
2760 field ^= fields_array.At(2); 2755 field ^= fields_array.At(2);
2761 ASSERT(field.Offset() == TypedDataView::length_offset()); 2756 ASSERT(field.Offset() == TypedDataView::length_offset());
2762 name ^= field.name(); 2757 name ^= field.name();
2763 ASSERT(name.Equals("length")); 2758 ASSERT(name.Equals("length"));
2764 #endif 2759 #endif
2765 } 2760 }
2766 2761
2767 } // namespace dart 2762 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/lib/mirrors.cc ('k') | dart/runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698