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