Chromium Code Reviews| Index: src/typing.cc |
| diff --git a/src/typing.cc b/src/typing.cc |
| index 8487c05eb4af9fe472509c5afc34ae0eb1916053..76f1f28529898b0607904b97d31db4c11678b227 100644 |
| --- a/src/typing.cc |
| +++ b/src/typing.cc |
| @@ -151,24 +151,22 @@ void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) { |
| RECURSE(Visit(stmt->tag())); |
| ZoneList<CaseClause*>* clauses = stmt->cases(); |
| - SwitchStatement::SwitchType switch_type = stmt->switch_type(); |
| Effects local_effects(zone()); |
| bool complex_effects = false; // True for label effects or fall-through. |
| for (int i = 0; i < clauses->length(); ++i) { |
| CaseClause* clause = clauses->at(i); |
| + |
| Effects clause_effects = EnterEffects(); |
| if (!clause->is_default()) { |
| Expression* label = clause->label(); |
| - SwitchStatement::SwitchType label_switch_type = |
| - label->IsSmiLiteral() ? SwitchStatement::SMI_SWITCH : |
| - label->IsStringLiteral() ? SwitchStatement::STRING_SWITCH : |
| - SwitchStatement::GENERIC_SWITCH; |
| - if (switch_type == SwitchStatement::UNKNOWN_SWITCH) |
| - switch_type = label_switch_type; |
| - else if (switch_type != label_switch_type) |
| - switch_type = SwitchStatement::GENERIC_SWITCH; |
| + Handle<Type> tag_type, label_type, combined_type; |
|
rossberg
2013/12/11 09:41:34
Nit: please add the // Collect type feedback com
Jakob Kummerow
2013/12/11 10:00:01
Done.
|
| + oracle()->CompareType(clause->CompareId(), |
| + &tag_type, &label_type, &combined_type); |
| + NarrowLowerType(stmt->tag(), tag_type); |
| + NarrowLowerType(label, label_type); |
| + clause->set_compare_type(combined_type); |
| RECURSE(Visit(label)); |
| if (!clause_effects.IsEmpty()) complex_effects = true; |
| @@ -189,20 +187,6 @@ void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) { |
| } else { |
| store_.Seq(local_effects); |
| } |
| - |
| - if (switch_type == SwitchStatement::UNKNOWN_SWITCH) |
| - switch_type = SwitchStatement::GENERIC_SWITCH; |
| - stmt->set_switch_type(switch_type); |
| - |
| - // Collect type feedback. |
| - // TODO(rossberg): can we eliminate this special case and extra loop? |
| - if (switch_type == SwitchStatement::SMI_SWITCH) { |
| - for (int i = 0; i < clauses->length(); ++i) { |
| - CaseClause* clause = clauses->at(i); |
| - if (!clause->is_default()) |
| - clause->set_compare_type(oracle()->ClauseType(clause->CompareId())); |
| - } |
| - } |
| } |