Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 .LoadGlobal(1, TypeofMode::INSIDE_TYPEOF) | 81 .LoadGlobal(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. | |
| 92 builder.LoadContextSlot(Register::current_context(), 1, 0) | |
| 93 .StoreContextSlot(Register::current_context(), 1, 0); | |
| 94 | |
| 91 // Emit load / store property operations. | 95 // Emit load / store property operations. |
| 92 builder.LoadNamedProperty(reg, name, 0) | 96 builder.LoadNamedProperty(reg, name, 0) |
| 93 .LoadKeyedProperty(reg, 0) | 97 .LoadKeyedProperty(reg, 0) |
| 94 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY) | 98 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY) |
| 95 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) | 99 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) |
| 96 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT) | 100 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT) |
| 97 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); | 101 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); |
| 98 | 102 |
| 99 // Emit load / store lookup slots. | 103 // Emit load / store lookup slots. |
| 100 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) | 104 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 .StoreLookupSlot(wide_name, LanguageMode::STRICT); | 307 .StoreLookupSlot(wide_name, LanguageMode::STRICT); |
| 304 | 308 |
| 305 // Emit loads which will be transformed to Ldr equivalents by the peephole | 309 // Emit loads which will be transformed to Ldr equivalents by the peephole |
| 306 // optimizer. | 310 // optimizer. |
| 307 builder.LoadNamedProperty(reg, name, 0) | 311 builder.LoadNamedProperty(reg, name, 0) |
| 308 .StoreAccumulatorInRegister(reg) | 312 .StoreAccumulatorInRegister(reg) |
| 309 .LoadKeyedProperty(reg, 0) | 313 .LoadKeyedProperty(reg, 0) |
| 310 .StoreAccumulatorInRegister(reg) | 314 .StoreAccumulatorInRegister(reg) |
| 311 .LoadContextSlot(reg, 1, 0) | 315 .LoadContextSlot(reg, 1, 0) |
| 312 .StoreAccumulatorInRegister(reg) | 316 .StoreAccumulatorInRegister(reg) |
| 317 .LoadContextSlot(Register::current_context(), 1, 0) | |
| 318 .StoreAccumulatorInRegister(reg) | |
| 313 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF) | 319 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF) |
| 314 .StoreAccumulatorInRegister(reg) | 320 .StoreAccumulatorInRegister(reg) |
| 315 .LoadUndefined() | 321 .LoadUndefined() |
| 316 .StoreAccumulatorInRegister(reg); | 322 .StoreAccumulatorInRegister(reg); |
| 317 | 323 |
| 318 // CreateClosureWide | 324 // CreateClosureWide |
| 319 builder.CreateClosure(1000, NOT_TENURED); | 325 builder.CreateClosure(1000, NOT_TENURED); |
| 320 | 326 |
| 321 // Emit wide variant of literal creation operations. | 327 // Emit wide variant of literal creation operations. |
| 322 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), | 328 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1; | 395 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1; |
| 390 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1; | 396 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1; |
| 391 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; | 397 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; |
| 392 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; | 398 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; |
| 393 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; | 399 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; |
| 394 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; | 400 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; |
| 395 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; | 401 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; |
| 396 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; | 402 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; |
| 397 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; | 403 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; |
| 398 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; | 404 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; |
| 399 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; | 405 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; |
|
rmcilroy
2016/10/27 13:44:09
Could you add it here too (so that this test still
| |
| 400 } | 406 } |
| 401 | 407 |
| 402 // Check return occurs at the end and only once in the BytecodeArray. | 408 // Check return occurs at the end and only once in the BytecodeArray. |
| 403 CHECK_EQ(final_bytecode, Bytecode::kReturn); | 409 CHECK_EQ(final_bytecode, Bytecode::kReturn); |
| 404 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); | 410 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); |
| 405 | 411 |
| 406 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 412 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
| 407 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ | 413 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ |
| 408 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ | 414 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ |
| 409 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ | 415 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 iterator.Advance(); | 735 iterator.Advance(); |
| 730 } | 736 } |
| 731 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 737 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
| 732 iterator.Advance(); | 738 iterator.Advance(); |
| 733 CHECK(iterator.done()); | 739 CHECK(iterator.done()); |
| 734 } | 740 } |
| 735 | 741 |
| 736 } // namespace interpreter | 742 } // namespace interpreter |
| 737 } // namespace internal | 743 } // namespace internal |
| 738 } // namespace v8 | 744 } // namespace v8 |
| OLD | NEW |