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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 .BinaryOperation(Token::ADD, reg, 1) | 70 .BinaryOperation(Token::ADD, reg, 1) |
71 .StoreAccumulatorInRegister(reg) | 71 .StoreAccumulatorInRegister(reg) |
72 .LoadNull(); | 72 .LoadNull(); |
73 | 73 |
74 // Emit register-register transfer. | 74 // Emit register-register transfer. |
75 builder.MoveRegister(reg, other); | 75 builder.MoveRegister(reg, other); |
76 builder.MoveRegister(reg, wide); | 76 builder.MoveRegister(reg, wide); |
77 | 77 |
78 // Emit global load / store operations. | 78 // Emit global load / store operations. |
79 Handle<String> name = factory->NewStringFromStaticChars("var_name"); | 79 Handle<String> name = factory->NewStringFromStaticChars("var_name"); |
80 builder.LoadGlobal(1, TypeofMode::NOT_INSIDE_TYPEOF) | 80 builder.LoadGlobal(name, 1, TypeofMode::NOT_INSIDE_TYPEOF) |
81 .LoadGlobal(1, TypeofMode::INSIDE_TYPEOF) | 81 .LoadGlobal(name, 1, TypeofMode::INSIDE_TYPEOF) |
82 .StoreGlobal(name, 1, LanguageMode::SLOPPY) | 82 .StoreGlobal(name, 1, LanguageMode::SLOPPY) |
83 .StoreGlobal(name, 1, LanguageMode::STRICT); | 83 .StoreGlobal(name, 1, LanguageMode::STRICT); |
84 | 84 |
85 // Emit context operations. | 85 // Emit context operations. |
86 builder.PushContext(reg) | 86 builder.PushContext(reg) |
87 .PopContext(reg) | 87 .PopContext(reg) |
88 .LoadContextSlot(reg, 1, 0) | 88 .LoadContextSlot(reg, 1, 0) |
89 .StoreContextSlot(reg, 1, 0); | 89 .StoreContextSlot(reg, 1, 0); |
90 | 90 |
91 // Emit context operations which operate on the local context. | 91 // Emit context operations which operate on the local context. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 // Wide constant pool loads | 279 // Wide constant pool loads |
280 for (int i = 0; i < 256; i++) { | 280 for (int i = 0; i < 256; i++) { |
281 // Emit junk in constant pool to force wide constant pool index. | 281 // Emit junk in constant pool to force wide constant pool index. |
282 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); | 282 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); |
283 } | 283 } |
284 builder.LoadLiteral(Smi::FromInt(20000000)); | 284 builder.LoadLiteral(Smi::FromInt(20000000)); |
285 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); | 285 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); |
286 | 286 |
287 // Emit wide global load / store operations. | 287 // Emit wide global load / store operations. |
288 builder.LoadGlobal(1024, TypeofMode::NOT_INSIDE_TYPEOF) | 288 builder.LoadGlobal(name, 1024, TypeofMode::NOT_INSIDE_TYPEOF) |
289 .LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF) | 289 .LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF) |
290 .LoadGlobal(1024, TypeofMode::INSIDE_TYPEOF) | 290 .LoadGlobal(name, 1024, TypeofMode::INSIDE_TYPEOF) |
291 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) | 291 .StoreGlobal(name, 1024, LanguageMode::SLOPPY) |
292 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); | 292 .StoreGlobal(wide_name, 1, LanguageMode::STRICT); |
293 | 293 |
294 // Emit extra wide global load. | 294 // Emit extra wide global load. |
295 builder.LoadGlobal(1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF); | 295 builder.LoadGlobal(name, 1024 * 1024, TypeofMode::NOT_INSIDE_TYPEOF); |
296 | 296 |
297 // Emit wide load / store property operations. | 297 // Emit wide load / store property operations. |
298 builder.LoadNamedProperty(reg, wide_name, 0) | 298 builder.LoadNamedProperty(reg, wide_name, 0) |
299 .LoadKeyedProperty(reg, 2056) | 299 .LoadKeyedProperty(reg, 2056) |
300 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) | 300 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) |
301 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) | 301 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) |
302 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) | 302 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) |
303 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); | 303 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); |
304 | 304 |
305 // Emit wide context operations. | 305 // Emit wide context operations. |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 iterator.Advance(); | 728 iterator.Advance(); |
729 } | 729 } |
730 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 730 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
731 iterator.Advance(); | 731 iterator.Advance(); |
732 CHECK(iterator.done()); | 732 CHECK(iterator.done()); |
733 } | 733 } |
734 | 734 |
735 } // namespace interpreter | 735 } // namespace interpreter |
736 } // namespace internal | 736 } // namespace internal |
737 } // namespace v8 | 737 } // namespace v8 |
OLD | NEW |