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

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

Issue 35893012: Use enums for the index of IL operands. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.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 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 2212
2213 TargetEntryInstr* constant_target_; 2213 TargetEntryInstr* constant_target_;
2214 2214
2215 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 2215 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
2216 }; 2216 };
2217 2217
2218 2218
2219 class StoreContextInstr : public TemplateInstruction<1> { 2219 class StoreContextInstr : public TemplateInstruction<1> {
2220 public: 2220 public:
2221 explicit StoreContextInstr(Value* value) { 2221 explicit StoreContextInstr(Value* value) {
2222 SetInputAt(0, value); 2222 SetInputAt(kValuePos, value);
2223 } 2223 }
2224 2224
2225 enum {
2226 kValuePos = 0
2227 };
2228
2225 DECLARE_INSTRUCTION(StoreContext) 2229 DECLARE_INSTRUCTION(StoreContext)
2226 2230
2227 virtual intptr_t ArgumentCount() const { return 0; } 2231 virtual intptr_t ArgumentCount() const { return 0; }
2228 2232
2229 Value* value() const { return inputs_[0]; } 2233 Value* value() const { return inputs_[kValuePos]; }
2230 2234
2231 virtual bool CanDeoptimize() const { return false; } 2235 virtual bool CanDeoptimize() const { return false; }
2232 2236
2233 virtual EffectSet Effects() const { return EffectSet::None(); } 2237 virtual EffectSet Effects() const { return EffectSet::None(); }
2234 2238
2235 virtual bool MayThrow() const { return false; } 2239 virtual bool MayThrow() const { return false; }
2236 2240
2237 private: 2241 private:
2238 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 2242 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
2239 }; 2243 };
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 3416
3413 3417
3414 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 3418 class StoreInstanceFieldInstr : public TemplateDefinition<2> {
3415 public: 3419 public:
3416 StoreInstanceFieldInstr(const Field& field, 3420 StoreInstanceFieldInstr(const Field& field,
3417 Value* instance, 3421 Value* instance,
3418 Value* value, 3422 Value* value,
3419 StoreBarrierType emit_store_barrier) 3423 StoreBarrierType emit_store_barrier)
3420 : field_(field), 3424 : field_(field),
3421 emit_store_barrier_(emit_store_barrier) { 3425 emit_store_barrier_(emit_store_barrier) {
3422 SetInputAt(0, instance); 3426 SetInputAt(kInstancePos, instance);
3423 SetInputAt(1, value); 3427 SetInputAt(kValuePos, value);
3424 } 3428 }
3425 3429
3426 DECLARE_INSTRUCTION(StoreInstanceField) 3430 DECLARE_INSTRUCTION(StoreInstanceField)
3431
3432 enum {
3433 kInstancePos = 0,
3434 kValuePos = 1
3435 };
3436
3437 Value* instance() const { return inputs_[kInstancePos]; }
3438 Value* value() const { return inputs_[kValuePos]; }
3439
3427 virtual CompileType* ComputeInitialType() const; 3440 virtual CompileType* ComputeInitialType() const;
3428 3441
3429 const Field& field() const { return field_; } 3442 const Field& field() const { return field_; }
3430 3443
3431 Value* instance() const { return inputs_[0]; }
3432 Value* value() const { return inputs_[1]; }
3433 bool ShouldEmitStoreBarrier() const { 3444 bool ShouldEmitStoreBarrier() const {
3434 return value()->NeedsStoreBuffer() 3445 return value()->NeedsStoreBuffer()
3435 && (emit_store_barrier_ == kEmitStoreBarrier); 3446 && (emit_store_barrier_ == kEmitStoreBarrier);
3436 } 3447 }
3437 3448
3438 virtual void PrintOperandsTo(BufferFormatter* f) const; 3449 virtual void PrintOperandsTo(BufferFormatter* f) const;
3439 3450
3440 virtual bool CanDeoptimize() const { return false; } 3451 virtual bool CanDeoptimize() const { return false; }
3441 3452
3442 // Currently CSE/LICM don't operate on any instructions that can be affected 3453 // Currently CSE/LICM don't operate on any instructions that can be affected
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3527 private: 3538 private:
3528 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); 3539 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr);
3529 }; 3540 };
3530 3541
3531 3542
3532 class StoreStaticFieldInstr : public TemplateDefinition<1> { 3543 class StoreStaticFieldInstr : public TemplateDefinition<1> {
3533 public: 3544 public:
3534 StoreStaticFieldInstr(const Field& field, Value* value) 3545 StoreStaticFieldInstr(const Field& field, Value* value)
3535 : field_(field) { 3546 : field_(field) {
3536 ASSERT(field.IsZoneHandle()); 3547 ASSERT(field.IsZoneHandle());
3537 SetInputAt(0, value); 3548 SetInputAt(kValuePos, value);
3538 } 3549 }
3539 3550
3551 enum {
3552 kValuePos = 0
3553 };
3554
3540 DECLARE_INSTRUCTION(StoreStaticField) 3555 DECLARE_INSTRUCTION(StoreStaticField)
3541 virtual CompileType* ComputeInitialType() const; 3556 virtual CompileType* ComputeInitialType() const;
3542 3557
3543 const Field& field() const { return field_; } 3558 const Field& field() const { return field_; }
3544 Value* value() const { return inputs_[0]; } 3559 Value* value() const { return inputs_[kValuePos]; }
3545 3560
3546 virtual void PrintOperandsTo(BufferFormatter* f) const; 3561 virtual void PrintOperandsTo(BufferFormatter* f) const;
3547 3562
3548 virtual bool CanDeoptimize() const { return false; } 3563 virtual bool CanDeoptimize() const { return false; }
3549 3564
3550 // Currently CSE/LICM don't operate on any instructions that can be affected 3565 // Currently CSE/LICM don't operate on any instructions that can be affected
3551 // by stores/loads. LoadOptimizer handles loads separately. Hence stores 3566 // by stores/loads. LoadOptimizer handles loads separately. Hence stores
3552 // are marked as having no side-effects. 3567 // are marked as having no side-effects.
3553 virtual EffectSet Effects() const { return EffectSet::None(); } 3568 virtual EffectSet Effects() const { return EffectSet::None(); }
3554 3569
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3689 StoreIndexedInstr(Value* array, 3704 StoreIndexedInstr(Value* array,
3690 Value* index, 3705 Value* index,
3691 Value* value, 3706 Value* value,
3692 StoreBarrierType emit_store_barrier, 3707 StoreBarrierType emit_store_barrier,
3693 intptr_t index_scale, 3708 intptr_t index_scale,
3694 intptr_t class_id, 3709 intptr_t class_id,
3695 intptr_t deopt_id) 3710 intptr_t deopt_id)
3696 : emit_store_barrier_(emit_store_barrier), 3711 : emit_store_barrier_(emit_store_barrier),
3697 index_scale_(index_scale), 3712 index_scale_(index_scale),
3698 class_id_(class_id) { 3713 class_id_(class_id) {
3699 SetInputAt(0, array); 3714 SetInputAt(kArrayPos, array);
3700 SetInputAt(1, index); 3715 SetInputAt(kIndexPos, index);
3701 SetInputAt(2, value); 3716 SetInputAt(kValuePos, value);
3702 deopt_id_ = deopt_id; 3717 deopt_id_ = deopt_id;
3703 } 3718 }
3704 3719
3705 DECLARE_INSTRUCTION(StoreIndexed) 3720 DECLARE_INSTRUCTION(StoreIndexed)
3706 3721
3707 Value* array() const { return inputs_[0]; } 3722 enum {
3708 Value* index() const { return inputs_[1]; } 3723 kArrayPos = 0,
3709 Value* value() const { return inputs_[2]; } 3724 kIndexPos = 1,
3725 kValuePos = 2
3726 };
3727
3728 Value* array() const { return inputs_[kArrayPos]; }
3729 Value* index() const { return inputs_[kIndexPos]; }
3730 Value* value() const { return inputs_[kValuePos]; }
3731
3710 intptr_t index_scale() const { return index_scale_; } 3732 intptr_t index_scale() const { return index_scale_; }
3711 intptr_t class_id() const { return class_id_; } 3733 intptr_t class_id() const { return class_id_; }
3712 3734
3713 bool ShouldEmitStoreBarrier() const { 3735 bool ShouldEmitStoreBarrier() const {
3714 return value()->NeedsStoreBuffer() 3736 return value()->NeedsStoreBuffer()
3715 && (emit_store_barrier_ == kEmitStoreBarrier); 3737 && (emit_store_barrier_ == kEmitStoreBarrier);
3716 } 3738 }
3717 3739
3718 virtual bool CanDeoptimize() const { return false; } 3740 virtual bool CanDeoptimize() const { return false; }
3719 3741
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 4212
4191 4213
4192 class StoreVMFieldInstr : public TemplateDefinition<2> { 4214 class StoreVMFieldInstr : public TemplateDefinition<2> {
4193 public: 4215 public:
4194 StoreVMFieldInstr(Value* dest, 4216 StoreVMFieldInstr(Value* dest,
4195 intptr_t offset_in_bytes, 4217 intptr_t offset_in_bytes,
4196 Value* value, 4218 Value* value,
4197 const AbstractType& type) 4219 const AbstractType& type)
4198 : offset_in_bytes_(offset_in_bytes), type_(type) { 4220 : offset_in_bytes_(offset_in_bytes), type_(type) {
4199 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. 4221 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance.
4200 SetInputAt(0, value); 4222 SetInputAt(kValuePos, value);
4201 SetInputAt(1, dest); 4223 SetInputAt(kDestPos, dest);
4202 } 4224 }
4203 4225
4226 enum {
4227 kValuePos = 0,
4228 kDestPos = 1
4229 };
4230
4204 DECLARE_INSTRUCTION(StoreVMField) 4231 DECLARE_INSTRUCTION(StoreVMField)
4205 virtual CompileType* ComputeInitialType() const; 4232 virtual CompileType* ComputeInitialType() const;
4206 4233
4207 Value* value() const { return inputs_[0]; } 4234 Value* value() const { return inputs_[kValuePos]; }
4208 Value* dest() const { return inputs_[1]; } 4235 Value* dest() const { return inputs_[kDestPos]; }
4209 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 4236 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
4210 const AbstractType& type() const { return type_; } 4237 const AbstractType& type() const { return type_; }
4211 4238
4212 virtual void PrintOperandsTo(BufferFormatter* f) const; 4239 virtual void PrintOperandsTo(BufferFormatter* f) const;
4213 4240
4214 virtual bool CanDeoptimize() const { return false; } 4241 virtual bool CanDeoptimize() const { return false; }
4215 4242
4216 virtual EffectSet Effects() const { return EffectSet::None(); } 4243 virtual EffectSet Effects() const { return EffectSet::None(); }
4217 4244
4218 virtual bool MayThrow() const { return false; } 4245 virtual bool MayThrow() const { return false; }
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
6859 ForwardInstructionIterator* current_iterator_; 6886 ForwardInstructionIterator* current_iterator_;
6860 6887
6861 private: 6888 private:
6862 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6889 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6863 }; 6890 };
6864 6891
6865 6892
6866 } // namespace dart 6893 } // namespace dart
6867 6894
6868 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6895 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698