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

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

Issue 1403943004: [Interpreter] Add support for local context loads and stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_contextchain
Patch Set: Add back outer_ &&] 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 abee9f78049502746686633adfe77f2d34e3516f..631e29e3761f6eb09cb6886641fbd604306b5cf0 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -32,17 +32,11 @@ void BytecodeArrayBuilder::set_locals_count(int number_of_locals) {
}
-int BytecodeArrayBuilder::locals_count() const { return local_register_count_; }
-
-
void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) {
parameter_count_ = number_of_parameters;
}
-int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; }
-
-
void BytecodeArrayBuilder::set_context_count(int number_of_contexts) {
context_register_count_ = number_of_contexts;
DCHECK_GE(local_register_count_, 0);
@@ -64,20 +58,17 @@ Register BytecodeArrayBuilder::last_context_register() const {
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_);
+ return Register::FromParameterIndex(parameter_index, parameter_count());
}
Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
DCHECK_EQ(bytecode_generated_, false);
- DCHECK_GE(parameter_count_, 0);
- DCHECK_GE(local_register_count_, 0);
EnsureReturn();
int bytecode_size = static_cast<int>(bytecodes_.size());
- int register_count = local_register_count_ + temporary_register_count_;
+ int register_count = fixed_register_count() + temporary_register_count_;
int frame_size = register_count * kPointerSize;
Factory* factory = isolate_->factory();
@@ -90,7 +81,7 @@ Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
Handle<BytecodeArray> output =
factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size,
- parameter_count_, constant_pool);
+ parameter_count(), constant_pool);
bytecode_generated_ = true;
return output;
}
@@ -291,6 +282,19 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context,
+ int slot_index) {
+ DCHECK(slot_index >= 0);
+ if (FitsInIdx8Operand(slot_index)) {
+ Output(Bytecode::kStaContextSlot, context.ToOperand(),
+ static_cast<uint8_t>(slot_index));
+ } else {
+ UNIMPLEMENTED();
+ }
+ return *this;
+}
+
+
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
Register object, int feedback_slot, LanguageMode language_mode) {
Bytecode bytecode = BytecodeForLoadIC(language_mode);
@@ -630,9 +634,8 @@ size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
int BytecodeArrayBuilder::BorrowTemporaryRegister() {
- DCHECK_GE(local_register_count_, 0);
int temporary_reg_index = temporary_register_next_++;
- int count = temporary_register_next_ - local_register_count_;
+ int count = temporary_register_next_ - fixed_register_count();
if (count > temporary_register_count_) {
temporary_register_count_ = count;
}
@@ -663,8 +666,8 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
if (reg.is_function_context() || reg.is_function_closure()) {
return true;
} else if (reg.is_parameter()) {
- int parameter_index = reg.ToParameterIndex(parameter_count_);
- return parameter_index >= 0 && parameter_index < parameter_count_;
+ int parameter_index = reg.ToParameterIndex(parameter_count());
+ return parameter_index >= 0 && parameter_index < parameter_count();
} else {
return (reg.index() >= 0 && reg.index() < temporary_register_next_);
}
« 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