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

Side by Side Diff: src/utils.cc

Issue 9638018: [v8-dev] Optimise Math.floor(x/y) to use integer division for specific divisor.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 8 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/lithium-x64.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 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ASSERT(!is_finalized() && position_ < buffer_.length()); 82 ASSERT(!is_finalized() && position_ < buffer_.length());
83 buffer_[position_] = '\0'; 83 buffer_[position_] = '\0';
84 // Make sure nobody managed to add a 0-character to the 84 // Make sure nobody managed to add a 0-character to the
85 // buffer while building the string. 85 // buffer while building the string.
86 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); 86 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
87 position_ = -1; 87 position_ = -1;
88 ASSERT(is_finalized()); 88 ASSERT(is_finalized());
89 return buffer_.start(); 89 return buffer_.start();
90 } 90 }
91 91
92
93 const DivMagicNumbers DivMagicNumberFor(int32_t divisor) {
94 switch (divisor) {
95 case 3: return DivMagicNumberFor3;
96 case 5: return DivMagicNumberFor5;
97 case 7: return DivMagicNumberFor7;
98 case 9: return DivMagicNumberFor9;
99 case 11: return DivMagicNumberFor11;
100 case 25: return DivMagicNumberFor25;
101 case 125: return DivMagicNumberFor125;
102 case 625: return DivMagicNumberFor625;
103 default: return InvalidDivMagicNumber;
104 }
105 }
106
92 } } // namespace v8::internal 107 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/utils.h ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698