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) |
(...skipping 18 matching lines...) Expand all Loading... |
96 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) | 97 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) |
97 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) | 98 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) |
98 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) | 99 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) |
99 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) | 100 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) |
100 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) | 101 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) |
101 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) | 102 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) |
102 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) | 103 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) |
103 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); | 104 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); |
104 | 105 |
105 // Emit cast operator invocations. | 106 // Emit cast operator invocations. |
106 builder.LoadNull().CastAccumulatorToBoolean(); | 107 builder.LoadNull() |
| 108 .CastAccumulatorToBoolean() |
| 109 .CastAccumulatorToName(); |
107 | 110 |
108 // Emit control flow. Return must be the last instruction. | 111 // Emit control flow. Return must be the last instruction. |
109 BytecodeLabel start; | 112 BytecodeLabel start; |
110 builder.Bind(&start); | 113 builder.Bind(&start); |
111 // Short jumps with Imm8 operands | 114 // Short jumps with Imm8 operands |
112 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); | 115 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); |
113 // Insert dummy ops to force longer jumps | 116 // Insert dummy ops to force longer jumps |
114 for (int i = 0; i < 128; i++) { | 117 for (int i = 0; i < 128; i++) { |
115 builder.LoadTrue(); | 118 builder.LoadTrue(); |
116 } | 119 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 468 |
466 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 469 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
467 iterator.Advance(); | 470 iterator.Advance(); |
468 CHECK(iterator.done()); | 471 CHECK(iterator.done()); |
469 } | 472 } |
470 | 473 |
471 | 474 |
472 } // namespace interpreter | 475 } // namespace interpreter |
473 } // namespace internal | 476 } // namespace internal |
474 } // namespace v8 | 477 } // namespace v8 |
OLD | NEW |