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

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

Issue 1402153004: Revert of [Interpreter] Support for operator new. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 3270d4e7e2ba54c263244405b7f944e45266247e..7a0ff9f45ad1157eccfe4de1ad858807518c7161 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -924,25 +924,6 @@
}
-Register BytecodeGenerator::VisitArguments(
- ZoneList<Expression*>* args, TemporaryRegisterScope* register_scope) {
- // Visit arguments and place in a contiguous block of temporary registers.
- // Return the first temporary register corresponding to the first argument.
- DCHECK_GT(args->length(), 0);
- Register first_arg = register_scope->NewRegister();
- Visit(args->at(0));
- builder()->StoreAccumulatorInRegister(first_arg);
- for (int i = 1; i < static_cast<int>(args->length()); i++) {
- Register ith_arg = register_scope->NewRegister();
- Visit(args->at(i));
- builder()->StoreAccumulatorInRegister(ith_arg);
- DCHECK(ith_arg.index() - i == first_arg.index());
- }
-
- return first_arg;
-}
-
-
void BytecodeGenerator::VisitCall(Call* expr) {
Expression* callee_expr = expr->expression();
Call::CallType call_type = expr->GetCallType(isolate());
@@ -990,9 +971,11 @@
// Evaluate all arguments to the function call and store in sequential
// registers.
ZoneList<Expression*>* args = expr->arguments();
- if (args->length() > 0) {
- Register first_arg = VisitArguments(args, &temporary_register_scope);
- CHECK_EQ(first_arg.index(), receiver.index() + 1);
+ for (int i = 0; i < args->length(); ++i) {
+ Visit(args->at(i));
+ Register arg = temporary_register_scope.NewRegister();
+ DCHECK(arg.index() - i == receiver.index() + 1);
+ builder()->StoreAccumulatorInRegister(arg);
}
// TODO(rmcilroy): Deal with possible direct eval here?
@@ -1001,22 +984,7 @@
}
-void BytecodeGenerator::VisitCallNew(CallNew* expr) {
- TemporaryRegisterScope temporary_register_scope(builder());
- Register constructor = temporary_register_scope.NewRegister();
- Visit(expr->expression());
- builder()->StoreAccumulatorInRegister(constructor);
- ZoneList<Expression*>* args = expr->arguments();
- if (args->length() > 0) {
- Register first_arg = VisitArguments(args, &temporary_register_scope);
- builder()->New(constructor, first_arg, args->length());
- } else {
- // The second argument here will be ignored as there are zero
- // arguments. Using the constructor register avoids avoid
- // allocating a temporary just to fill the operands.
- builder()->New(constructor, constructor, 0);
- }
-}
+void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); }
void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
@@ -1025,21 +993,22 @@
}
// Evaluate all arguments to the runtime call.
- TemporaryRegisterScope temporary_register_scope(&builder_);
+ 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;
- ZoneList<Expression*>* args = expr->arguments();
- Register first_arg;
- if (args->length() > 0) {
- first_arg = VisitArguments(args, &temporary_register_scope);
- } else {
- // Allocation here is just to fullfil the requirement that there
- // is a register operand for the start of the arguments though
- // there are zero when this is generated.
- first_arg = temporary_register_scope.NewRegister();
- }
builder()->CallRuntime(function_id, first_arg, args->length());
}
« 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