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

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: Fix arm32 debug build check errors. 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-iterator.cc ('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 af7ef553288a616c0c1b12692fcd8a5fc221e328..a66e44a145d48144bc46a4799c0f11a1ecfbe6b3 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -593,7 +593,30 @@ 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_EQ(arg.index() - i, first_arg.index());
+ builder()->StoreAccumulatorInRegister(arg);
+ }
+
+ // TODO(rmcilroy): support multiple return values.
+ DCHECK_LE(expr->function()->result_size, 1);
+ Runtime::FunctionId function_id = expr->function()->function_id;
+ builder()->CallRuntime(function_id, first_arg, args->length());
+}
void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
« no previous file with comments | « src/interpreter/bytecode-array-iterator.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698