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

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

Issue 1737693003: - Remove Isolate::Flags structure and store flags directly in isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. 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/vm/aot_optimizer.cc ('k') | runtime/vm/class_finalizer.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/ast.h" 5 #include "vm/ast.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return NULL; 568 return NULL;
569 } 569 }
570 return new StoreLocalNode(token_pos(), &local(), rhs); 570 return new StoreLocalNode(token_pos(), &local(), rhs);
571 } 571 }
572 572
573 573
574 AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) { 574 AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) {
575 if (field().is_final()) { 575 if (field().is_final()) {
576 return NULL; 576 return NULL;
577 } 577 }
578 if (Isolate::Current()->flags().type_checks()) { 578 if (Isolate::Current()->type_checks()) {
579 rhs = new AssignableNode( 579 rhs = new AssignableNode(
580 field().token_pos(), 580 field().token_pos(),
581 rhs, 581 rhs,
582 AbstractType::ZoneHandle(field().type()), 582 AbstractType::ZoneHandle(field().type()),
583 String::ZoneHandle(field().name())); 583 String::ZoneHandle(field().name()));
584 } 584 }
585 return new StoreStaticFieldNode(token_pos(), field(), rhs); 585 return new StoreStaticFieldNode(token_pos(), field(), rhs);
586 } 586 }
587 587
588 588
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 // If the prefix is not yet loaded, the getter doesn't exist. Return a 656 // If the prefix is not yet loaded, the getter doesn't exist. Return a
657 // setter that will throw a NSME at runtime. 657 // setter that will throw a NSME at runtime.
658 if (!prefix.is_loaded()) { 658 if (!prefix.is_loaded()) {
659 return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs); 659 return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs);
660 } 660 }
661 661
662 Object& obj = Object::Handle(zone, prefix.LookupObject(field_name_)); 662 Object& obj = Object::Handle(zone, prefix.LookupObject(field_name_));
663 if (obj.IsField()) { 663 if (obj.IsField()) {
664 const Field& field = Field::ZoneHandle(zone, Field::Cast(obj).raw()); 664 const Field& field = Field::ZoneHandle(zone, Field::Cast(obj).raw());
665 if (!field.is_final()) { 665 if (!field.is_final()) {
666 if (isolate->flags().type_checks()) { 666 if (isolate->type_checks()) {
667 rhs = new AssignableNode(field.token_pos(), 667 rhs = new AssignableNode(field.token_pos(),
668 rhs, 668 rhs,
669 AbstractType::ZoneHandle(zone, field.type()), 669 AbstractType::ZoneHandle(zone, field.type()),
670 field_name_); 670 field_name_);
671 } 671 }
672 return new StoreStaticFieldNode(token_pos(), field, rhs); 672 return new StoreStaticFieldNode(token_pos(), field, rhs);
673 } 673 }
674 } 674 }
675 675
676 // No field found in prefix. Look for a setter function. 676 // No field found in prefix. Look for a setter function.
(...skipping 14 matching lines...) Expand all
691 // non-existing setter that will throw an NSM error. 691 // non-existing setter that will throw an NSM error.
692 return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs); 692 return new StaticSetterNode(token_pos(), NULL, cls(), field_name_, rhs);
693 } 693 }
694 694
695 if (owner().IsLibrary()) { 695 if (owner().IsLibrary()) {
696 const Library& library = Library::Cast(owner()); 696 const Library& library = Library::Cast(owner());
697 Object& obj = Object::Handle(zone, library.ResolveName(field_name_)); 697 Object& obj = Object::Handle(zone, library.ResolveName(field_name_));
698 if (obj.IsField()) { 698 if (obj.IsField()) {
699 const Field& field = Field::ZoneHandle(zone, Field::Cast(obj).raw()); 699 const Field& field = Field::ZoneHandle(zone, Field::Cast(obj).raw());
700 if (!field.is_final()) { 700 if (!field.is_final()) {
701 if (isolate->flags().type_checks()) { 701 if (isolate->type_checks()) {
702 rhs = new AssignableNode(field.token_pos(), 702 rhs = new AssignableNode(field.token_pos(),
703 rhs, 703 rhs,
704 AbstractType::ZoneHandle(zone, field.type()), 704 AbstractType::ZoneHandle(zone, field.type()),
705 field_name_); 705 field_name_);
706 } 706 }
707 return new StoreStaticFieldNode(token_pos(), field, rhs); 707 return new StoreStaticFieldNode(token_pos(), field, rhs);
708 } 708 }
709 } 709 }
710 710
711 // No field found in library. Look for a setter function. 711 // No field found in library. Look for a setter function.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 747 }
748 #if defined(DEBUG) 748 #if defined(DEBUG)
749 const String& getter_name = 749 const String& getter_name =
750 String::Handle(zone, Field::LookupGetterSymbol(field_name_)); 750 String::Handle(zone, Field::LookupGetterSymbol(field_name_));
751 ASSERT(!getter_name.IsNull()); 751 ASSERT(!getter_name.IsNull());
752 const Function& getter = 752 const Function& getter =
753 Function::Handle(zone, cls().LookupStaticFunction(getter_name)); 753 Function::Handle(zone, cls().LookupStaticFunction(getter_name));
754 ASSERT(!getter.IsNull() && 754 ASSERT(!getter.IsNull() &&
755 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)); 755 (getter.kind() == RawFunction::kImplicitStaticFinalGetter));
756 #endif 756 #endif
757 if (isolate->flags().type_checks()) { 757 if (isolate->type_checks()) {
758 rhs = new AssignableNode( 758 rhs = new AssignableNode(
759 field.token_pos(), 759 field.token_pos(),
760 rhs, 760 rhs,
761 AbstractType::ZoneHandle(zone, field.type()), 761 AbstractType::ZoneHandle(zone, field.type()),
762 String::ZoneHandle(zone, field.name())); 762 String::ZoneHandle(zone, field.name()));
763 } 763 }
764 return new StoreStaticFieldNode(token_pos(), field, rhs); 764 return new StoreStaticFieldNode(token_pos(), field, rhs);
765 } 765 }
766 // Didn't find a static setter or a static field. Make a call to 766 // Didn't find a static setter or a static field. Make a call to
767 // the non-existent setter to trigger a NoSuchMethodError at runtime. 767 // the non-existent setter to trigger a NoSuchMethodError at runtime.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 if (result.IsError() || result.IsNull()) { 817 if (result.IsError() || result.IsNull()) {
818 // TODO(turnidge): We could get better error messages by returning 818 // TODO(turnidge): We could get better error messages by returning
819 // the Error object directly to the parser. This will involve 819 // the Error object directly to the parser. This will involve
820 // replumbing all of the EvalConstExpr methods. 820 // replumbing all of the EvalConstExpr methods.
821 return NULL; 821 return NULL;
822 } 822 }
823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); 823 return &Instance::ZoneHandle(Instance::Cast(result).raw());
824 } 824 }
825 825
826 } // namespace dart 826 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/aot_optimizer.cc ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698