| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 // register allocation. | 1025 // register allocation. |
| 1026 // TODO(titzer): s/IsDouble/IsFloat64/ | 1026 // TODO(titzer): s/IsDouble/IsFloat64/ |
| 1027 class InstructionSequence final : public ZoneObject { | 1027 class InstructionSequence final : public ZoneObject { |
| 1028 public: | 1028 public: |
| 1029 static InstructionBlocks* InstructionBlocksFor(Zone* zone, | 1029 static InstructionBlocks* InstructionBlocksFor(Zone* zone, |
| 1030 const Schedule* schedule); | 1030 const Schedule* schedule); |
| 1031 // Puts the deferred blocks last. | 1031 // Puts the deferred blocks last. |
| 1032 static void ComputeAssemblyOrder(InstructionBlocks* blocks); | 1032 static void ComputeAssemblyOrder(InstructionBlocks* blocks); |
| 1033 | 1033 |
| 1034 InstructionSequence(Isolate* isolate, Zone* zone, | 1034 InstructionSequence(Isolate* isolate, Zone* zone, |
| 1035 InstructionBlocks* instruction_blocks); | 1035 InstructionBlocks* instruction_blocks, Frame* frame); |
| 1036 | 1036 |
| 1037 int NextVirtualRegister(); | 1037 int NextVirtualRegister(); |
| 1038 int VirtualRegisterCount() const { return next_virtual_register_; } | 1038 int VirtualRegisterCount() const { return next_virtual_register_; } |
| 1039 | 1039 |
| 1040 const InstructionBlocks& instruction_blocks() const { | 1040 const InstructionBlocks& instruction_blocks() const { |
| 1041 return *instruction_blocks_; | 1041 return *instruction_blocks_; |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 int InstructionBlockCount() const { | 1044 int InstructionBlockCount() const { |
| 1045 return static_cast<int>(instruction_blocks_->size()); | 1045 return static_cast<int>(instruction_blocks_->size()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 SourcePosition* result) const; | 1166 SourcePosition* result) const; |
| 1167 void SetSourcePosition(const Instruction* instr, SourcePosition value); | 1167 void SetSourcePosition(const Instruction* instr, SourcePosition value); |
| 1168 | 1168 |
| 1169 bool ContainsCall() const { | 1169 bool ContainsCall() const { |
| 1170 for (Instruction* instr : instructions_) { | 1170 for (Instruction* instr : instructions_) { |
| 1171 if (instr->IsCall()) return true; | 1171 if (instr->IsCall()) return true; |
| 1172 } | 1172 } |
| 1173 return false; | 1173 return false; |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 Frame* frame() const { return frame_; } |
| 1177 |
| 1176 private: | 1178 private: |
| 1177 friend std::ostream& operator<<(std::ostream& os, | 1179 friend std::ostream& operator<<(std::ostream& os, |
| 1178 const PrintableInstructionSequence& code); | 1180 const PrintableInstructionSequence& code); |
| 1179 | 1181 |
| 1180 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap; | 1182 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap; |
| 1181 | 1183 |
| 1182 Isolate* isolate_; | 1184 Isolate* isolate_; |
| 1183 Zone* const zone_; | 1185 Zone* const zone_; |
| 1184 InstructionBlocks* const instruction_blocks_; | 1186 InstructionBlocks* const instruction_blocks_; |
| 1187 Frame* frame_; |
| 1185 SourcePositionMap source_positions_; | 1188 SourcePositionMap source_positions_; |
| 1186 IntVector block_starts_; | 1189 IntVector block_starts_; |
| 1187 ConstantMap constants_; | 1190 ConstantMap constants_; |
| 1188 Immediates immediates_; | 1191 Immediates immediates_; |
| 1189 InstructionDeque instructions_; | 1192 InstructionDeque instructions_; |
| 1190 int next_virtual_register_; | 1193 int next_virtual_register_; |
| 1191 ReferenceMapDeque reference_maps_; | 1194 ReferenceMapDeque reference_maps_; |
| 1192 ZoneVector<MachineType> representations_; | 1195 ZoneVector<MachineType> representations_; |
| 1193 DeoptimizationVector deoptimization_entries_; | 1196 DeoptimizationVector deoptimization_entries_; |
| 1194 | 1197 |
| 1195 DISALLOW_COPY_AND_ASSIGN(InstructionSequence); | 1198 DISALLOW_COPY_AND_ASSIGN(InstructionSequence); |
| 1196 }; | 1199 }; |
| 1197 | 1200 |
| 1198 | 1201 |
| 1199 struct PrintableInstructionSequence { | 1202 struct PrintableInstructionSequence { |
| 1200 const RegisterConfiguration* register_configuration_; | 1203 const RegisterConfiguration* register_configuration_; |
| 1201 const InstructionSequence* sequence_; | 1204 const InstructionSequence* sequence_; |
| 1202 }; | 1205 }; |
| 1203 | 1206 |
| 1204 | 1207 |
| 1208 enum TailCallOpcode { |
| 1209 kPopAndStore, |
| 1210 kStore, |
| 1211 kReplaceReturn, |
| 1212 kDeconstructFrame, |
| 1213 kParametersReady |
| 1214 }; |
| 1215 |
| 1216 |
| 1205 std::ostream& operator<<(std::ostream& os, | 1217 std::ostream& operator<<(std::ostream& os, |
| 1206 const PrintableInstructionSequence& code); | 1218 const PrintableInstructionSequence& code); |
| 1207 | 1219 |
| 1208 } // namespace compiler | 1220 } // namespace compiler |
| 1209 } // namespace internal | 1221 } // namespace internal |
| 1210 } // namespace v8 | 1222 } // namespace v8 |
| 1211 | 1223 |
| 1212 #endif // V8_COMPILER_INSTRUCTION_H_ | 1224 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |