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

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 ia32 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
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 1ce19f901f4ed46c0474f538e9c3e5debf9ad330..70342079e0ffcb4838fe7130ee383eb0252ffa66 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,25 @@ 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);
+}
+
Michael Starzinger 2015/10/13 09:38:43 nit: Two empty newlines.
rmcilroy 2015/10/13 10:35:22 Done.
+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_);
@@ -322,6 +342,18 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
}
+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
@@ -571,7 +603,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_);

Powered by Google App Engine
This is Rietveld 408576698