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-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op, | 130 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op, |
131 Register reg) { | 131 Register reg) { |
132 Output(BytecodeForBinaryOperation(op), reg.ToOperand()); | 132 Output(BytecodeForBinaryOperation(op), reg.ToOperand()); |
133 return *this; | 133 return *this; |
134 } | 134 } |
135 | 135 |
136 | 136 |
| 137 BytecodeArrayBuilder& BytecodeArrayBuilder::LogicalNot() { |
| 138 Output(Bytecode::kLogicalNot); |
| 139 return *this; |
| 140 } |
| 141 |
| 142 |
| 143 BytecodeArrayBuilder& BytecodeArrayBuilder::TypeOf() { |
| 144 Output(Bytecode::kTypeOf); |
| 145 return *this; |
| 146 } |
| 147 |
| 148 |
137 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation( | 149 BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation( |
138 Token::Value op, Register reg, LanguageMode language_mode) { | 150 Token::Value op, Register reg, LanguageMode language_mode) { |
139 if (!is_sloppy(language_mode)) { | 151 if (!is_sloppy(language_mode)) { |
140 UNIMPLEMENTED(); | 152 UNIMPLEMENTED(); |
141 } | 153 } |
142 | 154 |
143 Output(BytecodeForCompareOperation(op), reg.ToOperand()); | 155 Output(BytecodeForCompareOperation(op), reg.ToOperand()); |
144 return *this; | 156 return *this; |
145 } | 157 } |
146 | 158 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 304 |
293 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() { | 305 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() { |
294 if (LastBytecodeInSameBlock()) { | 306 if (LastBytecodeInSameBlock()) { |
295 // If the previous bytecode puts a boolean in the accumulator | 307 // If the previous bytecode puts a boolean in the accumulator |
296 // there is no need to emit an instruction. | 308 // there is no need to emit an instruction. |
297 switch (Bytecodes::FromByte(bytecodes()->at(last_bytecode_start_))) { | 309 switch (Bytecodes::FromByte(bytecodes()->at(last_bytecode_start_))) { |
298 case Bytecode::kToBoolean: | 310 case Bytecode::kToBoolean: |
299 UNREACHABLE(); | 311 UNREACHABLE(); |
300 case Bytecode::kLdaTrue: | 312 case Bytecode::kLdaTrue: |
301 case Bytecode::kLdaFalse: | 313 case Bytecode::kLdaFalse: |
| 314 case Bytecode::kLogicalNot: |
302 case Bytecode::kTestEqual: | 315 case Bytecode::kTestEqual: |
303 case Bytecode::kTestNotEqual: | 316 case Bytecode::kTestNotEqual: |
304 case Bytecode::kTestEqualStrict: | 317 case Bytecode::kTestEqualStrict: |
305 case Bytecode::kTestNotEqualStrict: | 318 case Bytecode::kTestNotEqualStrict: |
306 case Bytecode::kTestLessThan: | 319 case Bytecode::kTestLessThan: |
307 case Bytecode::kTestLessThanOrEqual: | 320 case Bytecode::kTestLessThanOrEqual: |
308 case Bytecode::kTestGreaterThan: | 321 case Bytecode::kTestGreaterThan: |
309 case Bytecode::kTestGreaterThanOrEqual: | 322 case Bytecode::kTestGreaterThanOrEqual: |
310 case Bytecode::kTestInstanceOf: | 323 case Bytecode::kTestInstanceOf: |
311 case Bytecode::kTestIn: | 324 case Bytecode::kTestIn: |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 656 |
644 Register TemporaryRegisterScope::NewRegister() { | 657 Register TemporaryRegisterScope::NewRegister() { |
645 count_++; | 658 count_++; |
646 last_register_index_ = builder_->BorrowTemporaryRegister(); | 659 last_register_index_ = builder_->BorrowTemporaryRegister(); |
647 return Register(last_register_index_); | 660 return Register(last_register_index_); |
648 } | 661 } |
649 | 662 |
650 } // namespace interpreter | 663 } // namespace interpreter |
651 } // namespace internal | 664 } // namespace internal |
652 } // namespace v8 | 665 } // namespace v8 |
OLD | NEW |