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

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

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 7257fd413422de3b43b4b146e3aa319b1e7b4264..c927d23595f5aac7b5d65dda2bc40b3d7b9a604d 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -460,7 +460,28 @@ void BytecodeGenerator::VisitCall(Call* expr) {
void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); }
-void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { UNIMPLEMENTED(); }
+void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
+ if (expr->is_jsruntime()) {
+ UNIMPLEMENTED();
+ }
+
+ // Evaluate all arguments to the runtime call.
+ ZoneList<Expression*>* args = expr->arguments();
+ TemporaryRegisterScope temporary_register_scope(&builder_);
+ // Ensure we always have a valid first_arg register even if there are no
+ // arguments to pass.
+ Register first_arg = temporary_register_scope.NewRegister();
+ for (int i = 0; i < args->length(); ++i) {
+ Register arg =
+ (i == 0) ? first_arg : temporary_register_scope.NewRegister();
+ Visit(args->at(i));
+ DCHECK(arg.index() - i == first_arg.index());
+ builder().StoreAccumulatorInRegister(arg);
+ }
+
+ Runtime::FunctionId function_id = expr->function()->function_id;
+ builder().CallRuntime(function_id, first_arg, args->length());
+}
void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {

Powered by Google App Engine
This is Rietveld 408576698