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-label.h" | 9 #include "src/interpreter/bytecode-label.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 .BinaryOperation(Token::ADD, reg) | 64 .BinaryOperation(Token::ADD, reg) |
65 .StoreAccumulatorInRegister(reg) | 65 .StoreAccumulatorInRegister(reg) |
66 .LoadNull(); | 66 .LoadNull(); |
67 | 67 |
68 // Emit register-register transfer. | 68 // Emit register-register transfer. |
69 builder.MoveRegister(reg, other); | 69 builder.MoveRegister(reg, other); |
70 builder.MoveRegister(reg, wide); | 70 builder.MoveRegister(reg, wide); |
71 | 71 |
72 // Emit global load / store operations. | 72 // Emit global load / store operations. |
73 Handle<String> name = factory->NewStringFromStaticChars("var_name"); | 73 Handle<String> name = factory->NewStringFromStaticChars("var_name"); |
74 builder.LoadGlobal(name, 1, TypeofMode::NOT_INSIDE_TYPEOF) | 74 builder.LoadGlobal(1, TypeofMode::NOT_INSIDE_TYPEOF) |
75 .LoadGlobal(name, 1, TypeofMode::INSIDE_TYPEOF) | 75 .LoadGlobal(1, TypeofMode::INSIDE_TYPEOF) |
76 .StoreGlobal(name, 1, LanguageMode::SLOPPY) | 76 .StoreGlobal(name, 1, LanguageMode::SLOPPY) |
77 .StoreGlobal(name, 1, LanguageMode::STRICT); | 77 .StoreGlobal(name, 1, LanguageMode::STRICT); |
78 | 78 |
79 // Emit context operations. | 79 // Emit context operations. |
80 builder.PushContext(reg) | 80 builder.PushContext(reg) |
81 .PopContext(reg) | 81 .PopContext(reg) |
82 .LoadContextSlot(reg, 1) | 82 .LoadContextSlot(reg, 1) |
83 .StoreContextSlot(reg, 1); | 83 .StoreContextSlot(reg, 1); |
84 | 84 |
85 // Emit load / store property operations. | 85 // Emit load / store property operations. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 // Wide constant pool loads | 260 // Wide constant pool loads |
261 for (int i = 0; i < 256; i++) { | 261 for (int i = 0; i < 256; i++) { |
262 // Emit junk in constant pool to force wide constant pool index. | 262 // Emit junk in constant pool to force wide constant pool index. |
263 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); | 263 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); |
264 } | 264 } |
265 builder.LoadLiteral(Smi::FromInt(20000000)); | 265 builder.LoadLiteral(Smi::FromInt(20000000)); |
266 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); | 266 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); |
267 | 267 |
268 // Emit wide global load / store operations. | 268 // Emit wide global load / store operations. |
269 builder.LoadGlobal(name, 1024, TypeofMode::NOT_INSIDE_TYPEOF) | 269 builder.LoadGlobal(1024, TypeofMode::NOT_INSIDE_TYPEOF) |
270 .LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF) | 270 .LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF) |
271 .LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF) | 271 .LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF) |
272 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) | 272 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) |
273 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); | 273 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); |
274 | 274 |
275 // Emit extra wide global load. | 275 // Emit extra wide global load. |
276 builder.LoadGlobal(name, 1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF); | 276 builder.LoadGlobal(1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF); |
277 | 277 |
278 // Emit wide load / store property operations. | 278 // Emit wide load / store property operations. |
279 builder.LoadNamedProperty(reg, wide_name, 0) | 279 builder.LoadNamedProperty(reg, wide_name, 0) |
280 .LoadKeyedProperty(reg, 2056) | 280 .LoadKeyedProperty(reg, 2056) |
281 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) | 281 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) |
282 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) | 282 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) |
283 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) | 283 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) |
284 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); | 284 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); |
285 | 285 |
286 // Emit wide context operations. | 286 // Emit wide context operations. |
287 builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024); | 287 builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024); |
288 | 288 |
289 // Emit wide load / store lookup slots. | 289 // Emit wide load / store lookup slots. |
290 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) | 290 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) |
291 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) | 291 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) |
292 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) | 292 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) |
293 .StoreLookupSlot(wide_name, LanguageMode::STRICT); | 293 .StoreLookupSlot(wide_name, LanguageMode::STRICT); |
294 | 294 |
295 // Emit loads which will be transformed to Ldr equivalents by the peephole | 295 // Emit loads which will be transformed to Ldr equivalents by the peephole |
296 // optimizer. | 296 // optimizer. |
297 builder.LoadNamedProperty(reg, name, 0) | 297 builder.LoadNamedProperty(reg, name, 0) |
298 .StoreAccumulatorInRegister(reg) | 298 .StoreAccumulatorInRegister(reg) |
299 .LoadKeyedProperty(reg, 0) | 299 .LoadKeyedProperty(reg, 0) |
300 .StoreAccumulatorInRegister(reg) | 300 .StoreAccumulatorInRegister(reg) |
301 .LoadContextSlot(reg, 1) | 301 .LoadContextSlot(reg, 1) |
302 .StoreAccumulatorInRegister(reg) | 302 .StoreAccumulatorInRegister(reg) |
303 .LoadGlobal(name, 0, TypeofMode::NOT_INSIDE_TYPEOF) | 303 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF) |
304 .StoreAccumulatorInRegister(reg) | 304 .StoreAccumulatorInRegister(reg) |
305 .LoadUndefined() | 305 .LoadUndefined() |
306 .StoreAccumulatorInRegister(reg); | 306 .StoreAccumulatorInRegister(reg); |
307 | 307 |
308 // CreateClosureWide | 308 // CreateClosureWide |
309 Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo( | 309 Handle<SharedFunctionInfo> shared_info2 = factory->NewSharedFunctionInfo( |
310 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(), | 310 factory->NewStringFromStaticChars("function_b"), MaybeHandle<Code>(), |
311 false); | 311 false); |
312 builder.CreateClosure(shared_info2, NOT_TENURED); | 312 builder.CreateClosure(shared_info2, NOT_TENURED); |
313 | 313 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 iterator.Advance(); | 817 iterator.Advance(); |
818 } | 818 } |
819 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 819 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
820 iterator.Advance(); | 820 iterator.Advance(); |
821 CHECK(iterator.done()); | 821 CHECK(iterator.done()); |
822 } | 822 } |
823 | 823 |
824 } // namespace interpreter | 824 } // namespace interpreter |
825 } // namespace internal | 825 } // namespace internal |
826 } // namespace v8 | 826 } // namespace v8 |
OLD | NEW |