Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 1460583003: [turbofan] Remove case_count >= 3 limit for switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return VisitBranch(input, tbranch, fbranch); 586 return VisitBranch(input, tbranch, fbranch);
587 } 587 }
588 case BasicBlock::kSwitch: { 588 case BasicBlock::kSwitch: {
589 DCHECK_EQ(IrOpcode::kSwitch, input->opcode()); 589 DCHECK_EQ(IrOpcode::kSwitch, input->opcode());
590 SwitchInfo sw; 590 SwitchInfo sw;
591 // Last successor must be Default. 591 // Last successor must be Default.
592 sw.default_branch = block->successors().back(); 592 sw.default_branch = block->successors().back();
593 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); 593 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode());
594 // All other successors must be cases. 594 // All other successors must be cases.
595 sw.case_count = block->SuccessorCount() - 1; 595 sw.case_count = block->SuccessorCount() - 1;
596 DCHECK_LE(1u, sw.case_count);
597 sw.case_branches = &block->successors().front(); 596 sw.case_branches = &block->successors().front();
598 // Determine case values and their min/max. 597 // Determine case values and their min/max.
599 sw.case_values = zone()->NewArray<int32_t>(sw.case_count); 598 sw.case_values = zone()->NewArray<int32_t>(sw.case_count);
600 sw.min_value = std::numeric_limits<int32_t>::max(); 599 sw.min_value = std::numeric_limits<int32_t>::max();
601 sw.max_value = std::numeric_limits<int32_t>::min(); 600 sw.max_value = std::numeric_limits<int32_t>::min();
602 for (size_t index = 0; index < sw.case_count; ++index) { 601 for (size_t index = 0; index < sw.case_count; ++index) {
603 BasicBlock* branch = sw.case_branches[index]; 602 BasicBlock* branch = sw.case_branches[index];
604 int32_t value = OpParameter<int32_t>(branch->front()->op()); 603 int32_t value = OpParameter<int32_t>(branch->front()->op());
605 sw.case_values[index] = value; 604 sw.case_values[index] = value;
606 if (sw.min_value > value) sw.min_value = value; 605 if (sw.min_value > value) sw.min_value = value;
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 return new (instruction_zone()) FrameStateDescriptor( 1397 return new (instruction_zone()) FrameStateDescriptor(
1399 instruction_zone(), state_info.type(), state_info.bailout_id(), 1398 instruction_zone(), state_info.type(), state_info.bailout_id(),
1400 state_info.state_combine(), parameters, locals, stack, 1399 state_info.state_combine(), parameters, locals, stack,
1401 state_info.shared_info(), outer_state); 1400 state_info.shared_info(), outer_state);
1402 } 1401 }
1403 1402
1404 1403
1405 } // namespace compiler 1404 } // namespace compiler
1406 } // namespace internal 1405 } // namespace internal
1407 } // namespace v8 1406 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698