Index: src/compiler/instruction.cc |
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc |
index 1f9543a63531434c279e84cfe01e9be90a3c961b..6e73faf70c54622fafde53a1913d491c62c604d4 100644 |
--- a/src/compiler/instruction.cc |
+++ b/src/compiler/instruction.cc |
@@ -6,6 +6,7 @@ |
#include "src/compiler/graph.h" |
#include "src/compiler/instruction.h" |
#include "src/compiler/schedule.h" |
+#include "src/compiler/state-values-utils.h" |
namespace v8 { |
namespace internal { |
@@ -59,6 +60,69 @@ FlagsCondition CommuteFlagsCondition(FlagsCondition condition) { |
} |
+FrameStateDescriptor::FrameStateDescriptor( |
+ Zone* zone, FrameStateType type, BailoutId bailout_id, |
+ OutputFrameStateCombine state_combine, size_t parameters_count, |
+ size_t locals_count, size_t stack_count, |
+ MaybeHandle<SharedFunctionInfo> shared_info, |
+ FrameStateDescriptor* outer_state) |
+ : type_(type), |
+ bailout_id_(bailout_id), |
+ frame_state_combine_(state_combine), |
+ parameters_count_(parameters_count), |
+ locals_count_(locals_count), |
+ stack_count_(stack_count), |
+ values_(zone), |
+ shared_info_(shared_info), |
+ outer_state_(outer_state) {} |
+ |
+ |
+size_t FrameStateDescriptor::GetSize(OutputFrameStateCombine combine) const { |
+ size_t size = 1 + 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_ == FrameStateType::kJavaScriptFunction) { |
+ ++count; |
+ } |
+ } |
+ return count; |
+} |
+ |
+ |
std::ostream& operator<<(std::ostream& os, |
const PrintableInstructionOperand& printable) { |
const InstructionOperand& op = printable.op_; |
@@ -744,82 +808,6 @@ void InstructionSequence::SetSourcePosition(const Instruction* instr, |
} |
-FrameStateDescriptor::FrameStateDescriptor( |
- Zone* zone, FrameStateType type, BailoutId bailout_id, |
- OutputFrameStateCombine state_combine, size_t parameters_count, |
- size_t locals_count, size_t stack_count, |
- MaybeHandle<SharedFunctionInfo> shared_info, |
- FrameStateDescriptor* outer_state) |
- : type_(type), |
- bailout_id_(bailout_id), |
- frame_state_combine_(state_combine), |
- parameters_count_(parameters_count), |
- locals_count_(locals_count), |
- stack_count_(stack_count), |
- types_(zone), |
- shared_info_(shared_info), |
- outer_state_(outer_state) { |
- types_.resize(GetSize(), kMachNone); |
-} |
- |
- |
-size_t FrameStateDescriptor::GetSize(OutputFrameStateCombine combine) const { |
- size_t size = 1 + 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_ == FrameStateType::kJavaScriptFunction) { |
- ++count; |
- } |
- } |
- return count; |
-} |
- |
- |
-MachineType FrameStateDescriptor::GetType(size_t index) const { |
- return types_[index]; |
-} |
- |
- |
-void FrameStateDescriptor::SetType(size_t index, MachineType type) { |
- DCHECK(index < GetSize()); |
- types_[index] = type; |
-} |
- |
- |
std::ostream& operator<<(std::ostream& os, const RpoNumber& rpo) { |
return os << rpo.ToSize(); |
} |