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

Unified Diff: src/interpreter/bytecode-array-builder.h

Issue 1303403004: [Interpreter] Add support for parameter variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_add_bytecodes
Patch Set: Address review comments Created 5 years, 4 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/ia32/builtins-ia32.cc ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.h
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h
index c4ab816665800393986f0edcc565af3b7a51b0a9..fda32e60baf11d43efd9118059f92109711da1c2 100644
--- a/src/interpreter/bytecode-array-builder.h
+++ b/src/interpreter/bytecode-array-builder.h
@@ -8,6 +8,7 @@
#include <vector>
#include "src/ast.h"
+#include "src/frames.h"
#include "src/interpreter/bytecodes.h"
namespace v8 {
@@ -24,10 +25,16 @@ class BytecodeArrayBuilder {
explicit BytecodeArrayBuilder(Isolate* isolate);
Handle<BytecodeArray> ToBytecodeArray();
+ // Set number of parameters expected by function.
+ void set_parameter_count(int number_of_params);
+ int parameter_count() const;
+
// Set number of locals required for bytecode array.
void set_locals_count(int number_of_locals);
int locals_count() const;
+ Register Parameter(int parameter_index);
+
// Constant loads to accumulator.
BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value);
BytecodeArrayBuilder& LoadUndefined();
@@ -47,6 +54,9 @@ class BytecodeArrayBuilder {
BytecodeArrayBuilder& Return();
private:
+ static const int kLastParamRegisterIndex =
+ -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize;
+
static Bytecode BytecodeForBinaryOperation(Token::Value op);
void Output(Bytecode bytecode, uint8_t r0, uint8_t r1, uint8_t r2);
@@ -64,6 +74,7 @@ class BytecodeArrayBuilder {
std::vector<uint8_t> bytecodes_;
bool bytecode_generated_;
+ int parameter_count_;
int local_register_count_;
int temporary_register_count_;
int temporary_register_next_;
@@ -72,17 +83,20 @@ class BytecodeArrayBuilder {
DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder);
};
-// An interpreter register which is located in the function's regsiter file
+// An interpreter register which is located in the function's register file
// in its stack-frame.
class Register {
public:
static const int kMaxRegisterIndex = 128;
+ static const int kMinRegisterIndex = -127;
explicit Register(int index) : index_(index) {
DCHECK_LE(index_, kMaxRegisterIndex);
+ DCHECK_GE(index_, kMinRegisterIndex);
}
int index() { return index_; }
+
uint8_t ToOperand() { return static_cast<uint8_t>(-index_); }
static Register FromOperand(uint8_t operand) {
return Register(-static_cast<int8_t>(operand));
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698