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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/interpreter/bytecode-array-builder.h" | 8 #include "src/interpreter/bytecode-array-builder.h" |
9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
(...skipping 20 matching lines...) Loading... |
31 DeclarationScope scope(zone(), &ast_factory); | 31 DeclarationScope scope(zone(), &ast_factory); |
32 | 32 |
33 CHECK_EQ(builder.locals_count(), 131); | 33 CHECK_EQ(builder.locals_count(), 131); |
34 CHECK_EQ(builder.context_count(), 1); | 34 CHECK_EQ(builder.context_count(), 1); |
35 CHECK_EQ(builder.fixed_register_count(), 132); | 35 CHECK_EQ(builder.fixed_register_count(), 132); |
36 | 36 |
37 Register reg(0); | 37 Register reg(0); |
38 Register other(reg.index() + 1); | 38 Register other(reg.index() + 1); |
39 Register wide(128); | 39 Register wide(128); |
40 RegisterList reg_list; | 40 RegisterList reg_list; |
41 RegisterList pair(0, 2), triple(0, 3); | 41 RegisterList single(0, 1), pair(0, 2), triple(0, 3); |
42 | 42 |
43 // Emit argument creation operations. | 43 // Emit argument creation operations. |
44 builder.CreateArguments(CreateArgumentsType::kMappedArguments) | 44 builder.CreateArguments(CreateArgumentsType::kMappedArguments) |
45 .CreateArguments(CreateArgumentsType::kUnmappedArguments) | 45 .CreateArguments(CreateArgumentsType::kUnmappedArguments) |
46 .CreateArguments(CreateArgumentsType::kRestParameter); | 46 .CreateArguments(CreateArgumentsType::kRestParameter); |
47 | 47 |
48 // Emit constant loads. | 48 // Emit constant loads. |
49 builder.LoadLiteral(Smi::kZero) | 49 builder.LoadLiteral(Smi::kZero) |
50 .StoreAccumulatorInRegister(reg) | 50 .StoreAccumulatorInRegister(reg) |
51 .LoadLiteral(Smi::FromInt(8)) | 51 .LoadLiteral(Smi::FromInt(8)) |
(...skipping 84 matching lines...) Loading... |
136 builder.CreateEvalContext(1); | 136 builder.CreateEvalContext(1); |
137 builder.CreateWithContext(reg, &scope); | 137 builder.CreateWithContext(reg, &scope); |
138 | 138 |
139 // Emit literal creation operations. | 139 // Emit literal creation operations. |
140 builder.CreateRegExpLiteral(ast_factory.GetOneByteString("a"), 0, 0); | 140 builder.CreateRegExpLiteral(ast_factory.GetOneByteString("a"), 0, 0); |
141 builder.CreateArrayLiteral(0, 0, 0); | 141 builder.CreateArrayLiteral(0, 0, 0); |
142 builder.CreateObjectLiteral(0, 0, 0, reg); | 142 builder.CreateObjectLiteral(0, 0, 0, reg); |
143 | 143 |
144 // Call operations. | 144 // Call operations. |
145 builder.Call(reg, reg_list, 1, Call::GLOBAL_CALL) | 145 builder.Call(reg, reg_list, 1, Call::GLOBAL_CALL) |
| 146 .Call(reg, single, 1, Call::GLOBAL_CALL) |
| 147 .Call(reg, pair, 1, Call::GLOBAL_CALL) |
| 148 .Call(reg, triple, 1, Call::GLOBAL_CALL) |
146 .Call(reg, reg_list, 1, Call::NAMED_PROPERTY_CALL, | 149 .Call(reg, reg_list, 1, Call::NAMED_PROPERTY_CALL, |
147 TailCallMode::kDisallow) | 150 TailCallMode::kDisallow) |
| 151 .Call(reg, single, 1, Call::NAMED_PROPERTY_CALL) |
| 152 .Call(reg, pair, 1, Call::NAMED_PROPERTY_CALL) |
| 153 .Call(reg, triple, 1, Call::NAMED_PROPERTY_CALL) |
148 .Call(reg, reg_list, 1, Call::GLOBAL_CALL, TailCallMode::kAllow) | 154 .Call(reg, reg_list, 1, Call::GLOBAL_CALL, TailCallMode::kAllow) |
149 .CallRuntime(Runtime::kIsArray, reg) | 155 .CallRuntime(Runtime::kIsArray, reg) |
150 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair) | 156 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair) |
151 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list) | 157 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list) |
152 .CallWithSpread(reg, reg_list); | 158 .CallWithSpread(reg, reg_list); |
153 | 159 |
154 // Emit binary operator invocations. | 160 // Emit binary operator invocations. |
155 builder.BinaryOperation(Token::Value::ADD, reg, 1) | 161 builder.BinaryOperation(Token::Value::ADD, reg, 1) |
156 .BinaryOperation(Token::Value::SUB, reg, 2) | 162 .BinaryOperation(Token::Value::SUB, reg, 2) |
157 .BinaryOperation(Token::Value::MUL, reg, 3) | 163 .BinaryOperation(Token::Value::MUL, reg, 3) |
(...skipping 616 matching lines...) Loading... |
774 iterator.Advance(); | 780 iterator.Advance(); |
775 } | 781 } |
776 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 782 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
777 iterator.Advance(); | 783 iterator.Advance(); |
778 CHECK(iterator.done()); | 784 CHECK(iterator.done()); |
779 } | 785 } |
780 | 786 |
781 } // namespace interpreter | 787 } // namespace interpreter |
782 } // namespace internal | 788 } // namespace internal |
783 } // namespace v8 | 789 } // namespace v8 |
OLD | NEW |