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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1399773002: [Interpreter] Adds logical and, logical or and comma operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed formatting problems with the expected bytecode initialization 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/interpreter-assembler.h" 9 #include "src/compiler/interpreter-assembler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 compiler::InterpreterAssembler* assembler) { 723 compiler::InterpreterAssembler* assembler) {
724 Node* accumulator = __ GetAccumulator(); 724 Node* accumulator = __ GetAccumulator();
725 Node* index = __ BytecodeOperandIdx8(0); 725 Node* index = __ BytecodeOperandIdx8(0);
726 Node* constant = __ LoadConstantPoolEntry(index); 726 Node* constant = __ LoadConstantPoolEntry(index);
727 Node* relative_jump = __ SmiUntag(constant); 727 Node* relative_jump = __ SmiUntag(constant);
728 Node* false_value = __ BooleanConstant(false); 728 Node* false_value = __ BooleanConstant(false);
729 __ JumpIfWordEqual(accumulator, false_value, relative_jump); 729 __ JumpIfWordEqual(accumulator, false_value, relative_jump);
730 } 730 }
731 731
732 732
733 // JumpIfToBooleanTrue <imm8>
734 //
735 // Jump by number of bytes represented by an immediate operand if the object
736 // referenced by the accumulator is true when the object is cast to boolean.
737 void Interpreter::DoJumpIfToBooleanTrue(
738 compiler::InterpreterAssembler* assembler) {
739 Node* accumulator = __ GetAccumulator();
740 Node* relative_jump = __ BytecodeOperandImm8(0);
741 Node* to_boolean_value =
742 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
743 Node* true_value = __ BooleanConstant(true);
744 __ JumpIfWordEqual(to_boolean_value, true_value, relative_jump);
745 }
746
747
748 // JumpIfToBooleanTrueConstant <idx>
749 //
750 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool
751 // if the object referenced by the accumulator is true when the object is cast
752 // to boolean.
753 void Interpreter::DoJumpIfToBooleanTrueConstant(
754 compiler::InterpreterAssembler* assembler) {
755 Node* accumulator = __ GetAccumulator();
756 Node* to_boolean_value =
757 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
758 Node* index = __ BytecodeOperandIdx8(0);
759 Node* constant = __ LoadConstantPoolEntry(index);
760 Node* relative_jump = __ SmiUntag(constant);
761 Node* true_value = __ BooleanConstant(true);
762 __ JumpIfWordEqual(to_boolean_value, true_value, relative_jump);
763 }
764
765
766 // JumpIfToBooleanFalse <imm8>
767 //
768 // Jump by number of bytes represented by an immediate operand if the object
769 // referenced by the accumulator is false when the object is cast to boolean.
770 void Interpreter::DoJumpIfToBooleanFalse(
771 compiler::InterpreterAssembler* assembler) {
772 Node* accumulator = __ GetAccumulator();
773 Node* relative_jump = __ BytecodeOperandImm8(0);
774 Node* to_boolean_value =
775 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
776 Node* false_value = __ BooleanConstant(false);
777 __ JumpIfWordEqual(to_boolean_value, false_value, relative_jump);
778 }
779
780
781 // JumpIfToBooleanFalseConstant <idx>
782 //
783 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool
784 // if the object referenced by the accumulator is false when the object is cast
785 // to boolean.
786 void Interpreter::DoJumpIfToBooleanFalseConstant(
787 compiler::InterpreterAssembler* assembler) {
788 Node* accumulator = __ GetAccumulator();
789 Node* to_boolean_value =
790 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
791 Node* index = __ BytecodeOperandIdx8(0);
792 Node* constant = __ LoadConstantPoolEntry(index);
793 Node* relative_jump = __ SmiUntag(constant);
794 Node* false_value = __ BooleanConstant(false);
795 __ JumpIfWordEqual(to_boolean_value, false_value, relative_jump);
796 }
797
798
733 // CreateArrayLiteral <idx> <flags> 799 // CreateArrayLiteral <idx> <flags>
734 // 800 //
735 // Creates an array literal for literal index <idx> with flags <flags> and 801 // Creates an array literal for literal index <idx> with flags <flags> and
736 // constant elements in the accumulator. 802 // constant elements in the accumulator.
737 void Interpreter::DoCreateArrayLiteral( 803 void Interpreter::DoCreateArrayLiteral(
738 compiler::InterpreterAssembler* assembler) { 804 compiler::InterpreterAssembler* assembler) {
739 Node* constant_elements = __ GetAccumulator(); 805 Node* constant_elements = __ GetAccumulator();
740 Node* literal_index_raw = __ BytecodeOperandIdx8(0); 806 Node* literal_index_raw = __ BytecodeOperandIdx8(0);
741 Node* literal_index = __ SmiTag(literal_index_raw); 807 Node* literal_index = __ SmiTag(literal_index_raw);
742 Node* flags_raw = __ BytecodeOperandImm8(1); 808 Node* flags_raw = __ BytecodeOperandImm8(1);
(...skipping 29 matching lines...) Expand all
772 // 838 //
773 // Return the value in the accumulator. 839 // Return the value in the accumulator.
774 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 840 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
775 __ Return(); 841 __ Return();
776 } 842 }
777 843
778 844
779 } // namespace interpreter 845 } // namespace interpreter
780 } // namespace internal 846 } // namespace internal
781 } // namespace v8 847 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698