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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 builder.LoadNamedProperty(reg, 2056, 0, LanguageMode::SLOPPY) | 87 builder.LoadNamedProperty(reg, 2056, 0, LanguageMode::SLOPPY) |
88 .LoadKeyedProperty(reg, 2056, LanguageMode::SLOPPY) | 88 .LoadKeyedProperty(reg, 2056, LanguageMode::SLOPPY) |
89 .StoreNamedProperty(reg, 0, 2056, LanguageMode::SLOPPY) | 89 .StoreNamedProperty(reg, 0, 2056, LanguageMode::SLOPPY) |
90 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) | 90 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) |
91 .LoadNamedProperty(reg, 2056, 0, LanguageMode::STRICT) | 91 .LoadNamedProperty(reg, 2056, 0, LanguageMode::STRICT) |
92 .LoadKeyedProperty(reg, 2056, LanguageMode::STRICT) | 92 .LoadKeyedProperty(reg, 2056, LanguageMode::STRICT) |
93 .StoreNamedProperty(reg, 0, 2056, LanguageMode::STRICT) | 93 .StoreNamedProperty(reg, 0, 2056, LanguageMode::STRICT) |
94 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); | 94 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); |
95 | 95 |
96 // Emit closure operations. | 96 // Emit closure operations. |
97 builder.CreateClosure(NOT_TENURED); | 97 Factory* factory = isolate()->factory(); |
| 98 Handle<SharedFunctionInfo> shared_info = factory->NewSharedFunctionInfo( |
| 99 factory->NewStringFromStaticChars("function_a"), MaybeHandle<Code>()); |
| 100 builder.CreateClosure(shared_info, NOT_TENURED); |
98 | 101 |
99 // Emit argument creation operations. | 102 // Emit argument creation operations. |
100 builder.CreateArguments(CreateArgumentsType::kMappedArguments) | 103 builder.CreateArguments(CreateArgumentsType::kMappedArguments) |
101 .CreateArguments(CreateArgumentsType::kUnmappedArguments); | 104 .CreateArguments(CreateArgumentsType::kUnmappedArguments); |
102 | 105 |
103 // Emit literal creation operations | 106 // Emit literal creation operations |
104 builder.CreateRegExpLiteral(0, reg) | 107 builder.CreateRegExpLiteral(0, reg) |
105 .CreateArrayLiteral(0, 0) | 108 .CreateArrayLiteral(0, 0) |
106 .CreateObjectLiteral(0, 0); | 109 .CreateObjectLiteral(0, 0); |
107 | 110 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 211 |
209 builder.ForInPrepare(reg).ForInDone(reg).ForInNext(reg, reg); | 212 builder.ForInPrepare(reg).ForInDone(reg).ForInNext(reg, reg); |
210 | 213 |
211 // Wide constant pool loads | 214 // Wide constant pool loads |
212 for (int i = 0; i < 256; i++) { | 215 for (int i = 0; i < 256; i++) { |
213 // Emit junk in constant pool to force wide constant pool index. | 216 // Emit junk in constant pool to force wide constant pool index. |
214 builder.GetConstantPoolEntry(handle(Smi::FromInt(i), isolate())); | 217 builder.GetConstantPoolEntry(handle(Smi::FromInt(i), isolate())); |
215 } | 218 } |
216 builder.LoadLiteral(Smi::FromInt(20000000)); | 219 builder.LoadLiteral(Smi::FromInt(20000000)); |
217 | 220 |
| 221 // CreateClosureWide |
| 222 Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo( |
| 223 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>()); |
| 224 builder.CreateClosure(shared_info2, NOT_TENURED); |
| 225 |
218 builder.Return(); | 226 builder.Return(); |
219 | 227 |
220 // Generate BytecodeArray. | 228 // Generate BytecodeArray. |
221 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); | 229 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
222 CHECK_EQ(the_array->frame_size(), | 230 CHECK_EQ(the_array->frame_size(), |
223 builder.fixed_register_count() * kPointerSize); | 231 builder.fixed_register_count() * kPointerSize); |
224 | 232 |
225 // Build scorecard of bytecodes encountered in the BytecodeArray. | 233 // Build scorecard of bytecodes encountered in the BytecodeArray. |
226 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); | 234 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); |
227 Bytecode final_bytecode = Bytecode::kLdaZero; | 235 Bytecode final_bytecode = Bytecode::kLdaZero; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 714 |
707 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 715 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
708 iterator.Advance(); | 716 iterator.Advance(); |
709 CHECK(iterator.done()); | 717 CHECK(iterator.done()); |
710 } | 718 } |
711 | 719 |
712 | 720 |
713 } // namespace interpreter | 721 } // namespace interpreter |
714 } // namespace internal | 722 } // namespace internal |
715 } // namespace v8 | 723 } // namespace v8 |
OLD | NEW |