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

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: Move function address calculation into bytecode handler and have an option on CEntry stub for argv_… 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..d67ca6996d3d119cf10c3e0eba0ebdf69c9284b0 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -460,7 +460,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(arg.index() - i == first_arg.index());
Michael Starzinger 2015/09/29 08:28:34 nit: DCHECK_EQ here?
rmcilroy 2015/10/01 17:02:45 Done.
+ builder().StoreAccumulatorInRegister(arg);
+ }
+
+ // TODO(rmcilroy): support multiple return values.
+ DCHECK(expr->function()->result_size <= 1);
oth 2015/09/29 09:33:36 nit: DCHECK_LE
rmcilroy 2015/10/01 17:02:45 Done.
+ 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