| 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) { | 596 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { UNIMPLEMENTED(); } |
| 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 } | |
| 620 | 597 |
| 621 | 598 |
| 622 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 599 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 623 UNIMPLEMENTED(); | 600 UNIMPLEMENTED(); |
| 624 } | 601 } |
| 625 | 602 |
| 626 | 603 |
| 627 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { | 604 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 628 UNIMPLEMENTED(); | 605 UNIMPLEMENTED(); |
| 629 } | 606 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 679 } |
| 703 | 680 |
| 704 | 681 |
| 705 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 682 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 706 return info()->feedback_vector()->GetIndex(slot); | 683 return info()->feedback_vector()->GetIndex(slot); |
| 707 } | 684 } |
| 708 | 685 |
| 709 } // namespace interpreter | 686 } // namespace interpreter |
| 710 } // namespace internal | 687 } // namespace internal |
| 711 } // namespace v8 | 688 } // namespace v8 |
| OLD | NEW |