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 "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) | 152 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) |
153 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) | 153 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) |
154 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) | 154 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) |
155 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) | 155 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) |
156 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) | 156 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) |
157 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) | 157 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) |
158 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); | 158 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); |
159 | 159 |
160 // Emit cast operator invocations. | 160 // Emit cast operator invocations. |
161 builder.CastAccumulatorToNumber() | 161 builder.CastAccumulatorToNumber() |
162 .CastAccumulatorToJSObject() | |
163 .CastAccumulatorToName(); | 162 .CastAccumulatorToName(); |
164 | 163 |
165 // Emit control flow. Return must be the last instruction. | 164 // Emit control flow. Return must be the last instruction. |
166 BytecodeLabel start; | 165 BytecodeLabel start; |
167 builder.Bind(&start); | 166 builder.Bind(&start); |
168 // Short jumps with Imm8 operands | 167 // Short jumps with Imm8 operands |
169 builder.Jump(&start) | 168 builder.Jump(&start) |
170 .JumpIfNull(&start) | 169 .JumpIfNull(&start) |
171 .JumpIfUndefined(&start); | 170 .JumpIfUndefined(&start); |
172 // Perform an operation that returns boolean value to | 171 // Perform an operation that returns boolean value to |
(...skipping 29 matching lines...) Expand all Loading... |
202 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) | 201 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) |
203 .JumpIfFalse(&start); | 202 .JumpIfFalse(&start); |
204 | 203 |
205 // Emit throw in it's own basic block so that the rest of the code isn't | 204 // Emit throw in it's own basic block so that the rest of the code isn't |
206 // omitted due to being dead. | 205 // omitted due to being dead. |
207 BytecodeLabel after_throw; | 206 BytecodeLabel after_throw; |
208 builder.Jump(&after_throw) | 207 builder.Jump(&after_throw) |
209 .Throw() | 208 .Throw() |
210 .Bind(&after_throw); | 209 .Bind(&after_throw); |
211 | 210 |
212 builder.ForInPrepare(reg).ForInDone(reg).ForInNext(reg, reg); | 211 builder.ForInPrepare(reg, reg, reg, reg) |
| 212 .ForInDone(reg, reg) |
| 213 .ForInNext(reg, reg, reg, reg) |
| 214 .ForInStep(reg); |
213 | 215 |
214 // Wide constant pool loads | 216 // Wide constant pool loads |
215 for (int i = 0; i < 256; i++) { | 217 for (int i = 0; i < 256; i++) { |
216 // Emit junk in constant pool to force wide constant pool index. | 218 // Emit junk in constant pool to force wide constant pool index. |
217 builder.GetConstantPoolEntry(handle(Smi::FromInt(i), isolate())); | 219 builder.GetConstantPoolEntry(handle(Smi::FromInt(i), isolate())); |
218 } | 220 } |
219 builder.LoadLiteral(Smi::FromInt(20000000)); | 221 builder.LoadLiteral(Smi::FromInt(20000000)); |
220 | 222 |
221 // CreateClosureWide | 223 // CreateClosureWide |
222 Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo( | 224 Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo( |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 iterator.Advance(); | 661 iterator.Advance(); |
660 } | 662 } |
661 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 663 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
662 iterator.Advance(); | 664 iterator.Advance(); |
663 CHECK(iterator.done()); | 665 CHECK(iterator.done()); |
664 } | 666 } |
665 | 667 |
666 } // namespace interpreter | 668 } // namespace interpreter |
667 } // namespace internal | 669 } // namespace internal |
668 } // namespace v8 | 670 } // namespace v8 |
OLD | NEW |