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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 .CompareOperation(Token::Value::EQ_STRICT, reg) | 174 .CompareOperation(Token::Value::EQ_STRICT, reg) |
175 .CompareOperation(Token::Value::LT, reg) | 175 .CompareOperation(Token::Value::LT, reg) |
176 .CompareOperation(Token::Value::GT, reg) | 176 .CompareOperation(Token::Value::GT, reg) |
177 .CompareOperation(Token::Value::LTE, reg) | 177 .CompareOperation(Token::Value::LTE, reg) |
178 .CompareOperation(Token::Value::GTE, reg) | 178 .CompareOperation(Token::Value::GTE, reg) |
179 .CompareOperation(Token::Value::INSTANCEOF, reg) | 179 .CompareOperation(Token::Value::INSTANCEOF, reg) |
180 .CompareOperation(Token::Value::IN, reg); | 180 .CompareOperation(Token::Value::IN, reg); |
181 | 181 |
182 // Emit cast operator invocations. | 182 // Emit cast operator invocations. |
183 builder.CastAccumulatorToNumber(reg) | 183 builder.CastAccumulatorToNumber(reg) |
184 .CastAccumulatorToJSObject() | 184 .CastAccumulatorToJSObject(reg) |
185 .CastAccumulatorToName(reg); | 185 .CastAccumulatorToName(reg); |
186 | 186 |
187 // Emit control flow. Return must be the last instruction. | 187 // Emit control flow. Return must be the last instruction. |
188 BytecodeLabel start; | 188 BytecodeLabel start; |
189 builder.Bind(&start); | 189 builder.Bind(&start); |
190 { | 190 { |
191 // Short jumps with Imm8 operands | 191 // Short jumps with Imm8 operands |
192 BytecodeLabel after_jump; | 192 BytecodeLabel after_jump; |
193 builder.Jump(&start) | 193 builder.Jump(&start) |
194 .Bind(&after_jump) | 194 .Bind(&after_jump) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // Emit an OSR poll bytecode. | 260 // Emit an OSR poll bytecode. |
261 builder.OsrPoll(1); | 261 builder.OsrPoll(1); |
262 | 262 |
263 // Emit throw and re-throw in it's own basic block so that the rest of the | 263 // Emit throw and re-throw in it's own basic block so that the rest of the |
264 // code isn't omitted due to being dead. | 264 // code isn't omitted due to being dead. |
265 BytecodeLabel after_throw; | 265 BytecodeLabel after_throw; |
266 builder.Throw().Bind(&after_throw); | 266 builder.Throw().Bind(&after_throw); |
267 BytecodeLabel after_rethrow; | 267 BytecodeLabel after_rethrow; |
268 builder.ReThrow().Bind(&after_rethrow); | 268 builder.ReThrow().Bind(&after_rethrow); |
269 | 269 |
270 builder.ForInPrepare(reg) | 270 builder.ForInPrepare(reg, reg) |
271 .ForInDone(reg, reg) | 271 .ForInDone(reg, reg) |
272 .ForInNext(reg, reg, reg, 1) | 272 .ForInNext(reg, reg, reg, 1) |
273 .ForInStep(reg); | 273 .ForInStep(reg); |
274 builder.ForInPrepare(wide) | 274 builder.ForInPrepare(reg, wide) |
275 .ForInDone(reg, other) | 275 .ForInDone(reg, other) |
276 .ForInNext(wide, wide, wide, 1024) | 276 .ForInNext(wide, wide, wide, 1024) |
277 .ForInStep(reg); | 277 .ForInStep(reg); |
278 | 278 |
279 // Wide constant pool loads | 279 // Wide constant pool loads |
280 for (int i = 0; i < 256; i++) { | 280 for (int i = 0; i < 256; i++) { |
281 // Emit junk in constant pool to force wide constant pool index. | 281 // Emit junk in constant pool to force wide constant pool index. |
282 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); | 282 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); |
283 } | 283 } |
284 builder.LoadLiteral(Smi::FromInt(20000000)); | 284 builder.LoadLiteral(Smi::FromInt(20000000)); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 iterator.Advance(); | 842 iterator.Advance(); |
843 } | 843 } |
844 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 844 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
845 iterator.Advance(); | 845 iterator.Advance(); |
846 CHECK(iterator.done()); | 846 CHECK(iterator.done()); |
847 } | 847 } |
848 | 848 |
849 } // namespace interpreter | 849 } // namespace interpreter |
850 } // namespace internal | 850 } // namespace internal |
851 } // namespace v8 | 851 } // namespace v8 |
OLD | NEW |