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 29 matching lines...) Expand all Loading... |
40 Register reg(0); | 40 Register reg(0); |
41 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg); | 41 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg); |
42 | 42 |
43 // Emit global load operations. | 43 // Emit global load operations. |
44 builder.LoadGlobal(1); | 44 builder.LoadGlobal(1); |
45 | 45 |
46 // Emit load / store property operations. | 46 // Emit load / store property operations. |
47 builder.LoadNamedProperty(reg, 0, LanguageMode::SLOPPY) | 47 builder.LoadNamedProperty(reg, 0, LanguageMode::SLOPPY) |
48 .LoadKeyedProperty(reg, 0, LanguageMode::SLOPPY) | 48 .LoadKeyedProperty(reg, 0, LanguageMode::SLOPPY) |
49 .StoreNamedProperty(reg, reg, 0, LanguageMode::SLOPPY) | 49 .StoreNamedProperty(reg, reg, 0, LanguageMode::SLOPPY) |
50 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY); | 50 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) |
| 51 .LoadNamedProperty(reg, 0, LanguageMode::STRICT) |
| 52 .LoadKeyedProperty(reg, 0, LanguageMode::STRICT) |
| 53 .StoreNamedProperty(reg, reg, 0, LanguageMode::STRICT) |
| 54 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); |
51 | 55 |
52 // Call operations. | 56 // Call operations. |
53 builder.Call(reg, reg, 0); | 57 builder.Call(reg, reg, 0); |
54 builder.CallRuntime(Runtime::kIsArray, reg, 1); | 58 builder.CallRuntime(Runtime::kIsArray, reg, 1); |
55 | 59 |
56 // Emit binary operator invocations. | 60 // Emit binary operator invocations. |
57 builder.BinaryOperation(Token::Value::ADD, reg) | 61 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) |
58 .BinaryOperation(Token::Value::SUB, reg) | 62 .BinaryOperation(Token::Value::SUB, reg, Strength::WEAK) |
59 .BinaryOperation(Token::Value::MUL, reg) | 63 .BinaryOperation(Token::Value::MUL, reg, Strength::WEAK) |
60 .BinaryOperation(Token::Value::DIV, reg) | 64 .BinaryOperation(Token::Value::DIV, reg, Strength::WEAK) |
61 .BinaryOperation(Token::Value::MOD, reg); | 65 .BinaryOperation(Token::Value::MOD, reg, Strength::WEAK); |
62 | 66 |
63 // Emit unary operator invocations. | 67 // Emit unary operator invocations. |
64 builder.LogicalNot().TypeOf(); | 68 builder.LogicalNot().TypeOf(); |
65 | 69 |
66 // Emit test operator invocations. | 70 // Emit test operator invocations. |
67 builder.CompareOperation(Token::Value::EQ, reg, LanguageMode::SLOPPY) | 71 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) |
68 .CompareOperation(Token::Value::NE, reg, LanguageMode::SLOPPY) | 72 .CompareOperation(Token::Value::NE, reg, Strength::WEAK) |
69 .CompareOperation(Token::Value::EQ_STRICT, reg, LanguageMode::SLOPPY) | 73 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) |
70 .CompareOperation(Token::Value::NE_STRICT, reg, LanguageMode::SLOPPY) | 74 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) |
71 .CompareOperation(Token::Value::LT, reg, LanguageMode::SLOPPY) | 75 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) |
72 .CompareOperation(Token::Value::GT, reg, LanguageMode::SLOPPY) | 76 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) |
73 .CompareOperation(Token::Value::LTE, reg, LanguageMode::SLOPPY) | 77 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) |
74 .CompareOperation(Token::Value::GTE, reg, LanguageMode::SLOPPY) | 78 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) |
75 .CompareOperation(Token::Value::INSTANCEOF, reg, LanguageMode::SLOPPY) | 79 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) |
76 .CompareOperation(Token::Value::IN, reg, LanguageMode::SLOPPY); | 80 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); |
77 | 81 |
78 // Emit cast operator invocations. | 82 // Emit cast operator invocations. |
79 builder.LoadNull().CastAccumulatorToBoolean(); | 83 builder.LoadNull().CastAccumulatorToBoolean(); |
80 | 84 |
81 // Emit control flow. Return must be the last instruction. | 85 // Emit control flow. Return must be the last instruction. |
82 BytecodeLabel start; | 86 BytecodeLabel start; |
83 builder.Bind(&start); | 87 builder.Bind(&start); |
84 // Short jumps with Imm8 operands | 88 // Short jumps with Imm8 operands |
85 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); | 89 builder.Jump(&start).JumpIfTrue(&start).JumpIfFalse(&start); |
86 // Insert dummy ops to force longer jumps | 90 // Insert dummy ops to force longer jumps |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 442 |
439 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 443 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
440 iterator.Advance(); | 444 iterator.Advance(); |
441 CHECK(iterator.done()); | 445 CHECK(iterator.done()); |
442 } | 446 } |
443 | 447 |
444 | 448 |
445 } // namespace interpreter | 449 } // namespace interpreter |
446 } // namespace internal | 450 } // namespace internal |
447 } // namespace v8 | 451 } // namespace v8 |
OLD | NEW |