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

Unified Diff: src/interpreter/bytecodes.h

Issue 1325983002: [Intepreter] Extend and move Register class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test, bug spotted by bots. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecodes.h
diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h
index a5b34f791afcfa1ca7101a4333e9dcd34a3b8403..7fd16812c95e9612bbab8726fcaaf604746bbde4 100644
--- a/src/interpreter/bytecodes.h
+++ b/src/interpreter/bytecodes.h
@@ -76,6 +76,36 @@ enum class Bytecode : uint8_t {
};
+// An interpreter register which is located in the function's register file
+// in its stack-frame. Register hold parameters, this, and expression values.
+class Register {
+ public:
+ static const int kMaxRegisterIndex = 127;
+ static const int kMinRegisterIndex = -128;
+
+ explicit Register(int index) : index_(index) {
+ DCHECK_LE(index_, kMaxRegisterIndex);
+ DCHECK_GE(index_, kMinRegisterIndex);
+ }
+
+ int index() const { return index_; }
+ bool is_parameter() const { return index_ < 0; }
+
+ static Register FromParameterIndex(int index, int parameter_count);
+ int ToParameterIndex(int parameter_count) const;
+ static int MaxParameterIndex();
+
+ static Register FromOperand(uint8_t operand);
+ uint8_t ToOperand() const;
+
+ private:
+ void* operator new(size_t size);
+ void operator delete(void* p);
+
+ int index_;
+};
+
+
class Bytecodes {
public:
// Returns string representation of |bytecode|.
@@ -106,7 +136,8 @@ class Bytecodes {
static int MaximumSize();
// Decode a single bytecode and operands to |os|.
- static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start);
+ static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start,
+ int number_of_parameters);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes);
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698