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

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

Issue 189513003: Add alias disambiguation for VM fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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
« no previous file with comments | « runtime/vm/il_printer.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) 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 3999 matching lines...) Expand 10 before | Expand all | Expand 10 after
4010 4010
4011 class AllocateObjectInstr : public TemplateDefinition<0> { 4011 class AllocateObjectInstr : public TemplateDefinition<0> {
4012 public: 4012 public:
4013 AllocateObjectInstr(intptr_t token_pos, 4013 AllocateObjectInstr(intptr_t token_pos,
4014 const Class& cls, 4014 const Class& cls,
4015 ZoneGrowableArray<PushArgumentInstr*>* arguments) 4015 ZoneGrowableArray<PushArgumentInstr*>* arguments)
4016 : token_pos_(token_pos), 4016 : token_pos_(token_pos),
4017 cls_(cls), 4017 cls_(cls),
4018 arguments_(arguments), 4018 arguments_(arguments),
4019 identity_(kUnknown), 4019 identity_(kUnknown),
4020 closure_function_(Function::ZoneHandle()), 4020 closure_function_(Function::ZoneHandle()) {
4021 context_field_(Field::ZoneHandle()) {
4022 // Either no arguments or one type-argument and one instantiator. 4021 // Either no arguments or one type-argument and one instantiator.
4023 ASSERT(arguments->is_empty() || (arguments->length() == 1)); 4022 ASSERT(arguments->is_empty() || (arguments->length() == 1));
4024 } 4023 }
4025 4024
4026 DECLARE_INSTRUCTION(AllocateObject) 4025 DECLARE_INSTRUCTION(AllocateObject)
4027 virtual CompileType ComputeType() const; 4026 virtual CompileType ComputeType() const;
4028 4027
4029 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 4028 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
4030 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 4029 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
4031 return (*arguments_)[index]; 4030 return (*arguments_)[index];
4032 } 4031 }
4033 4032
4034 const Class& cls() const { return cls_; } 4033 const Class& cls() const { return cls_; }
4035 intptr_t token_pos() const { return token_pos_; } 4034 intptr_t token_pos() const { return token_pos_; }
4036 4035
4037 const Function& closure_function() const { return closure_function_; } 4036 const Function& closure_function() const { return closure_function_; }
4038 void set_closure_function(const Function& function) { 4037 void set_closure_function(const Function& function) {
4039 closure_function_ ^= function.raw(); 4038 closure_function_ ^= function.raw();
4040 } 4039 }
4041 4040
4042 const Field& context_field() const { return context_field_; }
4043 void set_context_field(const Field& field) {
4044 context_field_ ^= field.raw();
4045 }
4046
4047 virtual void PrintOperandsTo(BufferFormatter* f) const; 4041 virtual void PrintOperandsTo(BufferFormatter* f) const;
4048 4042
4049 virtual bool CanDeoptimize() const { return false; } 4043 virtual bool CanDeoptimize() const { return false; }
4050 4044
4051 virtual EffectSet Effects() const { return EffectSet::None(); } 4045 virtual EffectSet Effects() const { return EffectSet::None(); }
4052 4046
4053 virtual bool MayThrow() const { return false; } 4047 virtual bool MayThrow() const { return false; }
4054 4048
4055 // If the result of the allocation is not stored into any field, passed 4049 // If the result of the allocation is not stored into any field, passed
4056 // as an argument or used in a phi then it can't alias with any other 4050 // as an argument or used in a phi then it can't alias with any other
4057 // SSA value. 4051 // SSA value.
4058 enum Identity { 4052 enum Identity {
4059 kUnknown, 4053 kUnknown,
4060 kAliased, 4054 kAliased,
4061 kNotAliased 4055 kNotAliased
4062 }; 4056 };
4063 4057
4064 Identity identity() const { return identity_; } 4058 Identity identity() const { return identity_; }
4065 void set_identity(Identity identity) { identity_ = identity; } 4059 void set_identity(Identity identity) { identity_ = identity; }
4066 4060
4067 private: 4061 private:
4068 const intptr_t token_pos_; 4062 const intptr_t token_pos_;
4069 const Class& cls_; 4063 const Class& cls_;
4070 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 4064 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
4071 Identity identity_; 4065 Identity identity_;
4072 Function& closure_function_; 4066 Function& closure_function_;
4073 Field& context_field_;
4074 4067
4075 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); 4068 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr);
4076 }; 4069 };
4077 4070
4078 4071
4079 // This instruction captures the state of the object which had its allocation 4072 // This instruction captures the state of the object which had its allocation
4080 // removed during the AllocationSinking pass. 4073 // removed during the AllocationSinking pass.
4081 // It does not produce any real code only deoptimization information. 4074 // It does not produce any real code only deoptimization information.
4082 class MaterializeObjectInstr : public Definition { 4075 class MaterializeObjectInstr : public Definition {
srdjan 2014/03/07 17:38:37 Please rename 'fields' to fields_or_offsets'. Such
Florian Schneider 2014/03/10 09:46:48 Done. Renamed to 'slots' since I prefer a concise
4083 public: 4076 public:
4084 MaterializeObjectInstr(const Class& cls, 4077 MaterializeObjectInstr(const Class& cls,
4085 const ZoneGrowableArray<const Field*>& fields, 4078 const ZoneGrowableArray<const Object*>& fields,
4086 ZoneGrowableArray<Value*>* values) 4079 ZoneGrowableArray<Value*>* values)
4087 : cls_(cls), fields_(fields), values_(values), locations_(NULL) { 4080 : cls_(cls), fields_(fields), values_(values), locations_(NULL) {
4088 ASSERT(fields_.length() == values_->length()); 4081 ASSERT(fields_.length() == values_->length());
4089 for (intptr_t i = 0; i < InputCount(); i++) { 4082 for (intptr_t i = 0; i < InputCount(); i++) {
4090 InputAt(i)->set_instruction(this); 4083 InputAt(i)->set_instruction(this);
4091 InputAt(i)->set_use_index(i); 4084 InputAt(i)->set_use_index(i);
4092 } 4085 }
4093 } 4086 }
4094 4087
4095 const Class& cls() const { return cls_; } 4088 const Class& cls() const { return cls_; }
4096 intptr_t FieldOffsetAt(intptr_t i) const { 4089 intptr_t FieldOffsetAt(intptr_t i) const {
4097 return fields_[i]->Offset(); 4090 return fields_[i]->IsField()
4091 ? Field::Cast(*fields_[i]).Offset()
4092 : Smi::Cast(*fields_[i]).Value();
4098 } 4093 }
4099 const Location& LocationAt(intptr_t i) { 4094 const Location& LocationAt(intptr_t i) {
4100 return locations_[i]; 4095 return locations_[i];
4101 } 4096 }
4102 4097
4103 DECLARE_INSTRUCTION(MaterializeObject) 4098 DECLARE_INSTRUCTION(MaterializeObject)
4104 virtual void PrintOperandsTo(BufferFormatter* f) const; 4099 virtual void PrintOperandsTo(BufferFormatter* f) const;
4105 4100
4106 virtual intptr_t InputCount() const { 4101 virtual intptr_t InputCount() const {
4107 return values_->length(); 4102 return values_->length();
(...skipping 20 matching lines...) Expand all
4128 void set_locations(Location* locations) { locations_ = locations; } 4123 void set_locations(Location* locations) { locations_ = locations; }
4129 4124
4130 virtual bool MayThrow() const { return false; } 4125 virtual bool MayThrow() const { return false; }
4131 4126
4132 private: 4127 private:
4133 virtual void RawSetInputAt(intptr_t i, Value* value) { 4128 virtual void RawSetInputAt(intptr_t i, Value* value) {
4134 (*values_)[i] = value; 4129 (*values_)[i] = value;
4135 } 4130 }
4136 4131
4137 const Class& cls_; 4132 const Class& cls_;
4138 const ZoneGrowableArray<const Field*>& fields_; 4133 const ZoneGrowableArray<const Object*>& fields_;
4139 ZoneGrowableArray<Value*>* values_; 4134 ZoneGrowableArray<Value*>* values_;
4140 Location* locations_; 4135 Location* locations_;
4141 4136
4142 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4137 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4143 }; 4138 };
4144 4139
4145 4140
4146 class CreateArrayInstr : public TemplateDefinition<2> { 4141 class CreateArrayInstr : public TemplateDefinition<2> {
4147 public: 4142 public:
4148 CreateArrayInstr(intptr_t token_pos, 4143 CreateArrayInstr(intptr_t token_pos,
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
7203 ForwardInstructionIterator* current_iterator_; 7198 ForwardInstructionIterator* current_iterator_;
7204 7199
7205 private: 7200 private:
7206 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7201 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7207 }; 7202 };
7208 7203
7209 7204
7210 } // namespace dart 7205 } // namespace dart
7211 7206
7212 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7207 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698