OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-label.h" | 9 #include "src/interpreter/bytecode-label.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 .CompareOperation(Token::Value::GT, reg, 5) | 193 .CompareOperation(Token::Value::GT, reg, 5) |
194 .CompareOperation(Token::Value::LTE, reg, 6) | 194 .CompareOperation(Token::Value::LTE, reg, 6) |
195 .CompareOperation(Token::Value::GTE, reg, 7) | 195 .CompareOperation(Token::Value::GTE, reg, 7) |
196 .CompareOperation(Token::Value::INSTANCEOF, reg, 8) | 196 .CompareOperation(Token::Value::INSTANCEOF, reg, 8) |
197 .CompareOperation(Token::Value::IN, reg, 9); | 197 .CompareOperation(Token::Value::IN, reg, 9); |
198 | 198 |
199 // Emit peephole optimizations of equality with Null or Undefined. | 199 // Emit peephole optimizations of equality with Null or Undefined. |
200 builder.LoadUndefined() | 200 builder.LoadUndefined() |
201 .CompareOperation(Token::Value::EQ, reg, 1) | 201 .CompareOperation(Token::Value::EQ, reg, 1) |
202 .LoadNull() | 202 .LoadNull() |
203 .CompareOperation(Token::Value::EQ, reg, 1); | 203 .CompareOperation(Token::Value::EQ, reg, 1) |
| 204 .LoadUndefined() |
| 205 .CompareOperation(Token::Value::EQ_STRICT, reg, 1) |
| 206 .LoadNull() |
| 207 .CompareOperation(Token::Value::EQ_STRICT, reg, 1); |
204 | 208 |
205 // Emit conversion operator invocations. | 209 // Emit conversion operator invocations. |
206 builder.ConvertAccumulatorToNumber(reg) | 210 builder.ConvertAccumulatorToNumber(reg) |
207 .ConvertAccumulatorToObject(reg) | 211 .ConvertAccumulatorToObject(reg) |
208 .ConvertAccumulatorToName(reg); | 212 .ConvertAccumulatorToName(reg); |
209 | 213 |
210 // Short jumps with Imm8 operands | 214 // Short jumps with Imm8 operands |
211 { | 215 { |
212 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4, | 216 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4, |
213 after_jump5; | 217 after_jump5; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; | 408 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; |
405 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; | 409 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; |
406 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; | 410 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; |
407 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; | 411 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; |
408 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; | 412 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; |
409 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; | 413 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; |
410 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; | 414 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; |
411 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; | 415 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; |
412 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; | 416 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; |
413 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1; | 417 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1; |
| 418 scorecard[Bytecodes::ToByte(Bytecode::kTestUndefined)] = 1; |
| 419 scorecard[Bytecodes::ToByte(Bytecode::kTestNull)] = 1; |
414 } | 420 } |
415 | 421 |
416 // Check return occurs at the end and only once in the BytecodeArray. | 422 // Check return occurs at the end and only once in the BytecodeArray. |
417 CHECK_EQ(final_bytecode, Bytecode::kReturn); | 423 CHECK_EQ(final_bytecode, Bytecode::kReturn); |
418 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); | 424 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); |
419 | 425 |
420 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 426 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
421 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ | 427 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ |
422 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ | 428 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ |
423 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ | 429 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 iterator.Advance(); | 749 iterator.Advance(); |
744 } | 750 } |
745 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 751 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
746 iterator.Advance(); | 752 iterator.Advance(); |
747 CHECK(iterator.done()); | 753 CHECK(iterator.done()); |
748 } | 754 } |
749 | 755 |
750 } // namespace interpreter | 756 } // namespace interpreter |
751 } // namespace internal | 757 } // namespace internal |
752 } // namespace v8 | 758 } // namespace v8 |
OLD | NEW |