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

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

Issue 10870004: Separate the checks from StoreInstanceField so that they can be eliminated. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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) 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_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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 private: 996 private:
997 const NativeBodyNode& ast_node_; 997 const NativeBodyNode& ast_node_;
998 const intptr_t try_index_; 998 const intptr_t try_index_;
999 999
1000 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); 1000 DISALLOW_COPY_AND_ASSIGN(NativeCallComp);
1001 }; 1001 };
1002 1002
1003 1003
1004 class LoadInstanceFieldComp : public TemplateComputation<1> { 1004 class LoadInstanceFieldComp : public TemplateComputation<1> {
1005 public: 1005 public:
1006 // Set 'original' to NULL if this it cannot deoptimize.
regis 2012/08/21 23:58:34 if what?
srdjan 2012/08/22 00:02:48 Fixed
1006 LoadInstanceFieldComp(const Field& field, 1007 LoadInstanceFieldComp(const Field& field,
1007 Value* instance, 1008 Value* instance,
1008 InstanceCallComp* original, // Maybe NULL. 1009 InstanceCallComp* original)
1009 bool can_deoptimize) 1010 : field_(field), original_(original) {
1010 : field_(field), original_(original), can_deoptimize_(can_deoptimize) {
1011 ASSERT(instance != NULL); 1011 ASSERT(instance != NULL);
1012 inputs_[0] = instance; 1012 inputs_[0] = instance;
1013 } 1013 }
1014 1014
1015 DECLARE_COMPUTATION(LoadInstanceField) 1015 DECLARE_COMPUTATION(LoadInstanceField)
1016 1016
1017 const Field& field() const { return field_; } 1017 const Field& field() const { return field_; }
1018 Value* instance() const { return inputs_[0]; } 1018 Value* instance() const { return inputs_[0]; }
1019 const InstanceCallComp* original() const { return original_; } 1019 const InstanceCallComp* original() const { return original_; }
1020 1020
1021 virtual void PrintOperandsTo(BufferFormatter* f) const; 1021 virtual void PrintOperandsTo(BufferFormatter* f) const;
1022 1022
1023 virtual bool CanDeoptimize() const { return can_deoptimize_; } 1023 virtual bool CanDeoptimize() const { return original_ != NULL; }
1024 1024
1025 private: 1025 private:
1026 const Field& field_; 1026 const Field& field_;
1027 const InstanceCallComp* original_; // For optimizations. 1027 const InstanceCallComp* original_; // For optimizations.
1028 const bool can_deoptimize_;
1029 1028
1030 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); 1029 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp);
1031 }; 1030 };
1032 1031
1033 1032
1034 class StoreInstanceFieldComp : public TemplateComputation<2> { 1033 class StoreInstanceFieldComp : public TemplateComputation<2> {
1035 public: 1034 public:
1035 // Set StoreInstanceFieldComp to NULL if it cannot deoptimize.
1036 StoreInstanceFieldComp(const Field& field, 1036 StoreInstanceFieldComp(const Field& field,
1037 Value* instance, 1037 Value* instance,
1038 Value* value, 1038 Value* value,
1039 InstanceCallComp* original) // Maybe NULL. 1039 InstanceCallComp* original) // Maybe NULL.
1040 : field_(field), original_(original) { 1040 : field_(field), original_(original) {
1041 ASSERT(instance != NULL); 1041 ASSERT(instance != NULL);
1042 ASSERT(value != NULL); 1042 ASSERT(value != NULL);
1043 inputs_[0] = instance; 1043 inputs_[0] = instance;
1044 inputs_[1] = value; 1044 inputs_[1] = value;
1045 } 1045 }
1046 1046
1047 DECLARE_COMPUTATION(StoreInstanceField) 1047 DECLARE_COMPUTATION(StoreInstanceField)
1048 1048
1049 const Field& field() const { return field_; } 1049 const Field& field() const { return field_; }
1050 1050
1051 Value* instance() const { return inputs_[0]; } 1051 Value* instance() const { return inputs_[0]; }
1052 Value* value() const { return inputs_[1]; } 1052 Value* value() const { return inputs_[1]; }
1053 1053
1054 const InstanceCallComp* original() const { return original_; } 1054 const InstanceCallComp* original() const { return original_; }
1055 1055
1056 virtual void PrintOperandsTo(BufferFormatter* f) const; 1056 virtual void PrintOperandsTo(BufferFormatter* f) const;
1057 1057
1058 virtual bool CanDeoptimize() const { return true; } 1058 virtual bool CanDeoptimize() const { return original_ != NULL; }
1059 1059
1060 private: 1060 private:
1061 const Field& field_; 1061 const Field& field_;
1062 const InstanceCallComp* original_; // For optimizations. 1062 const InstanceCallComp* original_; // For optimizations.
1063 1063
1064 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); 1064 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp);
1065 }; 1065 };
1066 1066
1067 1067
1068 class LoadStaticFieldComp : public TemplateComputation<0> { 1068 class LoadStaticFieldComp : public TemplateComputation<0> {
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 ForwardInstructionIterator* current_iterator_; 3084 ForwardInstructionIterator* current_iterator_;
3085 3085
3086 private: 3086 private:
3087 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3087 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3088 }; 3088 };
3089 3089
3090 3090
3091 } // namespace dart 3091 } // namespace dart
3092 3092
3093 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3093 #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