| OLD | NEW |
| 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/interpreter/control-flow-builders.h" | 10 #include "src/interpreter/control-flow-builders.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 586 |
| 587 // TODO(rmcilroy): Deal with possible direct eval here? | 587 // TODO(rmcilroy): Deal with possible direct eval here? |
| 588 // TODO(rmcilroy): Use CallIC to allow call type feedback. | 588 // TODO(rmcilroy): Use CallIC to allow call type feedback. |
| 589 builder()->Call(callee, receiver, args->length()); | 589 builder()->Call(callee, receiver, args->length()); |
| 590 } | 590 } |
| 591 | 591 |
| 592 | 592 |
| 593 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); } | 593 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); } |
| 594 | 594 |
| 595 | 595 |
| 596 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { UNIMPLEMENTED(); } | 596 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 597 if (expr->is_jsruntime()) { |
| 598 UNIMPLEMENTED(); |
| 599 } |
| 600 |
| 601 // Evaluate all arguments to the runtime call. |
| 602 ZoneList<Expression*>* args = expr->arguments(); |
| 603 TemporaryRegisterScope temporary_register_scope(&builder_); |
| 604 // Ensure we always have a valid first_arg register even if there are no |
| 605 // arguments to pass. |
| 606 Register first_arg = temporary_register_scope.NewRegister(); |
| 607 for (int i = 0; i < args->length(); ++i) { |
| 608 Register arg = |
| 609 (i == 0) ? first_arg : temporary_register_scope.NewRegister(); |
| 610 Visit(args->at(i)); |
| 611 DCHECK_EQ(arg.index() - i, first_arg.index()); |
| 612 builder()->StoreAccumulatorInRegister(arg); |
| 613 } |
| 614 |
| 615 // TODO(rmcilroy): support multiple return values. |
| 616 DCHECK_LE(expr->function()->result_size, 1); |
| 617 Runtime::FunctionId function_id = expr->function()->function_id; |
| 618 builder()->CallRuntime(function_id, first_arg, args->length()); |
| 619 } |
| 597 | 620 |
| 598 | 621 |
| 599 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 622 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 600 UNIMPLEMENTED(); | 623 UNIMPLEMENTED(); |
| 601 } | 624 } |
| 602 | 625 |
| 603 | 626 |
| 604 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { | 627 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 605 UNIMPLEMENTED(); | 628 UNIMPLEMENTED(); |
| 606 } | 629 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 702 } |
| 680 | 703 |
| 681 | 704 |
| 682 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 705 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 683 return info()->feedback_vector()->GetIndex(slot); | 706 return info()->feedback_vector()->GetIndex(slot); |
| 684 } | 707 } |
| 685 | 708 |
| 686 } // namespace interpreter | 709 } // namespace interpreter |
| 687 } // namespace internal | 710 } // namespace internal |
| 688 } // namespace v8 | 711 } // namespace v8 |
| OLD | NEW |