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

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

Issue 110123002: Enable optimization of functions with generic switches. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding tests Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/rewriter.cc ('k') | test/mjsunit/switch-opt.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 __ jmp(clause->body_target()); 979 __ jmp(clause->body_target());
980 __ bind(&slow_case); 980 __ bind(&slow_case);
981 } 981 }
982 982
983 // Record position before stub call for type feedback. 983 // Record position before stub call for type feedback.
984 SetSourcePosition(clause->position()); 984 SetSourcePosition(clause->position());
985 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT); 985 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT);
986 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); 986 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId());
987 patch_site.EmitPatchInfo(); 987 patch_site.EmitPatchInfo();
988 988
989 Label skip;
990 __ jmp(&skip, Label::kNear);
991 PrepareForBailout(clause, TOS_REG);
992 __ CompareRoot(rax, Heap::kTrueValueRootIndex);
993 __ j(not_equal, &next_test);
994 __ Drop(1);
995 __ jmp(clause->body_target());
996 __ bind(&skip);
997
989 __ testq(rax, rax); 998 __ testq(rax, rax);
990 __ j(not_equal, &next_test); 999 __ j(not_equal, &next_test);
991 __ Drop(1); // Switch value is no longer needed. 1000 __ Drop(1); // Switch value is no longer needed.
992 __ jmp(clause->body_target()); 1001 __ jmp(clause->body_target());
993 } 1002 }
994 1003
995 // Discard the test value and jump to the default if present, otherwise to 1004 // Discard the test value and jump to the default if present, otherwise to
996 // the end of the statement. 1005 // the end of the statement.
997 __ bind(&next_test); 1006 __ bind(&next_test);
998 __ Drop(1); // Switch value is no longer needed. 1007 __ Drop(1); // Switch value is no longer needed.
(...skipping 3895 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 4903
4895 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4904 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4896 Assembler::target_address_at(call_target_address)); 4905 Assembler::target_address_at(call_target_address));
4897 return OSR_AFTER_STACK_CHECK; 4906 return OSR_AFTER_STACK_CHECK;
4898 } 4907 }
4899 4908
4900 4909
4901 } } // namespace v8::internal 4910 } } // namespace v8::internal
4902 4911
4903 #endif // V8_TARGET_ARCH_X64 4912 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/rewriter.cc ('k') | test/mjsunit/switch-opt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698