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

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

Issue 16888013: Revert "Initial implementation of on-stack replacement (OSR)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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') | runtime/vm/intermediate_language.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) 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"
11 #include "vm/handles_impl.h" 11 #include "vm/handles_impl.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 class BitVector; 17 class BitVector;
18 class BlockEntryInstr; 18 class BlockEntryInstr;
19 class BufferFormatter; 19 class BufferFormatter;
20 class CatchBlockEntryInstr; 20 class CatchBlockEntryInstr;
21 class ComparisonInstr; 21 class ComparisonInstr;
22 class ControlInstruction; 22 class ControlInstruction;
23 class Definition; 23 class Definition;
24 class Environment; 24 class Environment;
25 class FlowGraph; 25 class FlowGraph;
26 class FlowGraphBuilder;
27 class FlowGraphCompiler; 26 class FlowGraphCompiler;
28 class FlowGraphVisitor; 27 class FlowGraphVisitor;
29 class Instruction; 28 class Instruction;
30 class LocalVariable; 29 class LocalVariable;
31 class ParsedFunction; 30 class ParsedFunction;
32 class Range; 31 class Range;
33 32
34 33
35 // TODO(srdjan): Unify with INTRINSIC_LIST. 34 // TODO(srdjan): Unify with INTRINSIC_LIST.
36 // (class-name, function-name, recognized enum, fingerprint). 35 // (class-name, function-name, recognized enum, fingerprint).
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 861
863 protected: 862 protected:
864 // Fetch deopt id without checking if this computation can deoptimize. 863 // Fetch deopt id without checking if this computation can deoptimize.
865 intptr_t GetDeoptId() const { 864 intptr_t GetDeoptId() const {
866 return deopt_id_; 865 return deopt_id_;
867 } 866 }
868 867
869 private: 868 private:
870 friend class Definition; // Needed for InsertBefore, InsertAfter. 869 friend class Definition; // Needed for InsertBefore, InsertAfter.
871 870
872 // Classes that set or read deopt_id_. 871 // Classes that set deopt_id_.
873 friend class UnboxIntegerInstr; 872 friend class UnboxIntegerInstr;
874 friend class UnboxDoubleInstr; 873 friend class UnboxDoubleInstr;
875 friend class UnboxFloat32x4Instr; 874 friend class UnboxFloat32x4Instr;
876 friend class UnboxUint32x4Instr; 875 friend class UnboxUint32x4Instr;
877 friend class BinaryDoubleOpInstr; 876 friend class BinaryDoubleOpInstr;
878 friend class BinaryFloat32x4OpInstr; 877 friend class BinaryFloat32x4OpInstr;
879 friend class Float32x4ZeroInstr; 878 friend class Float32x4ZeroInstr;
880 friend class Float32x4SplatInstr; 879 friend class Float32x4SplatInstr;
881 friend class Float32x4ShuffleInstr; 880 friend class Float32x4ShuffleInstr;
882 friend class Float32x4ConstructorInstr; 881 friend class Float32x4ConstructorInstr;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 friend class StoreInstanceFieldInstr; 914 friend class StoreInstanceFieldInstr;
916 friend class ControlInstruction; 915 friend class ControlInstruction;
917 friend class ComparisonInstr; 916 friend class ComparisonInstr;
918 friend class TargetEntryInstr; 917 friend class TargetEntryInstr;
919 friend class JoinEntryInstr; 918 friend class JoinEntryInstr;
920 friend class InstanceOfInstr; 919 friend class InstanceOfInstr;
921 friend class PolymorphicInstanceCallInstr; 920 friend class PolymorphicInstanceCallInstr;
922 friend class SmiToDoubleInstr; 921 friend class SmiToDoubleInstr;
923 friend class DoubleToIntegerInstr; 922 friend class DoubleToIntegerInstr;
924 friend class BranchSimplifier; 923 friend class BranchSimplifier;
925 friend class BlockEntryInstr;
926 924
927 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; 925 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
928 926
929 enum { 927 enum {
930 kNoExprId = -1 928 kNoExprId = -1
931 }; 929 };
932 930
933 intptr_t deopt_id_; 931 intptr_t deopt_id_;
934 intptr_t lifetime_position_; // Position used by register allocator. 932 intptr_t lifetime_position_; // Position used by register allocator.
935 Instruction* previous_; 933 Instruction* previous_;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // block entry instructions of predecessor blocks) and also the last 1136 // block entry instructions of predecessor blocks) and also the last
1139 // instruction in the block is recorded in each entry instruction. 1137 // instruction in the block is recorded in each entry instruction.
1140 void DiscoverBlocks( 1138 void DiscoverBlocks(
1141 BlockEntryInstr* predecessor, 1139 BlockEntryInstr* predecessor,
1142 GrowableArray<BlockEntryInstr*>* preorder, 1140 GrowableArray<BlockEntryInstr*>* preorder,
1143 GrowableArray<BlockEntryInstr*>* postorder, 1141 GrowableArray<BlockEntryInstr*>* postorder,
1144 GrowableArray<intptr_t>* parent, 1142 GrowableArray<intptr_t>* parent,
1145 intptr_t variable_count, 1143 intptr_t variable_count,
1146 intptr_t fixed_parameter_count); 1144 intptr_t fixed_parameter_count);
1147 1145
1148 // Perform a depth first search to prune code not reachable from an OSR
1149 // entry point.
1150 bool PruneUnreachable(FlowGraphBuilder* builder,
1151 GraphEntryInstr* graph_entry,
1152 intptr_t osr_id,
1153 BitVector* block_marks);
1154
1155 virtual intptr_t InputCount() const { return 0; } 1146 virtual intptr_t InputCount() const { return 0; }
1156 virtual Value* InputAt(intptr_t i) const { 1147 virtual Value* InputAt(intptr_t i) const {
1157 UNREACHABLE(); 1148 UNREACHABLE();
1158 return NULL; 1149 return NULL;
1159 } 1150 }
1160 1151
1161 virtual intptr_t ArgumentCount() const { return 0; } 1152 virtual intptr_t ArgumentCount() const { return 0; }
1162 1153
1163 virtual bool CanBecomeDeoptimizationTarget() const { 1154 virtual bool CanBecomeDeoptimizationTarget() const {
1164 // BlockEntry environment is copied to Goto and Branch instructions 1155 // BlockEntry environment is copied to Goto and Branch instructions
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1274
1284 private: 1275 private:
1285 BlockEntryInstr* block_entry_; 1276 BlockEntryInstr* block_entry_;
1286 Instruction* current_; 1277 Instruction* current_;
1287 }; 1278 };
1288 1279
1289 1280
1290 class GraphEntryInstr : public BlockEntryInstr { 1281 class GraphEntryInstr : public BlockEntryInstr {
1291 public: 1282 public:
1292 GraphEntryInstr(const ParsedFunction& parsed_function, 1283 GraphEntryInstr(const ParsedFunction& parsed_function,
1293 TargetEntryInstr* normal_entry, 1284 TargetEntryInstr* normal_entry);
1294 intptr_t osr_id);
1295 1285
1296 DECLARE_INSTRUCTION(GraphEntry) 1286 DECLARE_INSTRUCTION(GraphEntry)
1297 1287
1298 virtual intptr_t PredecessorCount() const { return 0; } 1288 virtual intptr_t PredecessorCount() const { return 0; }
1299 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1289 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1300 UNREACHABLE(); 1290 UNREACHABLE();
1301 return NULL; 1291 return NULL;
1302 } 1292 }
1303 virtual intptr_t SuccessorCount() const; 1293 virtual intptr_t SuccessorCount() const;
1304 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 1294 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
1305 1295
1306 void AddCatchEntry(CatchBlockEntryInstr* entry) { catch_entries_.Add(entry); } 1296 void AddCatchEntry(CatchBlockEntryInstr* entry) { catch_entries_.Add(entry); }
1307 1297
1308 CatchBlockEntryInstr* GetCatchEntry(intptr_t index); 1298 CatchBlockEntryInstr* GetCatchEntry(intptr_t index);
1309 1299
1310 GrowableArray<Definition*>* initial_definitions() { 1300 GrowableArray<Definition*>* initial_definitions() {
1311 return &initial_definitions_; 1301 return &initial_definitions_;
1312 } 1302 }
1313 ConstantInstr* constant_null(); 1303 ConstantInstr* constant_null();
1314 1304
1315 bool IsCompiledForOsr() const { return osr_id_ != Isolate::kNoDeoptId; }
1316
1317 intptr_t spill_slot_count() const { return spill_slot_count_; } 1305 intptr_t spill_slot_count() const { return spill_slot_count_; }
1318 void set_spill_slot_count(intptr_t count) { 1306 void set_spill_slot_count(intptr_t count) {
1319 ASSERT(count >= 0); 1307 ASSERT(count >= 0);
1320 spill_slot_count_ = count; 1308 spill_slot_count_ = count;
1321 } 1309 }
1322 1310
1323 // Number of stack slots reserved for compiling try-catch. For functions 1311 // Number of stack slots reserved for compiling try-catch. For functions
1324 // without try-catch, this is 0. Otherwise, it is the number of local 1312 // without try-catch, this is 0. Otherwise, it is the number of local
1325 // variables. 1313 // variables.
1326 intptr_t fixed_slot_count() const { return fixed_slot_count_; } 1314 intptr_t fixed_slot_count() const { return fixed_slot_count_; }
(...skipping 14 matching lines...) Expand all
1341 virtual void PrintTo(BufferFormatter* f) const; 1329 virtual void PrintTo(BufferFormatter* f) const;
1342 1330
1343 private: 1331 private:
1344 virtual void ClearPredecessors() {} 1332 virtual void ClearPredecessors() {}
1345 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } 1333 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); }
1346 1334
1347 const ParsedFunction& parsed_function_; 1335 const ParsedFunction& parsed_function_;
1348 TargetEntryInstr* normal_entry_; 1336 TargetEntryInstr* normal_entry_;
1349 GrowableArray<CatchBlockEntryInstr*> catch_entries_; 1337 GrowableArray<CatchBlockEntryInstr*> catch_entries_;
1350 GrowableArray<Definition*> initial_definitions_; 1338 GrowableArray<Definition*> initial_definitions_;
1351 const intptr_t osr_id_;
1352 intptr_t spill_slot_count_; 1339 intptr_t spill_slot_count_;
1353 intptr_t fixed_slot_count_; // For try-catch in optimized code. 1340 intptr_t fixed_slot_count_; // For try-catch in optimized code.
1354 1341
1355 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 1342 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
1356 }; 1343 };
1357 1344
1358 1345
1359 class JoinEntryInstr : public BlockEntryInstr { 1346 class JoinEntryInstr : public BlockEntryInstr {
1360 public: 1347 public:
1361 JoinEntryInstr(intptr_t block_id, intptr_t try_index) 1348 JoinEntryInstr(intptr_t block_id, intptr_t try_index)
(...skipping 4547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5909 5896
5910 private: 5897 private:
5911 const Token::Kind op_kind_; 5898 const Token::Kind op_kind_;
5912 5899
5913 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); 5900 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr);
5914 }; 5901 };
5915 5902
5916 5903
5917 class CheckStackOverflowInstr : public TemplateInstruction<0> { 5904 class CheckStackOverflowInstr : public TemplateInstruction<0> {
5918 public: 5905 public:
5919 CheckStackOverflowInstr(intptr_t token_pos, bool in_loop) 5906 explicit CheckStackOverflowInstr(intptr_t token_pos)
5920 : token_pos_(token_pos), in_loop_(in_loop) {} 5907 : token_pos_(token_pos) {}
5921 5908
5922 intptr_t token_pos() const { return token_pos_; } 5909 intptr_t token_pos() const { return token_pos_; }
5923 bool in_loop() const { return in_loop_; }
5924 5910
5925 DECLARE_INSTRUCTION(CheckStackOverflow) 5911 DECLARE_INSTRUCTION(CheckStackOverflow)
5926 5912
5927 virtual intptr_t ArgumentCount() const { return 0; } 5913 virtual intptr_t ArgumentCount() const { return 0; }
5928 5914
5929 virtual bool CanDeoptimize() const { return true; } 5915 virtual bool CanDeoptimize() const { return true; }
5930 5916
5931 virtual EffectSet Effects() const { return EffectSet::None(); } 5917 virtual EffectSet Effects() const { return EffectSet::None(); }
5932 5918
5933 virtual bool MayThrow() const { return false; } 5919 virtual bool MayThrow() const { return false; }
5934 5920
5935 virtual void PrintOperandsTo(BufferFormatter* f) const;
5936
5937 private: 5921 private:
5938 const intptr_t token_pos_; 5922 const intptr_t token_pos_;
5939 const bool in_loop_;
5940 5923
5941 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); 5924 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr);
5942 }; 5925 };
5943 5926
5944 5927
5945 class SmiToDoubleInstr : public TemplateDefinition<1> { 5928 class SmiToDoubleInstr : public TemplateDefinition<1> {
5946 public: 5929 public:
5947 explicit SmiToDoubleInstr(Value* value) { 5930 explicit SmiToDoubleInstr(Value* value) {
5948 SetInputAt(0, value); 5931 SetInputAt(0, value);
5949 } 5932 }
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 ForwardInstructionIterator* current_iterator_; 6467 ForwardInstructionIterator* current_iterator_;
6485 6468
6486 private: 6469 private:
6487 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6470 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6488 }; 6471 };
6489 6472
6490 6473
6491 } // namespace dart 6474 } // namespace dart
6492 6475
6493 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6476 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698