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

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

Issue 1412953007: [Interpreter] Fill out function prologue support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased 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-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 3317b51bcd894e3876c9f411c09cfd1636cc2b2b..8c791db5e3d9ddbab25e65145c45bccffcb413e1 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -55,7 +55,6 @@ class BytecodeGenerator::ContextScope BASE_EMBEDDED {
for (int i = depth; i > 0; --i) {
previous = previous->outer_;
}
- DCHECK_EQ(previous->scope_, scope);
return previous;
}
@@ -309,6 +308,26 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
void BytecodeGenerator::MakeBytecodeBody() {
+ // Build the arguments object if it is used.
+ VisitArgumentsObject(scope()->arguments());
+
+ // Build assignment to {.this_function} variable if it is used.
+ VisitThisFunctionVariable(scope()->this_function_var());
+
+ // Build assignment to {new.target} variable if it is used.
+ VisitNewTargetVariable(scope()->new_target_var());
+
+ // TODO(rmcilroy): Emit tracing call if requested to do so.
+ if (FLAG_trace) {
+ UNIMPLEMENTED();
+ }
+
+ // Visit illegal re-declaration and bail out if it exists.
+ if (scope()->HasIllegalRedeclaration()) {
+ Visit(scope()->GetIllegalRedeclaration());
+ return;
+ }
+
// Visit declarations within the function scope.
VisitDeclarations(scope()->declarations());
@@ -1653,6 +1672,46 @@ void BytecodeGenerator::VisitSetHomeObject(Register value, Register home_object,
}
+void BytecodeGenerator::VisitArgumentsObject(Variable* variable) {
+ if (variable == nullptr) return;
+
+ DCHECK(variable->IsContextSlot() || variable->IsStackAllocated());
+
+ // Allocate and initialize a new arguments object and assign to the
+ // {arguments} variable.
+ CreateArgumentsType type =
+ is_strict(language_mode()) || !info()->has_simple_parameters()
+ ? CreateArgumentsType::kUnmappedArguments
+ : CreateArgumentsType::kMappedArguments;
+ builder()->CreateArguments(type);
+ VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid());
+}
+
+
+void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) {
+ if (variable == nullptr) return;
+
+ // TODO(rmcilroy): Remove once we have tests which exercise this code path.
+ UNIMPLEMENTED();
+
+ // Store the closure we were called with in the this_function_var.
+ builder()->LoadAccumulatorWithRegister(Register::function_closure());
+ VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid());
+}
+
+
+void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) {
+ if (variable == nullptr) return;
+
+ // TODO(rmcilroy): Remove once we have tests which exercise this code path.
+ UNIMPLEMENTED();
+
+ // Store the closure we were called with in the this_function_var.
+ builder()->CallRuntime(Runtime::kGetOriginalConstructor, Register(), 0);
+ VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid());
+}
+
+
void BytecodeGenerator::VisitFunctionClosureForContext() {
AccumulatorResultScope accumulator_execution_result(this);
Scope* closure_scope = execution_context()->scope()->ClosureScope();
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698