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

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

Issue 1379793004: [Interpreter] Add support for new local function context creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_decl
Patch Set: Fix interpreter-assembler-unittest Created 5 years, 2 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.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 5476a475f214c51d72dd88875a4badc0a632a2ac..cdc2442888cc29f1692b9972835392bf4fc0ab5b 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -20,12 +20,14 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone)
constants_(zone),
parameter_count_(-1),
local_register_count_(-1),
+ context_register_count_(-1),
temporary_register_count_(0),
temporary_register_next_(0) {}
void BytecodeArrayBuilder::set_locals_count(int number_of_locals) {
local_register_count_ = number_of_locals;
+ DCHECK_LE(context_register_count_, 0);
temporary_register_next_ = local_register_count_;
}
@@ -41,7 +43,26 @@ void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) {
int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; }
-Register BytecodeArrayBuilder::Parameter(int parameter_index) {
+void BytecodeArrayBuilder::set_context_count(int number_of_contexts) {
+ context_register_count_ = number_of_contexts;
+ DCHECK_GE(local_register_count_, 0);
+ temporary_register_next_ = local_register_count_ + context_register_count_;
+}
+
+
+Register BytecodeArrayBuilder::first_context_register() const {
+ DCHECK_GT(context_register_count_, 0);
+ return Register(local_register_count_);
+}
+
+
+Register BytecodeArrayBuilder::last_context_register() const {
+ DCHECK_GT(context_register_count_, 0);
+ return Register(local_register_count_ + context_register_count_ - 1);
+}
+
+
+Register BytecodeArrayBuilder::Parameter(int parameter_index) const {
DCHECK_GE(parameter_index, 0);
DCHECK_LT(parameter_index, parameter_count_);
return Register::FromParameterIndex(parameter_index, parameter_count_);
@@ -330,6 +351,18 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
+ Output(Bytecode::kPushContext, context.ToOperand());
+ return *this;
+}
+
+
+BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
+ Output(Bytecode::kPopContext, context.ToOperand());
+ return *this;
+}
+
+
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() {
if (LastBytecodeInSameBlock()) {
// If the previous bytecode puts a boolean in the accumulator
@@ -579,7 +612,7 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
return static_cast<uint8_t>(operand_value) == operand_value;
case OperandType::kReg8: {
Register reg = Register::FromOperand(static_cast<uint8_t>(operand_value));
- if (reg.is_function_context()) {
+ if (reg.is_function_context() || reg.is_function_closure()) {
return true;
} else if (reg.is_parameter()) {
int parameter_index = reg.ToParameterIndex(parameter_count_);
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698