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