| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 builder()->StoreAccumulatorInRegister(arg); | 612 builder()->StoreAccumulatorInRegister(arg); |
| 613 } | 613 } |
| 614 | 614 |
| 615 // TODO(rmcilroy): support multiple return values. | 615 // TODO(rmcilroy): support multiple return values. |
| 616 DCHECK_LE(expr->function()->result_size, 1); | 616 DCHECK_LE(expr->function()->result_size, 1); |
| 617 Runtime::FunctionId function_id = expr->function()->function_id; | 617 Runtime::FunctionId function_id = expr->function()->function_id; |
| 618 builder()->CallRuntime(function_id, first_arg, args->length()); | 618 builder()->CallRuntime(function_id, first_arg, args->length()); |
| 619 } | 619 } |
| 620 | 620 |
| 621 | 621 |
| 622 void BytecodeGenerator::VisitVoid(UnaryOperation* expr) { |
| 623 Visit(expr->expression()); |
| 624 builder()->LoadUndefined(); |
| 625 } |
| 626 |
| 627 |
| 628 void BytecodeGenerator::VisitTypeOf(UnaryOperation* expr) { |
| 629 Visit(expr->expression()); |
| 630 builder()->TypeOf(); |
| 631 } |
| 632 |
| 633 |
| 634 void BytecodeGenerator::VisitNot(UnaryOperation* expr) { |
| 635 Visit(expr->expression()); |
| 636 builder()->LogicalNot(); |
| 637 } |
| 638 |
| 639 |
| 622 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 640 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 623 UNIMPLEMENTED(); | 641 switch (expr->op()) { |
| 642 case Token::Value::NOT: |
| 643 VisitNot(expr); |
| 644 break; |
| 645 case Token::Value::TYPEOF: |
| 646 VisitTypeOf(expr); |
| 647 break; |
| 648 case Token::Value::VOID: |
| 649 VisitVoid(expr); |
| 650 break; |
| 651 case Token::Value::BIT_NOT: |
| 652 case Token::Value::DELETE: |
| 653 UNIMPLEMENTED(); |
| 654 default: |
| 655 UNREACHABLE(); |
| 656 } |
| 624 } | 657 } |
| 625 | 658 |
| 626 | 659 |
| 627 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { | 660 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 628 UNIMPLEMENTED(); | 661 UNIMPLEMENTED(); |
| 629 } | 662 } |
| 630 | 663 |
| 631 | 664 |
| 632 void BytecodeGenerator::VisitBinaryOperation(BinaryOperation* binop) { | 665 void BytecodeGenerator::VisitBinaryOperation(BinaryOperation* binop) { |
| 633 switch (binop->op()) { | 666 switch (binop->op()) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 735 } |
| 703 | 736 |
| 704 | 737 |
| 705 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 738 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 706 return info()->feedback_vector()->GetIndex(slot); | 739 return info()->feedback_vector()->GetIndex(slot); |
| 707 } | 740 } |
| 708 | 741 |
| 709 } // namespace interpreter | 742 } // namespace interpreter |
| 710 } // namespace internal | 743 } // namespace internal |
| 711 } // namespace v8 | 744 } // namespace v8 |
| OLD | NEW |