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

Side by Side Diff: src/utils.cc

Issue 191293012: Reland "Handle non-power-of-2 divisors in division-like operations". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months 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/utils.h ('k') | src/x64/assembler-x64.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 buffer_[position_] = '\0'; 90 buffer_[position_] = '\0';
91 // Make sure nobody managed to add a 0-character to the 91 // Make sure nobody managed to add a 0-character to the
92 // buffer while building the string. 92 // buffer while building the string.
93 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); 93 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
94 position_ = -1; 94 position_ = -1;
95 ASSERT(is_finalized()); 95 ASSERT(is_finalized());
96 return buffer_.start(); 96 return buffer_.start();
97 } 97 }
98 98
99 99
100 const DivMagicNumbers DivMagicNumberFor(int32_t divisor) {
101 switch (divisor) {
102 case 3: return DivMagicNumberFor3;
103 case 5: return DivMagicNumberFor5;
104 case 7: return DivMagicNumberFor7;
105 case 9: return DivMagicNumberFor9;
106 case 11: return DivMagicNumberFor11;
107 case 25: return DivMagicNumberFor25;
108 case 125: return DivMagicNumberFor125;
109 case 625: return DivMagicNumberFor625;
110 default: return InvalidDivMagicNumber;
111 }
112 }
113
114 } } // namespace v8::internal 100 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/utils.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698