| 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 "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 .LoadNamedProperty(reg, 0, LanguageMode::STRICT) | 57 .LoadNamedProperty(reg, 0, LanguageMode::STRICT) |
| 58 .LoadKeyedProperty(reg, 0, LanguageMode::STRICT) | 58 .LoadKeyedProperty(reg, 0, LanguageMode::STRICT) |
| 59 .StoreNamedProperty(reg, reg, 0, LanguageMode::STRICT) | 59 .StoreNamedProperty(reg, reg, 0, LanguageMode::STRICT) |
| 60 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT) | 60 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT) |
| 61 .GenericStoreKeyedProperty(reg, reg); | 61 .GenericStoreKeyedProperty(reg, reg); |
| 62 | 62 |
| 63 // Emit closure operations. | 63 // Emit closure operations. |
| 64 builder.CreateClosure(NOT_TENURED); | 64 builder.CreateClosure(NOT_TENURED); |
| 65 | 65 |
| 66 // Emit literal creation operations | 66 // Emit literal creation operations |
| 67 builder.CreateArrayLiteral(0, 0); | 67 builder.CreateArrayLiteral(0, 0) |
| 68 .CreateObjectLiteral(0, 0); |
| 68 | 69 |
| 69 // Call operations. | 70 // Call operations. |
| 70 builder.Call(reg, reg, 0); | 71 builder.Call(reg, reg, 0); |
| 71 builder.CallRuntime(Runtime::kIsArray, reg, 1); | 72 builder.CallRuntime(Runtime::kIsArray, reg, 1); |
| 72 | 73 |
| 73 // Emit binary operator invocations. | 74 // Emit binary operator invocations. |
| 74 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) | 75 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) |
| 75 .BinaryOperation(Token::Value::SUB, reg, Strength::WEAK) | 76 .BinaryOperation(Token::Value::SUB, reg, Strength::WEAK) |
| 76 .BinaryOperation(Token::Value::MUL, reg, Strength::WEAK) | 77 .BinaryOperation(Token::Value::MUL, reg, Strength::WEAK) |
| 77 .BinaryOperation(Token::Value::DIV, reg, Strength::WEAK) | 78 .BinaryOperation(Token::Value::DIV, reg, Strength::WEAK) |
| 78 .BinaryOperation(Token::Value::MOD, reg, Strength::WEAK); | 79 .BinaryOperation(Token::Value::MOD, reg, Strength::WEAK); |
| 79 | 80 |
| 80 // Emit unary operator invocations. | 81 // Emit unary operator invocations. |
| 81 builder.LogicalNot().TypeOf(); | 82 builder.LogicalNot().TypeOf(); |
| 82 | 83 |
| 83 // Emit test operator invocations. | 84 // Emit test operator invocations. |
| 84 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) | 85 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) |
| 85 .CompareOperation(Token::Value::NE, reg, Strength::WEAK) | 86 .CompareOperation(Token::Value::NE, reg, Strength::WEAK) |
| 86 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) | 87 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) |
| 87 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) | 88 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) |
| 88 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) | 89 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) |
| 89 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) | 90 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) |
| 90 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) | 91 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) |
| 91 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) | 92 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) |
| 92 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) | 93 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) |
| 93 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); | 94 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); |
| 94 | 95 |
| 95 // Emit cast operator invocations. | 96 // Emit cast operator invocations. |
| 96 builder.LoadNull().CastAccumulatorToBoolean(); | 97 builder.LoadNull() |
| 98 .CastAccumulatorToBoolean() |
| 99 .CastAccumulatorToName(); |
| 97 | 100 |
| 98 // Emit control flow. Return must be the last instruction. | 101 // Emit control flow. Return must be the last instruction. |
| 99 BytecodeLabel start; | 102 BytecodeLabel start; |
| 100 builder.Bind(&start); | 103 builder.Bind(&start); |
| 101 // Short jumps with Imm8 operands | 104 // Short jumps with Imm8 operands |
| 102 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); | 105 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); |
| 103 // Insert dummy ops to force longer jumps | 106 // Insert dummy ops to force longer jumps |
| 104 for (int i = 0; i < 128; i++) { | 107 for (int i = 0; i < 128; i++) { |
| 105 builder.LoadTrue(); | 108 builder.LoadTrue(); |
| 106 } | 109 } |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 458 |
| 456 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 459 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
| 457 iterator.Advance(); | 460 iterator.Advance(); |
| 458 CHECK(iterator.done()); | 461 CHECK(iterator.done()); |
| 459 } | 462 } |
| 460 | 463 |
| 461 | 464 |
| 462 } // namespace interpreter | 465 } // namespace interpreter |
| 463 } // namespace internal | 466 } // namespace internal |
| 464 } // namespace v8 | 467 } // namespace v8 |
| OLD | NEW |