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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 builder.StoreAccumulatorInRegister(Register(i)); | 449 builder.StoreAccumulatorInRegister(Register(i)); |
450 } | 450 } |
451 for (int i = 0; i < temps; i++) { | 451 for (int i = 0; i < temps; i++) { |
452 builder.LoadLiteral(Smi::FromInt(0)); | 452 builder.LoadLiteral(Smi::FromInt(0)); |
453 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); | 453 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); |
454 } | 454 } |
455 if (temps > 0) { | 455 if (temps > 0) { |
456 // Ensure temporaries are used so not optimized away by the | 456 // Ensure temporaries are used so not optimized away by the |
457 // register optimizer. | 457 // register optimizer. |
458 builder.New(Register(locals + contexts), Register(locals + contexts), | 458 builder.New(Register(locals + contexts), Register(locals + contexts), |
459 static_cast<size_t>(temps)); | 459 static_cast<size_t>(temps), 0); |
460 } | 460 } |
461 builder.Return(); | 461 builder.Return(); |
462 | 462 |
463 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); | 463 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
464 int total_registers = locals + contexts + temps; | 464 int total_registers = locals + contexts + temps; |
465 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); | 465 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
466 } | 466 } |
467 } | 467 } |
468 } | 468 } |
469 } | 469 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 iterator.Advance(); | 839 iterator.Advance(); |
840 } | 840 } |
841 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 841 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
842 iterator.Advance(); | 842 iterator.Advance(); |
843 CHECK(iterator.done()); | 843 CHECK(iterator.done()); |
844 } | 844 } |
845 | 845 |
846 } // namespace interpreter | 846 } // namespace interpreter |
847 } // namespace internal | 847 } // namespace internal |
848 } // namespace v8 | 848 } // namespace v8 |
OLD | NEW |