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-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 builder.CastAccumulatorToNumber() | 159 builder.CastAccumulatorToNumber() |
160 .CastAccumulatorToJSObject() | 160 .CastAccumulatorToJSObject() |
161 .CastAccumulatorToName(); | 161 .CastAccumulatorToName(); |
162 | 162 |
163 // Emit control flow. Return must be the last instruction. | 163 // Emit control flow. Return must be the last instruction. |
164 BytecodeLabel start; | 164 BytecodeLabel start; |
165 builder.Bind(&start); | 165 builder.Bind(&start); |
166 // Short jumps with Imm8 operands | 166 // Short jumps with Imm8 operands |
167 builder.Jump(&start) | 167 builder.Jump(&start) |
168 .JumpIfNull(&start) | 168 .JumpIfNull(&start) |
169 .JumpIfUndefined(&start); | 169 .JumpIfUndefined(&start) |
| 170 .JumpIfHole(&start) |
| 171 .JumpIfNotHole(&start); |
170 // Perform an operation that returns boolean value to | 172 // Perform an operation that returns boolean value to |
171 // generate JumpIfTrue/False | 173 // generate JumpIfTrue/False |
172 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) | 174 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) |
173 .JumpIfTrue(&start) | 175 .JumpIfTrue(&start) |
174 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK) | 176 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK) |
175 .JumpIfFalse(&start); | 177 .JumpIfFalse(&start); |
176 // Perform an operation that returns a non-boolean operation to | 178 // Perform an operation that returns a non-boolean operation to |
177 // generate JumpIfToBooleanTrue/False. | 179 // generate JumpIfToBooleanTrue/False. |
178 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) | 180 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) |
179 .JumpIfTrue(&start) | 181 .JumpIfTrue(&start) |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 } | 686 } |
685 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 687 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
686 iterator.Advance(); | 688 iterator.Advance(); |
687 CHECK(iterator.done()); | 689 CHECK(iterator.done()); |
688 } | 690 } |
689 | 691 |
690 | 692 |
691 } // namespace interpreter | 693 } // namespace interpreter |
692 } // namespace internal | 694 } // namespace internal |
693 } // namespace v8 | 695 } // namespace v8 |
OLD | NEW |