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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 register_optimizer_->DoMov(from, to, CurrentSourcePosition(Bytecode::kMov)); | 441 register_optimizer_->DoMov(from, to, CurrentSourcePosition(Bytecode::kMov)); |
442 } else { | 442 } else { |
443 OutputMov(from, to); | 443 OutputMov(from, to); |
444 } | 444 } |
445 return *this; | 445 return *this; |
446 } | 446 } |
447 | 447 |
448 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal( | 448 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal( |
449 const Handle<String> name, int feedback_slot, TypeofMode typeof_mode) { | 449 const Handle<String> name, int feedback_slot, TypeofMode typeof_mode) { |
450 size_t name_index = GetConstantPoolEntry(name); | 450 size_t name_index = GetConstantPoolEntry(name); |
| 451 // Ensure that typeof mode is in sync with the IC slot kind if the function |
| 452 // literal is available (not a unit test case). |
| 453 // TODO(ishell): check only in debug mode. |
| 454 if (literal_) { |
| 455 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(feedback_slot); |
| 456 CHECK_EQ(GetTypeofModeFromICKind(feedback_vector_spec()->GetKind(slot)), |
| 457 typeof_mode); |
| 458 } |
451 if (typeof_mode == INSIDE_TYPEOF) { | 459 if (typeof_mode == INSIDE_TYPEOF) { |
452 OutputLdaGlobalInsideTypeof(name_index, feedback_slot); | 460 OutputLdaGlobalInsideTypeof(name_index, feedback_slot); |
453 } else { | 461 } else { |
454 DCHECK_EQ(typeof_mode, NOT_INSIDE_TYPEOF); | 462 DCHECK_EQ(typeof_mode, NOT_INSIDE_TYPEOF); |
455 OutputLdaGlobal(name_index, feedback_slot); | 463 OutputLdaGlobal(name_index, feedback_slot); |
456 } | 464 } |
457 return *this; | 465 return *this; |
458 } | 466 } |
459 | 467 |
460 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal( | 468 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal( |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 RegisterList reg_list) { | 1083 RegisterList reg_list) { |
1076 DCHECK(RegisterListIsValid(reg_list)); | 1084 DCHECK(RegisterListIsValid(reg_list)); |
1077 if (register_optimizer_) | 1085 if (register_optimizer_) |
1078 register_optimizer_->PrepareOutputRegisterList(reg_list); | 1086 register_optimizer_->PrepareOutputRegisterList(reg_list); |
1079 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); | 1087 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); |
1080 } | 1088 } |
1081 | 1089 |
1082 } // namespace interpreter | 1090 } // namespace interpreter |
1083 } // namespace internal | 1091 } // namespace internal |
1084 } // namespace v8 | 1092 } // namespace v8 |
OLD | NEW |