| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 } else { | 454 } else { |
| 455 DCHECK_EQ(language_mode, STRICT); | 455 DCHECK_EQ(language_mode, STRICT); |
| 456 OutputStaGlobalStrict(name_index, feedback_slot); | 456 OutputStaGlobalStrict(name_index, feedback_slot); |
| 457 } | 457 } |
| 458 return *this; | 458 return *this; |
| 459 } | 459 } |
| 460 | 460 |
| 461 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, | 461 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, |
| 462 int slot_index, | 462 int slot_index, |
| 463 int depth) { | 463 int depth) { |
| 464 OutputLdaContextSlot(context, slot_index, depth); | 464 if (context.is_current_context() && depth == 0) { |
| 465 OutputLdaCurrentContextSlot(slot_index); |
| 466 } else { |
| 467 OutputLdaContextSlot(context, slot_index, depth); |
| 468 } |
| 465 return *this; | 469 return *this; |
| 466 } | 470 } |
| 467 | 471 |
| 468 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, | 472 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, |
| 469 int slot_index, | 473 int slot_index, |
| 470 int depth) { | 474 int depth) { |
| 471 OutputStaContextSlot(context, slot_index, depth); | 475 if (context.is_current_context() && depth == 0) { |
| 476 OutputStaCurrentContextSlot(slot_index); |
| 477 } else { |
| 478 OutputStaContextSlot(context, slot_index, depth); |
| 479 } |
| 472 return *this; | 480 return *this; |
| 473 } | 481 } |
| 474 | 482 |
| 475 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLookupSlot( | 483 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLookupSlot( |
| 476 const Handle<String> name, TypeofMode typeof_mode) { | 484 const Handle<String> name, TypeofMode typeof_mode) { |
| 477 size_t name_index = GetConstantPoolEntry(name); | 485 size_t name_index = GetConstantPoolEntry(name); |
| 478 if (typeof_mode == INSIDE_TYPEOF) { | 486 if (typeof_mode == INSIDE_TYPEOF) { |
| 479 OutputLdaLookupSlotInsideTypeof(name_index); | 487 OutputLdaLookupSlotInsideTypeof(name_index); |
| 480 } else { | 488 } else { |
| 481 DCHECK_EQ(typeof_mode, NOT_INSIDE_TYPEOF); | 489 DCHECK_EQ(typeof_mode, NOT_INSIDE_TYPEOF); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 RegisterList reg_list) { | 993 RegisterList reg_list) { |
| 986 DCHECK(RegisterListIsValid(reg_list)); | 994 DCHECK(RegisterListIsValid(reg_list)); |
| 987 if (register_optimizer_) | 995 if (register_optimizer_) |
| 988 register_optimizer_->PrepareOutputRegisterList(reg_list); | 996 register_optimizer_->PrepareOutputRegisterList(reg_list); |
| 989 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); | 997 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); |
| 990 } | 998 } |
| 991 | 999 |
| 992 } // namespace interpreter | 1000 } // namespace interpreter |
| 993 } // namespace internal | 1001 } // namespace internal |
| 994 } // namespace v8 | 1002 } // namespace v8 |
| OLD | NEW |