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

Unified Diff: src/compiler/register-allocator-verifier.h

Issue 713803002: [turbofan] add register assignment verifier (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/register-allocator-verifier.h
diff --git a/src/compiler/register-allocator-verifier.h b/src/compiler/register-allocator-verifier.h
new file mode 100644
index 0000000000000000000000000000000000000000..10592e10f451fd40c1d70e868aa9c66272bcf45b
--- /dev/null
+++ b/src/compiler/register-allocator-verifier.h
@@ -0,0 +1,68 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_REGISTER_ALLOCATOR_VERIFIER_H_
+#define V8_REGISTER_ALLOCATOR_VERIFIER_H_
+
+#include "src/v8.h"
+#include "src/zone-containers.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+class InstructionOperand;
+class InstructionSequence;
+
+class RegisterAllocatorVerifier FINAL : public ZoneObject {
+ public:
+ RegisterAllocatorVerifier(Zone* zone, const InstructionSequence* sequence);
+
+ void VerifyAssignment();
+
+ private:
+ enum ConstraintType {
+ kConstant,
+ kImmediate,
+ kRegister,
+ kFixedRegister,
+ kDoubleRegister,
+ kFixedDoubleRegister,
+ kFixedSlot,
+ kNone,
+ kNoneDouble,
+ kSameAsFirst
+ };
+
+ struct OperandConstraint {
+ ConstraintType type_;
+ int value_; // subkind index when relevant
+ };
+
+ struct InstructionConstraint {
+ const Instruction* instruction_;
+ size_t operand_constaints_size_;
+ OperandConstraint* operand_constraints_;
+ };
+
+ typedef ZoneVector<InstructionConstraint> Constraints;
+
+ const InstructionSequence* sequence() const { return sequence_; }
+ Constraints* constraints() { return &constraints_; }
+ void BuildConstraint(const InstructionOperand* op,
+ OperandConstraint* constraint);
+ void CheckConstraint(const InstructionOperand* op,
+ const OperandConstraint* constraint);
+
+ const InstructionSequence* const sequence_;
+ Constraints constraints_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier);
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698