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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 5812005: Deoptimize non-smi switch cases if they are reached. (Closed)
Patch Set: Rebased Created 10 years 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 __ CallRuntime(Runtime::kDeclareGlobals, 3); 733 __ CallRuntime(Runtime::kDeclareGlobals, 3);
734 // Return value is ignored. 734 // Return value is ignored.
735 } 735 }
736 736
737 737
738 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { 738 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
739 Comment cmnt(masm_, "[ SwitchStatement"); 739 Comment cmnt(masm_, "[ SwitchStatement");
740 Breakable nested_statement(this, stmt); 740 Breakable nested_statement(this, stmt);
741 SetStatementPosition(stmt); 741 SetStatementPosition(stmt);
742 742
743 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
744
745 // Keep the switch value on the stack until a case matches. 743 // Keep the switch value on the stack until a case matches.
746 VisitForStackValue(stmt->tag()); 744 VisitForStackValue(stmt->tag());
745 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
747 746
748 ZoneList<CaseClause*>* clauses = stmt->cases(); 747 ZoneList<CaseClause*>* clauses = stmt->cases();
749 CaseClause* default_clause = NULL; // Can occur anywhere in the list. 748 CaseClause* default_clause = NULL; // Can occur anywhere in the list.
750 749
751 Label next_test; // Recycled for each test. 750 Label next_test; // Recycled for each test.
752 // Compile all the tests with branches to their bodies. 751 // Compile all the tests with branches to their bodies.
753 for (int i = 0; i < clauses->length(); i++) { 752 for (int i = 0; i < clauses->length(); i++) {
754 CaseClause* clause = clauses->at(i); 753 CaseClause* clause = clauses->at(i);
755 // The default is not a test, but remember it as final fall through. 754 // The default is not a test, but remember it as final fall through.
756 if (clause->is_default()) { 755 if (clause->is_default()) {
(...skipping 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after
4252 // And return. 4251 // And return.
4253 __ ret(0); 4252 __ ret(0);
4254 } 4253 }
4255 4254
4256 4255
4257 #undef __ 4256 #undef __
4258 4257
4259 } } // namespace v8::internal 4258 } } // namespace v8::internal
4260 4259
4261 #endif // V8_TARGET_ARCH_IA32 4260 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698