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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 // TODO(rmcilroy): Deal with possible direct eval here? 454 // TODO(rmcilroy): Deal with possible direct eval here?
455 // TODO(rmcilroy): Use CallIC to allow call type feedback. 455 // TODO(rmcilroy): Use CallIC to allow call type feedback.
456 builder().Call(callee, receiver, args->length()); 456 builder().Call(callee, receiver, args->length());
457 } 457 }
458 458
459 459
460 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); } 460 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); }
461 461
462 462
463 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { UNIMPLEMENTED(); } 463 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) {
464 if (expr->is_jsruntime()) {
465 UNIMPLEMENTED();
466 }
467
468 // Evaluate all arguments to the runtime call.
469 ZoneList<Expression*>* args = expr->arguments();
470 TemporaryRegisterScope temporary_register_scope(&builder_);
471 // Ensure we always have a valid first_arg register even if there are no
472 // arguments to pass.
473 Register first_arg = temporary_register_scope.NewRegister();
474 for (int i = 0; i < args->length(); ++i) {
475 Register arg =
476 (i == 0) ? first_arg : temporary_register_scope.NewRegister();
477 Visit(args->at(i));
478 DCHECK(arg.index() - i == first_arg.index());
479 builder().StoreAccumulatorInRegister(arg);
480 }
481
482 Runtime::FunctionId function_id = expr->function()->function_id;
483 builder().CallRuntime(function_id, first_arg, args->length());
484 }
464 485
465 486
466 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { 487 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
467 UNIMPLEMENTED(); 488 UNIMPLEMENTED();
468 } 489 }
469 490
470 491
471 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { 492 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
472 UNIMPLEMENTED(); 493 UNIMPLEMENTED();
473 } 494 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 567 }
547 568
548 569
549 int BytecodeGenerator::feedback_index(FeedbackVectorICSlot slot) const { 570 int BytecodeGenerator::feedback_index(FeedbackVectorICSlot slot) const {
550 return info()->feedback_vector()->GetIndex(slot); 571 return info()->feedback_vector()->GetIndex(slot);
551 } 572 }
552 573
553 } // namespace interpreter 574 } // namespace interpreter
554 } // namespace internal 575 } // namespace internal
555 } // namespace v8 576 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698