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

Side by Side Diff: src/compiler/instruction.h

Issue 2161543002: [turbofan] Add support for eager/soft deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do the ports properly Created 4 years, 5 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
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction.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 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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 BailoutId bailout_id_; 1154 BailoutId bailout_id_;
1155 OutputFrameStateCombine frame_state_combine_; 1155 OutputFrameStateCombine frame_state_combine_;
1156 size_t parameters_count_; 1156 size_t parameters_count_;
1157 size_t locals_count_; 1157 size_t locals_count_;
1158 size_t stack_count_; 1158 size_t stack_count_;
1159 StateValueDescriptor values_; 1159 StateValueDescriptor values_;
1160 MaybeHandle<SharedFunctionInfo> const shared_info_; 1160 MaybeHandle<SharedFunctionInfo> const shared_info_;
1161 FrameStateDescriptor* outer_state_; 1161 FrameStateDescriptor* outer_state_;
1162 }; 1162 };
1163 1163
1164 // A deoptimization entry is a pair of the reason why we deoptimize and the
1165 // frame state descriptor that we have to go back to.
1166 class DeoptimizationEntry final {
1167 public:
1168 DeoptimizationEntry() {}
1169 DeoptimizationEntry(FrameStateDescriptor* descriptor, DeoptimizeReason reason)
1170 : descriptor_(descriptor), reason_(reason) {}
1164 1171
1165 typedef ZoneVector<FrameStateDescriptor*> DeoptimizationVector; 1172 FrameStateDescriptor* descriptor() const { return descriptor_; }
1173 DeoptimizeReason reason() const { return reason_; }
1166 1174
1175 private:
1176 FrameStateDescriptor* descriptor_ = nullptr;
1177 DeoptimizeReason reason_ = DeoptimizeReason::kNoReason;
1178 };
1179
1180 typedef ZoneVector<DeoptimizationEntry> DeoptimizationVector;
1167 1181
1168 class PhiInstruction final : public ZoneObject { 1182 class PhiInstruction final : public ZoneObject {
1169 public: 1183 public:
1170 typedef ZoneVector<InstructionOperand> Inputs; 1184 typedef ZoneVector<InstructionOperand> Inputs;
1171 1185
1172 PhiInstruction(Zone* zone, int virtual_register, size_t input_count); 1186 PhiInstruction(Zone* zone, int virtual_register, size_t input_count);
1173 1187
1174 void SetInput(size_t offset, int virtual_register); 1188 void SetInput(size_t offset, int virtual_register);
1175 1189
1176 int virtual_register() const { return virtual_register_; } 1190 int virtual_register() const { return virtual_register_; }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 int index = op->indexed_value(); 1421 int index = op->indexed_value();
1408 DCHECK(index >= 0); 1422 DCHECK(index >= 0);
1409 DCHECK(index < static_cast<int>(immediates_.size())); 1423 DCHECK(index < static_cast<int>(immediates_.size()));
1410 return immediates_[index]; 1424 return immediates_[index];
1411 } 1425 }
1412 } 1426 }
1413 UNREACHABLE(); 1427 UNREACHABLE();
1414 return Constant(static_cast<int32_t>(0)); 1428 return Constant(static_cast<int32_t>(0));
1415 } 1429 }
1416 1430
1417 class StateId { 1431 int AddDeoptimizationEntry(FrameStateDescriptor* descriptor,
1418 public: 1432 DeoptimizeReason reason);
1419 static StateId FromInt(int id) { return StateId(id); } 1433 DeoptimizationEntry const& GetDeoptimizationEntry(int deoptimization_id);
1420 int ToInt() const { return id_; } 1434 int GetDeoptimizationEntryCount() const {
1421 1435 return static_cast<int>(deoptimization_entries_.size());
1422 private:
1423 explicit StateId(int id) : id_(id) {}
1424 int id_;
1425 };
1426
1427 StateId AddFrameStateDescriptor(FrameStateDescriptor* descriptor);
1428 FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id);
1429 int GetFrameStateDescriptorCount();
1430 DeoptimizationVector const& frame_state_descriptors() const {
1431 return deoptimization_entries_;
1432 } 1436 }
1433 1437
1434 RpoNumber InputRpo(Instruction* instr, size_t index); 1438 RpoNumber InputRpo(Instruction* instr, size_t index);
1435 1439
1436 bool GetSourcePosition(const Instruction* instr, 1440 bool GetSourcePosition(const Instruction* instr,
1437 SourcePosition* result) const; 1441 SourcePosition* result) const;
1438 void SetSourcePosition(const Instruction* instr, SourcePosition value); 1442 void SetSourcePosition(const Instruction* instr, SourcePosition value);
1439 1443
1440 bool ContainsCall() const { 1444 bool ContainsCall() const {
1441 for (Instruction* instr : instructions_) { 1445 for (Instruction* instr : instructions_) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 1490
1487 1491
1488 std::ostream& operator<<(std::ostream& os, 1492 std::ostream& operator<<(std::ostream& os,
1489 const PrintableInstructionSequence& code); 1493 const PrintableInstructionSequence& code);
1490 1494
1491 } // namespace compiler 1495 } // namespace compiler
1492 } // namespace internal 1496 } // namespace internal
1493 } // namespace v8 1497 } // namespace v8
1494 1498
1495 #endif // V8_COMPILER_INSTRUCTION_H_ 1499 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698