| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 Token::Value op = expr->op(); | 680 Token::Value op = expr->op(); |
| 681 Expression* left = expr->left(); | 681 Expression* left = expr->left(); |
| 682 Expression* right = expr->right(); | 682 Expression* right = expr->right(); |
| 683 | 683 |
| 684 TemporaryRegisterScope temporary_register_scope(&builder_); | 684 TemporaryRegisterScope temporary_register_scope(&builder_); |
| 685 Register temporary = temporary_register_scope.NewRegister(); | 685 Register temporary = temporary_register_scope.NewRegister(); |
| 686 | 686 |
| 687 Visit(left); | 687 Visit(left); |
| 688 builder()->StoreAccumulatorInRegister(temporary); | 688 builder()->StoreAccumulatorInRegister(temporary); |
| 689 Visit(right); | 689 Visit(right); |
| 690 builder()->CompareOperation(op, temporary, language_mode()); | 690 builder()->CompareOperation(op, temporary, language_mode_strength()); |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 void BytecodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } | 694 void BytecodeGenerator::VisitSpread(Spread* expr) { UNREACHABLE(); } |
| 695 | 695 |
| 696 | 696 |
| 697 void BytecodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { | 697 void BytecodeGenerator::VisitEmptyParentheses(EmptyParentheses* expr) { |
| 698 UNREACHABLE(); | 698 UNREACHABLE(); |
| 699 } | 699 } |
| 700 | 700 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 719 Token::Value op = binop->op(); | 719 Token::Value op = binop->op(); |
| 720 Expression* left = binop->left(); | 720 Expression* left = binop->left(); |
| 721 Expression* right = binop->right(); | 721 Expression* right = binop->right(); |
| 722 | 722 |
| 723 TemporaryRegisterScope temporary_register_scope(&builder_); | 723 TemporaryRegisterScope temporary_register_scope(&builder_); |
| 724 Register temporary = temporary_register_scope.NewRegister(); | 724 Register temporary = temporary_register_scope.NewRegister(); |
| 725 | 725 |
| 726 Visit(left); | 726 Visit(left); |
| 727 builder()->StoreAccumulatorInRegister(temporary); | 727 builder()->StoreAccumulatorInRegister(temporary); |
| 728 Visit(right); | 728 Visit(right); |
| 729 builder()->BinaryOperation(op, temporary); | 729 builder()->BinaryOperation(op, temporary, language_mode_strength()); |
| 730 } | 730 } |
| 731 | 731 |
| 732 | 732 |
| 733 LanguageMode BytecodeGenerator::language_mode() const { | 733 LanguageMode BytecodeGenerator::language_mode() const { |
| 734 return info()->language_mode(); | 734 return info()->language_mode(); |
| 735 } | 735 } |
| 736 | 736 |
| 737 | 737 |
| 738 Strength BytecodeGenerator::language_mode_strength() const { |
| 739 return strength(language_mode()); |
| 740 } |
| 741 |
| 742 |
| 738 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 743 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 739 return info()->feedback_vector()->GetIndex(slot); | 744 return info()->feedback_vector()->GetIndex(slot); |
| 740 } | 745 } |
| 741 | 746 |
| 742 } // namespace interpreter | 747 } // namespace interpreter |
| 743 } // namespace internal | 748 } // namespace internal |
| 744 } // namespace v8 | 749 } // namespace v8 |
| OLD | NEW |