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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1303403004: [Interpreter] Add support for parameter variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_add_bytecodes
Patch Set: Fix Windows build 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
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 9cce681ad4ac79119ec701907df4813d156b3d60..a7f3d11d05e0fc18b2681bfb031f4ba744ce6102 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -30,6 +30,7 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
// This a temporary guard (oth).
DCHECK(scope()->is_function_scope());
+ builder().set_parameter_count(info->num_parameters_including_this());
builder().set_locals_count(scope()->num_stack_slots());
// Visit implicit declaration of the function name.
@@ -72,8 +73,6 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) {
UNIMPLEMENTED();
break;
case VariableLocation::PARAMETER:
- UNIMPLEMENTED();
- break;
case VariableLocation::LOCAL:
// Details stored in scope, i.e. variable index.
break;
@@ -248,9 +247,15 @@ void BytecodeGenerator::VisitVariableProxy(VariableProxy* proxy) {
builder().LoadAccumulatorWithRegister(source);
break;
}
+ case VariableLocation::PARAMETER: {
+ // The parameter indices are shifted by 1 (receiver is variable
+ // index -1 but is parameter index 0 in BytecodeArrayBuilder).
+ Register source(builder().Parameter(variable->index() + 1));
+ builder().LoadAccumulatorWithRegister(source);
+ break;
+ }
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED:
- case VariableLocation::PARAMETER:
case VariableLocation::CONTEXT:
case VariableLocation::LOOKUP:
UNIMPLEMENTED();

Powered by Google App Engine
This is Rietveld 408576698