OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 | 6 |
7 #include "src/globals.h" | 7 #include "src/globals.h" |
8 #include "src/interpreter/bytecode-array-writer.h" | 8 #include "src/interpreter/bytecode-array-writer.h" |
9 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 9 #include "src/interpreter/bytecode-dead-code-optimizer.h" |
10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 size_t name_index = GetConstantPoolEntry(name); | 470 size_t name_index = GetConstantPoolEntry(name); |
471 if (language_mode == SLOPPY) { | 471 if (language_mode == SLOPPY) { |
472 OutputStaGlobalSloppy(name_index, feedback_slot); | 472 OutputStaGlobalSloppy(name_index, feedback_slot); |
473 } else { | 473 } else { |
474 DCHECK_EQ(language_mode, STRICT); | 474 DCHECK_EQ(language_mode, STRICT); |
475 OutputStaGlobalStrict(name_index, feedback_slot); | 475 OutputStaGlobalStrict(name_index, feedback_slot); |
476 } | 476 } |
477 return *this; | 477 return *this; |
478 } | 478 } |
479 | 479 |
480 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, | 480 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot( |
481 int slot_index, | 481 Register context, int slot_index, int depth, |
482 int depth) { | 482 ContextSlotMutability mutability) { |
483 if (context.is_current_context() && depth == 0) { | 483 if (context.is_current_context() && depth == 0) { |
484 OutputLdaCurrentContextSlot(slot_index); | 484 if (mutability == kImmutableSlot) { |
| 485 OutputLdaImmutableCurrentContextSlot(slot_index); |
| 486 } else { |
| 487 DCHECK_EQ(kMutableSlot, mutability); |
| 488 OutputLdaCurrentContextSlot(slot_index); |
| 489 } |
| 490 } else if (mutability == kImmutableSlot) { |
| 491 OutputLdaImmutableContextSlot(context, slot_index, depth); |
485 } else { | 492 } else { |
| 493 DCHECK_EQ(mutability, kMutableSlot); |
486 OutputLdaContextSlot(context, slot_index, depth); | 494 OutputLdaContextSlot(context, slot_index, depth); |
487 } | 495 } |
488 return *this; | 496 return *this; |
489 } | 497 } |
490 | 498 |
491 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, | 499 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, |
492 int slot_index, | 500 int slot_index, |
493 int depth) { | 501 int depth) { |
494 if (context.is_current_context() && depth == 0) { | 502 if (context.is_current_context() && depth == 0) { |
495 OutputStaCurrentContextSlot(slot_index); | 503 OutputStaCurrentContextSlot(slot_index); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 RegisterList reg_list) { | 1091 RegisterList reg_list) { |
1084 DCHECK(RegisterListIsValid(reg_list)); | 1092 DCHECK(RegisterListIsValid(reg_list)); |
1085 if (register_optimizer_) | 1093 if (register_optimizer_) |
1086 register_optimizer_->PrepareOutputRegisterList(reg_list); | 1094 register_optimizer_->PrepareOutputRegisterList(reg_list); |
1087 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); | 1095 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); |
1088 } | 1096 } |
1089 | 1097 |
1090 } // namespace interpreter | 1098 } // namespace interpreter |
1091 } // namespace internal | 1099 } // namespace internal |
1092 } // namespace v8 | 1100 } // namespace v8 |
OLD | NEW |