| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Emit unary operator invocations. | 164 // Emit unary operator invocations. |
| 165 builder | 165 builder |
| 166 .LogicalNot() // ToBooleanLogicalNot | 166 .LogicalNot() // ToBooleanLogicalNot |
| 167 .LogicalNot() // non-ToBoolean LogicalNot | 167 .LogicalNot() // non-ToBoolean LogicalNot |
| 168 .TypeOf(); | 168 .TypeOf(); |
| 169 | 169 |
| 170 // Emit delete | 170 // Emit delete |
| 171 builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT); | 171 builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT); |
| 172 | 172 |
| 173 // Emit new. | 173 // Emit new. |
| 174 builder.New(reg, reg, 0); | 174 builder.New(reg, reg, 0, 1); |
| 175 builder.New(wide, wide, 0); | 175 builder.New(wide, wide, 0, 1); |
| 176 | 176 |
| 177 // Emit test operator invocations. | 177 // Emit test operator invocations. |
| 178 builder.CompareOperation(Token::Value::EQ, reg, 1) | 178 builder.CompareOperation(Token::Value::EQ, reg, 1) |
| 179 .CompareOperation(Token::Value::NE, reg, 2) | 179 .CompareOperation(Token::Value::NE, reg, 2) |
| 180 .CompareOperation(Token::Value::EQ_STRICT, reg, 3) | 180 .CompareOperation(Token::Value::EQ_STRICT, reg, 3) |
| 181 .CompareOperation(Token::Value::LT, reg, 4) | 181 .CompareOperation(Token::Value::LT, reg, 4) |
| 182 .CompareOperation(Token::Value::GT, reg, 5) | 182 .CompareOperation(Token::Value::GT, reg, 5) |
| 183 .CompareOperation(Token::Value::LTE, reg, 6) | 183 .CompareOperation(Token::Value::LTE, reg, 6) |
| 184 .CompareOperation(Token::Value::GTE, reg, 7) | 184 .CompareOperation(Token::Value::GTE, reg, 7) |
| 185 .CompareOperation(Token::Value::INSTANCEOF, reg, 8) | 185 .CompareOperation(Token::Value::INSTANCEOF, reg, 8) |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 builder.StoreAccumulatorInRegister(Register(i)); | 456 builder.StoreAccumulatorInRegister(Register(i)); |
| 457 } | 457 } |
| 458 for (int i = 0; i < temps; i++) { | 458 for (int i = 0; i < temps; i++) { |
| 459 builder.LoadLiteral(Smi::FromInt(0)); | 459 builder.LoadLiteral(Smi::FromInt(0)); |
| 460 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); | 460 builder.StoreAccumulatorInRegister(temporaries.NewRegister()); |
| 461 } | 461 } |
| 462 if (temps > 0) { | 462 if (temps > 0) { |
| 463 // Ensure temporaries are used so not optimized away by the | 463 // Ensure temporaries are used so not optimized away by the |
| 464 // register optimizer. | 464 // register optimizer. |
| 465 builder.New(Register(locals + contexts), Register(locals + contexts), | 465 builder.New(Register(locals + contexts), Register(locals + contexts), |
| 466 static_cast<size_t>(temps)); | 466 static_cast<size_t>(temps), 0); |
| 467 } | 467 } |
| 468 builder.Return(); | 468 builder.Return(); |
| 469 | 469 |
| 470 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(isolate()); | 470 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(isolate()); |
| 471 int total_registers = locals + contexts + temps; | 471 int total_registers = locals + contexts + temps; |
| 472 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); | 472 CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 } | 476 } |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 iterator.Advance(); | 855 iterator.Advance(); |
| 856 } | 856 } |
| 857 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 857 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
| 858 iterator.Advance(); | 858 iterator.Advance(); |
| 859 CHECK(iterator.done()); | 859 CHECK(iterator.done()); |
| 860 } | 860 } |
| 861 | 861 |
| 862 } // namespace interpreter | 862 } // namespace interpreter |
| 863 } // namespace internal | 863 } // namespace internal |
| 864 } // namespace v8 | 864 } // namespace v8 |
| OLD | NEW |