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

Unified Diff: src/compiler/instruction.h

Issue 1485183002: [turbofan] Deopt support for escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ea-local
Patch Set: Fix --always-opt triggered bug Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index 5c052ac3c5d5de74bf3833d349852428e9de01f2..acb20b9b3d1d03680f12dc4f28364fa4e004c0cf 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -23,8 +23,10 @@ namespace v8 {
namespace internal {
namespace compiler {
+// Forward declarations.
class Schedule;
+
class InstructionOperand {
public:
static const int kInvalidVirtualRegister = -1;
@@ -105,6 +107,104 @@ class InstructionOperand {
};
+typedef ZoneVector<InstructionOperand> InstructionOperandVector;
+
+
+// Forward declarations.
+class FrameStateDescriptor;
+
+
+enum class StateValueKind { kPlain, kRecursive, kDuplicate };
+
+
+class StateValueDescriptor {
+ public:
+ explicit StateValueDescriptor(Zone* zone)
+ : kind_(StateValueKind::kPlain),
+ type_(kMachAnyTagged),
+ id_(0),
+ fields_(zone) {}
+
+ static StateValueDescriptor Plain(Zone* zone, MachineType type) {
+ return StateValueDescriptor(StateValueKind::kPlain, zone, type, 0);
+ }
+ static StateValueDescriptor Recursive(Zone* zone, size_t id) {
+ return StateValueDescriptor(StateValueKind::kRecursive, zone,
+ kMachAnyTagged, id);
+ }
+ static StateValueDescriptor Duplicate(Zone* zone, size_t id) {
+ return StateValueDescriptor(StateValueKind::kDuplicate, zone,
+ kMachAnyTagged, id);
+ }
+
+ size_t size() { return fields_.size(); }
+ ZoneVector<StateValueDescriptor>& fields() { return fields_; }
+ int IsPlain() { return kind_ == StateValueKind::kPlain; }
+ int IsRecursive() { return kind_ == StateValueKind::kRecursive; }
+ int IsDuplicate() { return kind_ == StateValueKind::kDuplicate; }
+ MachineType type() const { return type_; }
+ MachineType GetOperandType(size_t index) const {
+ return fields_[index].type_;
+ }
+ size_t id() const { return id_; }
+
+ private:
+ StateValueDescriptor(StateValueKind kind, Zone* zone, MachineType type,
+ size_t id)
+ : kind_(kind), type_(type), id_(id), fields_(zone) {}
+
+ StateValueKind kind_;
+ MachineType type_;
+ size_t id_;
+ ZoneVector<StateValueDescriptor> fields_;
+};
+
+
+class FrameStateDescriptor : public ZoneObject {
+ public:
+ 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 = nullptr);
+
+ FrameStateType type() const { return type_; }
+ BailoutId bailout_id() const { return bailout_id_; }
+ OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
+ size_t parameters_count() const { return parameters_count_; }
+ size_t locals_count() const { return locals_count_; }
+ size_t stack_count() const { return stack_count_; }
+ MaybeHandle<SharedFunctionInfo> shared_info() const { return shared_info_; }
+ FrameStateDescriptor* outer_state() const { return outer_state_; }
+ bool HasContext() const {
+ return type_ == FrameStateType::kJavaScriptFunction;
+ }
+
+ size_t GetSize(OutputFrameStateCombine combine =
+ OutputFrameStateCombine::Ignore()) const;
+ size_t GetTotalSize() const;
+ size_t GetFrameCount() const;
+ size_t GetJSFrameCount() const;
+
+ MachineType GetType(size_t index) const {
+ return values_.GetOperandType(index);
+ }
+ StateValueDescriptor* GetStateValueDescriptor() { return &values_; }
+
+ private:
+ FrameStateType type_;
+ BailoutId bailout_id_;
+ OutputFrameStateCombine frame_state_combine_;
+ size_t parameters_count_;
+ size_t locals_count_;
+ size_t stack_count_;
+ StateValueDescriptor values_;
+ MaybeHandle<SharedFunctionInfo> const shared_info_;
+ FrameStateDescriptor* outer_state_;
+};
+
+
struct PrintableInstructionOperand {
const RegisterConfiguration* register_configuration_;
InstructionOperand op_;
@@ -928,48 +1028,6 @@ class Constant final {
};
-class FrameStateDescriptor : public ZoneObject {
- public:
- 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 = nullptr);
-
- FrameStateType type() const { return type_; }
- BailoutId bailout_id() const { return bailout_id_; }
- OutputFrameStateCombine state_combine() const { return frame_state_combine_; }
- size_t parameters_count() const { return parameters_count_; }
- size_t locals_count() const { return locals_count_; }
- size_t stack_count() const { return stack_count_; }
- MaybeHandle<SharedFunctionInfo> shared_info() const { return shared_info_; }
- FrameStateDescriptor* outer_state() const { return outer_state_; }
- bool HasContext() const {
- return type_ == FrameStateType::kJavaScriptFunction;
- }
-
- size_t GetSize(OutputFrameStateCombine combine =
- OutputFrameStateCombine::Ignore()) const;
- size_t GetTotalSize() const;
- size_t GetFrameCount() const;
- size_t GetJSFrameCount() const;
-
- MachineType GetType(size_t index) const;
- void SetType(size_t index, MachineType type);
-
- private:
- FrameStateType type_;
- BailoutId bailout_id_;
- OutputFrameStateCombine frame_state_combine_;
- size_t parameters_count_;
- size_t locals_count_;
- size_t stack_count_;
- ZoneVector<MachineType> types_;
- MaybeHandle<SharedFunctionInfo> const shared_info_;
- FrameStateDescriptor* outer_state_;
-};
-
std::ostream& operator<<(std::ostream& os, const Constant& constant);

Powered by Google App Engine
This is Rietveld 408576698