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

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

Issue 1378523005: [Interpreter] Add support for global declarations and load/store of global variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_toplevel
Patch Set: Created 5 years, 3 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 78b5e1e76927762f6309150af6886b866669bf1b..75f0afcdac51d7e307ad4573789d3ddaf43768f2 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -223,6 +223,35 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int slot_index) {
return *this;
}
+
+BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
+ int slot_index, LanguageMode language_mode) {
+ if (!is_sloppy(language_mode)) {
+ UNIMPLEMENTED();
+ }
+ DCHECK(slot_index >= 0);
+ if (FitsInIdxOperand(slot_index)) {
+ Output(Bytecode::kStaGlobal, static_cast<uint8_t>(slot_index));
+ } else {
+ UNIMPLEMENTED();
+ }
+ return *this;
+}
+
+
+BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
+ int slot_index) {
+ DCHECK(slot_index >= 0);
+ if (FitsInIdxOperand(slot_index)) {
+ Output(Bytecode::kLdaContextSlot, context.ToOperand(),
+ static_cast<uint8_t>(slot_index));
+ } else {
+ UNIMPLEMENTED();
+ }
+ return *this;
+}
+
+
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
Register object, int feedback_slot, LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
@@ -535,7 +564,9 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
return static_cast<uint8_t>(operand_value) == operand_value;
case OperandType::kReg: {
Register reg = Register::FromOperand(static_cast<uint8_t>(operand_value));
- if (reg.is_parameter()) {
+ if (reg.is_function_context()) {
+ return true;
+ } else if (reg.is_parameter()) {
int parameter_index = reg.ToParameterIndex(parameter_count_);
return parameter_index >= 0 && parameter_index < parameter_count_;
} else {

Powered by Google App Engine
This is Rietveld 408576698