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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Emit unary operator invocations. | 158 // Emit unary operator invocations. |
159 builder | 159 builder |
160 .LogicalNot() // ToBooleanLogicalNot | 160 .LogicalNot() // ToBooleanLogicalNot |
161 .LogicalNot() // non-ToBoolean LogicalNot | 161 .LogicalNot() // non-ToBoolean LogicalNot |
162 .TypeOf(); | 162 .TypeOf(); |
163 | 163 |
164 // Emit delete | 164 // Emit delete |
165 builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT); | 165 builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT); |
166 | 166 |
167 // Emit new. | 167 // Emit new. |
168 builder.New(reg, reg, 0); | 168 builder.New(reg, reg, 0, 1); |
169 builder.New(wide, wide, 0); | 169 builder.New(wide, wide, 0, 1); |
170 | 170 |
171 // Emit test operator invocations. | 171 // Emit test operator invocations. |
172 builder.CompareOperation(Token::Value::EQ, reg) | 172 builder.CompareOperation(Token::Value::EQ, reg) |
173 .CompareOperation(Token::Value::NE, reg) | 173 .CompareOperation(Token::Value::NE, reg) |
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) |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 builder.StoreAccumulatorInRegister(Register(i)); | 452 builder.StoreAccumulatorInRegister(Register(i)); |
453 } | 453 } |
454 for (int i = 0; i < temps; i++) { | 454 for (int i = 0; i < temps; i++) { |
455 builder.LoadLiteral(Smi::FromInt(0)); | 455 builder.LoadLiteral(Smi::FromInt(0)); |
456 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); | 456 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); |
457 } | 457 } |
458 if (temps > 0) { | 458 if (temps > 0) { |
459 // Ensure temporaries are used so not optimized away by the | 459 // Ensure temporaries are used so not optimized away by the |
460 // register optimizer. | 460 // register optimizer. |
461 builder.New(Register(locals + contexts), Register(locals + contexts), | 461 builder.New(Register(locals + contexts), Register(locals + contexts), |
462 static_cast<size_t>(temps)); | 462 static_cast<size_t>(temps), 0); |
463 } | 463 } |
464 builder.Return(); | 464 builder.Return(); |
465 | 465 |
466 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); | 466 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
467 int total_registers = locals + contexts + temps; | 467 int total_registers = locals + contexts + temps; |
468 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); | 468 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
469 } | 469 } |
470 } | 470 } |
471 } | 471 } |
472 } | 472 } |
(...skipping 369 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 |