summaryrefslogtreecommitdiff
path: root/deps/v8/src/interpreter/bytecodes.h
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2015-11-30 21:22:40 -0800
committerAli Ijaz Sheikh <ofrobots@google.com>2015-12-04 00:06:01 -0800
commit8a43a3d7619fde59f0d1f2fad05d8ae7d1732b02 (patch)
tree8698af91526d0eac90840dcba1e5b565160105c4 /deps/v8/src/interpreter/bytecodes.h
parent8a2acd4cc9807510786b4b6f7ad3a947aeb3a14c (diff)
downloadnode-new-8a43a3d7619fde59f0d1f2fad05d8ae7d1732b02.tar.gz
deps: upgrade V8 to 4.7.80.24
Pick up the latest branch head for V8 4.7: https://github.com/v8/v8/commit/be169f8df059040e6a53ec1dd4579d8bca2167b5 Full change history for the 4.7 branch: https://chromium.googlesource.com/v8/v8.git/+log/branch-heads/4.7 V8 blog post about what is new on V8 4.7: http://v8project.blogspot.de/2015/10/v8-release-47.html PR-URL: https://github.com/nodejs/node/pull/4106 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: targos - Michaƫl Zasso <mic.besace@gmail.com> Reviewed-By: rvagg - Rod Vagg <rod@vagg.org>
Diffstat (limited to 'deps/v8/src/interpreter/bytecodes.h')
-rw-r--r--deps/v8/src/interpreter/bytecodes.h123
1 files changed, 100 insertions, 23 deletions
diff --git a/deps/v8/src/interpreter/bytecodes.h b/deps/v8/src/interpreter/bytecodes.h
index fec6ecf6aa..3862842277 100644
--- a/deps/v8/src/interpreter/bytecodes.h
+++ b/deps/v8/src/interpreter/bytecodes.h
@@ -18,32 +18,71 @@ namespace interpreter {
// The list of operand types used by bytecodes.
#define OPERAND_TYPE_LIST(V) \
V(None) \
+ V(Count) \
V(Imm8) \
+ V(Idx) \
V(Reg)
// The list of bytecodes which are interpreted by the interpreter.
-#define BYTECODE_LIST(V) \
- \
- /* Loading the accumulator */ \
- V(LdaZero, OperandType::kNone) \
- V(LdaSmi8, OperandType::kImm8) \
- V(LdaUndefined, OperandType::kNone) \
- V(LdaNull, OperandType::kNone) \
- V(LdaTheHole, OperandType::kNone) \
- V(LdaTrue, OperandType::kNone) \
- V(LdaFalse, OperandType::kNone) \
- \
- /* Register-accumulator transfers */ \
- V(Ldar, OperandType::kReg) \
- V(Star, OperandType::kReg) \
- \
- /* Binary Operators */ \
- V(Add, OperandType::kReg) \
- V(Sub, OperandType::kReg) \
- V(Mul, OperandType::kReg) \
- V(Div, OperandType::kReg) \
- \
- /* Control Flow */ \
+#define BYTECODE_LIST(V) \
+ \
+ /* Loading the accumulator */ \
+ V(LdaZero, OperandType::kNone) \
+ V(LdaSmi8, OperandType::kImm8) \
+ V(LdaConstant, OperandType::kIdx) \
+ V(LdaUndefined, OperandType::kNone) \
+ V(LdaNull, OperandType::kNone) \
+ V(LdaTheHole, OperandType::kNone) \
+ V(LdaTrue, OperandType::kNone) \
+ V(LdaFalse, OperandType::kNone) \
+ \
+ /* Load globals */ \
+ V(LdaGlobal, OperandType::kIdx) \
+ \
+ /* Register-accumulator transfers */ \
+ V(Ldar, OperandType::kReg) \
+ V(Star, OperandType::kReg) \
+ \
+ /* LoadIC operations */ \
+ V(LoadIC, OperandType::kReg, OperandType::kIdx) \
+ V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \
+ \
+ /* StoreIC operations */ \
+ V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
+ V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
+ \
+ /* Binary Operators */ \
+ V(Add, OperandType::kReg) \
+ V(Sub, OperandType::kReg) \
+ V(Mul, OperandType::kReg) \
+ V(Div, OperandType::kReg) \
+ V(Mod, OperandType::kReg) \
+ \
+ /* Call operations. */ \
+ V(Call, OperandType::kReg, OperandType::kReg, OperandType::kCount) \
+ \
+ /* Test Operators */ \
+ V(TestEqual, OperandType::kReg) \
+ V(TestNotEqual, OperandType::kReg) \
+ V(TestEqualStrict, OperandType::kReg) \
+ V(TestNotEqualStrict, OperandType::kReg) \
+ V(TestLessThan, OperandType::kReg) \
+ V(TestGreaterThan, OperandType::kReg) \
+ V(TestLessThanOrEqual, OperandType::kReg) \
+ V(TestGreaterThanOrEqual, OperandType::kReg) \
+ V(TestInstanceOf, OperandType::kReg) \
+ V(TestIn, OperandType::kReg) \
+ \
+ /* Cast operators */ \
+ V(ToBoolean, OperandType::kNone) \
+ \
+ /* Control Flow */ \
+ V(Jump, OperandType::kImm8) \
+ V(JumpConstant, OperandType::kIdx) \
+ V(JumpIfTrue, OperandType::kImm8) \
+ V(JumpIfTrueConstant, OperandType::kIdx) \
+ V(JumpIfFalse, OperandType::kImm8) \
+ V(JumpIfFalseConstant, OperandType::kIdx) \
V(Return, OperandType::kNone)
@@ -73,6 +112,43 @@ 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;
+
+ Register() : index_(kIllegalIndex) {}
+
+ explicit Register(int index) : index_(index) {
+ DCHECK_LE(index_, kMaxRegisterIndex);
+ DCHECK_GE(index_, kMinRegisterIndex);
+ }
+
+ int index() const {
+ DCHECK(index_ != kIllegalIndex);
+ 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:
+ static const int kIllegalIndex = kMaxInt;
+
+ void* operator new(size_t size);
+ void operator delete(void* p);
+
+ int index_;
+};
+
+
class Bytecodes {
public:
// Returns string representation of |bytecode|.
@@ -103,7 +179,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);