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 "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 .LoadNull() | 50 .LoadNull() |
51 .StoreAccumulatorInRegister(reg); | 51 .StoreAccumulatorInRegister(reg); |
52 | 52 |
53 // Emit register-register transfer. | 53 // Emit register-register transfer. |
54 builder.MoveRegister(reg, other); | 54 builder.MoveRegister(reg, other); |
55 builder.MoveRegister(reg, wide); | 55 builder.MoveRegister(reg, wide); |
56 | 56 |
57 // Emit global load / store operations. | 57 // Emit global load / store operations. |
58 Factory* factory = isolate()->factory(); | 58 Factory* factory = isolate()->factory(); |
59 Handle<String> name = factory->NewStringFromStaticChars("var_name"); | 59 Handle<String> name = factory->NewStringFromStaticChars("var_name"); |
60 builder.LoadGlobal(name, 1, LanguageMode::SLOPPY, | 60 builder.LoadGlobal(name, 1, TypeofMode::NOT_INSIDE_TYPEOF) |
61 TypeofMode::NOT_INSIDE_TYPEOF) | 61 .LoadGlobal(name, 1, TypeofMode::INSIDE_TYPEOF) |
62 .LoadGlobal(name, 1, LanguageMode::STRICT, TypeofMode::NOT_INSIDE_TYPEOF) | |
63 .LoadGlobal(name, 1, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF) | |
64 .LoadGlobal(name, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF) | |
65 .StoreGlobal(name, 1, LanguageMode::SLOPPY) | 62 .StoreGlobal(name, 1, LanguageMode::SLOPPY) |
66 .StoreGlobal(name, 1, LanguageMode::STRICT); | 63 .StoreGlobal(name, 1, LanguageMode::STRICT); |
67 | 64 |
68 // Emit context operations. | 65 // Emit context operations. |
69 builder.PushContext(reg) | 66 builder.PushContext(reg) |
70 .PopContext(reg) | 67 .PopContext(reg) |
71 .LoadContextSlot(reg, 1) | 68 .LoadContextSlot(reg, 1) |
72 .StoreContextSlot(reg, 1); | 69 .StoreContextSlot(reg, 1); |
73 | 70 |
74 // Emit load / store property operations. | 71 // Emit load / store property operations. |
75 builder.LoadNamedProperty(reg, name, 0, LanguageMode::SLOPPY) | 72 builder.LoadNamedProperty(reg, name, 0) |
76 .LoadKeyedProperty(reg, 0, LanguageMode::SLOPPY) | 73 .LoadKeyedProperty(reg, 0) |
77 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY) | 74 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY) |
78 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) | 75 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) |
79 .LoadNamedProperty(reg, name, 0, LanguageMode::STRICT) | |
80 .LoadKeyedProperty(reg, 0, LanguageMode::STRICT) | |
81 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT) | 76 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT) |
82 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); | 77 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); |
83 | 78 |
84 // Emit load / store lookup slots. | 79 // Emit load / store lookup slots. |
85 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) | 80 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) |
86 .LoadLookupSlot(name, TypeofMode::INSIDE_TYPEOF) | 81 .LoadLookupSlot(name, TypeofMode::INSIDE_TYPEOF) |
87 .StoreLookupSlot(name, LanguageMode::SLOPPY) | 82 .StoreLookupSlot(name, LanguageMode::SLOPPY) |
88 .StoreLookupSlot(name, LanguageMode::STRICT); | 83 .StoreLookupSlot(name, LanguageMode::STRICT); |
89 | 84 |
90 // Emit closure operations. | 85 // Emit closure operations. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 212 |
218 // Wide constant pool loads | 213 // Wide constant pool loads |
219 for (int i = 0; i < 256; i++) { | 214 for (int i = 0; i < 256; i++) { |
220 // Emit junk in constant pool to force wide constant pool index. | 215 // Emit junk in constant pool to force wide constant pool index. |
221 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); | 216 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); |
222 } | 217 } |
223 builder.LoadLiteral(Smi::FromInt(20000000)); | 218 builder.LoadLiteral(Smi::FromInt(20000000)); |
224 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); | 219 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); |
225 | 220 |
226 // Emit wide global load / store operations. | 221 // Emit wide global load / store operations. |
227 builder.LoadGlobal(name, 1024, LanguageMode::SLOPPY, | 222 builder.LoadGlobal(name, 1024, TypeofMode::NOT_INSIDE_TYPEOF) |
228 TypeofMode::NOT_INSIDE_TYPEOF) | 223 .LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF) |
229 .LoadGlobal(wide_name, 1, LanguageMode::STRICT, | |
230 TypeofMode::NOT_INSIDE_TYPEOF) | |
231 .LoadGlobal(name, 1024, LanguageMode::SLOPPY, TypeofMode::INSIDE_TYPEOF) | |
232 .LoadGlobal(wide_name, 1, LanguageMode::STRICT, TypeofMode::INSIDE_TYPEOF) | |
233 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) | 224 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) |
234 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); | 225 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); |
235 | 226 |
236 // Emit wide load / store property operations. | 227 // Emit wide load / store property operations. |
237 builder.LoadNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) | 228 builder.LoadNamedProperty(reg, wide_name, 0) |
238 .LoadKeyedProperty(reg, 2056, LanguageMode::SLOPPY) | 229 .LoadKeyedProperty(reg, 2056) |
239 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) | 230 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) |
240 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) | 231 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) |
241 .LoadNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) | |
242 .LoadKeyedProperty(reg, 2056, LanguageMode::STRICT) | |
243 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) | 232 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) |
244 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); | 233 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); |
245 | 234 |
246 // Emit wide context operations. | 235 // Emit wide context operations. |
247 builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024); | 236 builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024); |
248 | 237 |
249 // Emit wide load / store lookup slots. | 238 // Emit wide load / store lookup slots. |
250 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) | 239 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) |
251 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) | 240 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) |
252 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) | 241 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 iterator.Advance(); | 644 iterator.Advance(); |
656 } | 645 } |
657 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 646 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
658 iterator.Advance(); | 647 iterator.Advance(); |
659 CHECK(iterator.done()); | 648 CHECK(iterator.done()); |
660 } | 649 } |
661 | 650 |
662 } // namespace interpreter | 651 } // namespace interpreter |
663 } // namespace internal | 652 } // namespace internal |
664 } // namespace v8 | 653 } // namespace v8 |
OLD | NEW |