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

Side by Side Diff: runtime/vm/scopes.h

Issue 2411823003: VM support for running Kernel binaries. (Closed)
Patch Set: Address initial review comments Created 4 years, 2 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
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 #ifndef VM_SCOPES_H_ 5 #ifndef VM_SCOPES_H_
6 #define VM_SCOPES_H_ 6 #define VM_SCOPES_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 15 matching lines...) Expand all
26 const AbstractType& type) 26 const AbstractType& type)
27 : token_pos_(token_pos), 27 : token_pos_(token_pos),
28 name_(name), 28 name_(name),
29 owner_(NULL), 29 owner_(NULL),
30 type_(type), 30 type_(type),
31 const_value_(NULL), 31 const_value_(NULL),
32 is_final_(false), 32 is_final_(false),
33 is_captured_(false), 33 is_captured_(false),
34 is_invisible_(false), 34 is_invisible_(false),
35 is_captured_parameter_(false), 35 is_captured_parameter_(false),
36 is_forced_stack_(false),
36 index_(LocalVariable::kUninitializedIndex) { 37 index_(LocalVariable::kUninitializedIndex) {
37 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); 38 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle());
38 ASSERT(type.IsFinalized()); 39 ASSERT(type.IsFinalized());
39 ASSERT(name.IsSymbol()); 40 ASSERT(name.IsSymbol());
40 } 41 }
41 42
42 TokenPosition token_pos() const { return token_pos_; } 43 TokenPosition token_pos() const { return token_pos_; }
43 const String& name() const { return name_; } 44 const String& name() const { return name_; }
44 LocalScope* owner() const { return owner_; } 45 LocalScope* owner() const { return owner_; }
45 void set_owner(LocalScope* owner) { 46 void set_owner(LocalScope* owner) {
46 ASSERT(owner_ == NULL); 47 ASSERT(owner_ == NULL);
47 owner_ = owner; 48 owner_ = owner;
48 } 49 }
49 50
50 const AbstractType& type() const { return type_; } 51 const AbstractType& type() const { return type_; }
51 52
52 bool is_final() const { return is_final_; } 53 bool is_final() const { return is_final_; }
53 void set_is_final() { is_final_ = true; } 54 void set_is_final() { is_final_ = true; }
54 55
55 bool is_captured() const { return is_captured_; } 56 bool is_captured() const { return is_captured_; }
56 void set_is_captured() { is_captured_ = true; } 57 void set_is_captured() { is_captured_ = true; }
57 58
59 bool is_forced_stack() const { return is_forced_stack_; }
60 void set_is_forced_stack() { is_forced_stack_ = true; }
61
58 bool HasIndex() const { 62 bool HasIndex() const {
59 return index_ != kUninitializedIndex; 63 return index_ != kUninitializedIndex;
60 } 64 }
61 int index() const { 65 int index() const {
62 ASSERT(HasIndex()); 66 ASSERT(HasIndex());
63 return index_; 67 return index_;
64 } 68 }
65 69
66 // Assign an index to a local. 70 // Assign an index to a local.
67 void set_index(int index) { 71 void set_index(int index) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 119
116 const AbstractType& type_; // Declaration type of local variable. 120 const AbstractType& type_; // Declaration type of local variable.
117 121
118 const Instance* const_value_; // NULL or compile-time const value. 122 const Instance* const_value_; // NULL or compile-time const value.
119 123
120 bool is_final_; // If true, this variable is readonly. 124 bool is_final_; // If true, this variable is readonly.
121 bool is_captured_; // If true, this variable lives in the context, otherwise 125 bool is_captured_; // If true, this variable lives in the context, otherwise
122 // in the stack frame. 126 // in the stack frame.
123 bool is_invisible_; 127 bool is_invisible_;
124 bool is_captured_parameter_; 128 bool is_captured_parameter_;
129 bool is_forced_stack_;
125 int index_; // Allocation index in words relative to frame pointer (if not 130 int index_; // Allocation index in words relative to frame pointer (if not
126 // captured), or relative to the context pointer (if captured). 131 // captured), or relative to the context pointer (if captured).
127 132
128 friend class LocalScope; 133 friend class LocalScope;
129 DISALLOW_COPY_AND_ASSIGN(LocalVariable); 134 DISALLOW_COPY_AND_ASSIGN(LocalVariable);
130 }; 135 };
131 136
132 137
133 class NameReference : public ZoneAllocated { 138 class NameReference : public ZoneAllocated {
134 public: 139 public:
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // List of names referenced in this scope and its children that 383 // List of names referenced in this scope and its children that
379 // are not resolved to local variables. 384 // are not resolved to local variables.
380 GrowableArray<NameReference*> referenced_; 385 GrowableArray<NameReference*> referenced_;
381 386
382 DISALLOW_COPY_AND_ASSIGN(LocalScope); 387 DISALLOW_COPY_AND_ASSIGN(LocalScope);
383 }; 388 };
384 389
385 } // namespace dart 390 } // namespace dart
386 391
387 #endif // VM_SCOPES_H_ 392 #endif // VM_SCOPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698