Index: src/compiler/instruction.cc |
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc |
index 280dd6e7df8e5d5838d4ebb4de31fd3b31af25de..ada5a0d1b0d7101a0b055c0cf4f670f011e5e93c 100644 |
--- a/src/compiler/instruction.cc |
+++ b/src/compiler/instruction.cc |
@@ -416,6 +416,76 @@ int InstructionSequence::GetFrameStateDescriptorCount() { |
} |
+FrameStateDescriptor::FrameStateDescriptor( |
+ Zone* zone, const FrameStateCallInfo& state_info, size_t parameters_count, |
+ size_t locals_count, size_t stack_count, FrameStateDescriptor* outer_state) |
+ : type_(state_info.type()), |
+ bailout_id_(state_info.bailout_id()), |
+ frame_state_combine_(state_info.state_combine()), |
+ parameters_count_(parameters_count), |
+ locals_count_(locals_count), |
+ stack_count_(stack_count), |
+ types_(zone), |
+ outer_state_(outer_state), |
+ jsfunction_(state_info.jsfunction()) {} |
+ |
+size_t FrameStateDescriptor::GetSize(OutputFrameStateCombine combine) const { |
+ size_t size = parameters_count() + locals_count() + stack_count() + |
+ (HasContext() ? 1 : 0); |
+ switch (combine.kind()) { |
+ case OutputFrameStateCombine::kPushOutput: |
+ size += combine.GetPushCount(); |
+ break; |
+ case OutputFrameStateCombine::kPokeAt: |
+ break; |
+ } |
+ return size; |
+} |
+ |
+ |
+size_t FrameStateDescriptor::GetTotalSize() const { |
+ size_t total_size = 0; |
+ for (const FrameStateDescriptor* iter = this; iter != NULL; |
+ iter = iter->outer_state_) { |
+ total_size += iter->GetSize(); |
+ } |
+ return total_size; |
+} |
+ |
+ |
+size_t FrameStateDescriptor::GetFrameCount() const { |
+ size_t count = 0; |
+ for (const FrameStateDescriptor* iter = this; iter != NULL; |
+ iter = iter->outer_state_) { |
+ ++count; |
+ } |
+ return count; |
+} |
+ |
+ |
+size_t FrameStateDescriptor::GetJSFrameCount() const { |
+ size_t count = 0; |
+ for (const FrameStateDescriptor* iter = this; iter != NULL; |
+ iter = iter->outer_state_) { |
+ if (iter->type_ == JS_FRAME) { |
+ ++count; |
+ } |
+ } |
+ return count; |
+} |
+ |
+ |
+MachineType FrameStateDescriptor::GetType(size_t index) const { |
+ return types_[index]; |
+} |
+ |
+ |
+void FrameStateDescriptor::SetTypes(ZoneVector<MachineType>* types) { |
+ DCHECK(types_.empty()); |
+ types->swap(types_); |
+} |
+ |
+ |
std::ostream& operator<<(std::ostream& os, const InstructionSequence& code) { |
for (size_t i = 0; i < code.immediates_.size(); ++i) { |
Constant constant = code.immediates_[i]; |