| 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 "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 .LoadUndefined() | 32 .LoadUndefined() |
| 33 .LoadNull() | 33 .LoadNull() |
| 34 .LoadTheHole() | 34 .LoadTheHole() |
| 35 .LoadTrue() | 35 .LoadTrue() |
| 36 .LoadFalse(); | 36 .LoadFalse(); |
| 37 | 37 |
| 38 // Emit accumulator transfers. | 38 // Emit accumulator transfers. |
| 39 Register reg(0); | 39 Register reg(0); |
| 40 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg); | 40 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg); |
| 41 | 41 |
| 42 // Emit load property operations. |
| 43 builder.LoadNamedProperty(reg, 0, LanguageMode::SLOPPY); |
| 44 builder.LoadKeyedProperty(reg, 0, LanguageMode::STRICT); |
| 45 |
| 42 // Emit binary operators invocations. | 46 // Emit binary operators invocations. |
| 43 builder.BinaryOperation(Token::Value::ADD, reg) | 47 builder.BinaryOperation(Token::Value::ADD, reg) |
| 44 .BinaryOperation(Token::Value::SUB, reg) | 48 .BinaryOperation(Token::Value::SUB, reg) |
| 45 .BinaryOperation(Token::Value::MUL, reg) | 49 .BinaryOperation(Token::Value::MUL, reg) |
| 46 .BinaryOperation(Token::Value::DIV, reg) | 50 .BinaryOperation(Token::Value::DIV, reg) |
| 47 .BinaryOperation(Token::Value::MOD, reg); | 51 .BinaryOperation(Token::Value::MOD, reg); |
| 48 | 52 |
| 49 // Emit control flow. Return must be the last instruction. | 53 // Emit control flow. Return must be the last instruction. |
| 50 builder.Return(); | 54 builder.Return(); |
| 51 | 55 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 .LoadLiteral(heap_num_2_copy); | 171 .LoadLiteral(heap_num_2_copy); |
| 168 | 172 |
| 169 Handle<BytecodeArray> array = builder.ToBytecodeArray(); | 173 Handle<BytecodeArray> array = builder.ToBytecodeArray(); |
| 170 // Should only have one entry for each identical constant. | 174 // Should only have one entry for each identical constant. |
| 171 CHECK_EQ(array->constant_pool()->length(), 3); | 175 CHECK_EQ(array->constant_pool()->length(), 3); |
| 172 } | 176 } |
| 173 | 177 |
| 174 } // namespace interpreter | 178 } // namespace interpreter |
| 175 } // namespace internal | 179 } // namespace internal |
| 176 } // namespace v8 | 180 } // namespace v8 |
| OLD | NEW |