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

Unified Diff: runtime/lib/integers.cc

Issue 381543002: Tweaks for speed in integer arithmetic runtime. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/platform/utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/integers.cc
===================================================================
--- runtime/lib/integers.cc (revision 38076)
+++ runtime/lib/integers.cc (working copy)
@@ -282,12 +282,16 @@
if (value.IsMint()) {
const int64_t mint_value = value.AsInt64Value();
const int count = Utils::HighestBit(mint_value);
- if ((count + amount.Value()) < Mint::kBits) {
+ intptr_t shift_count = amount.Value();
+ if (kind == Token::kSHR) {
+ shift_count = -shift_count;
+ }
+ if ((count + shift_count) < Mint::kBits) {
switch (kind) {
case Token::kSHL:
- return Integer::New(mint_value << amount.Value(), Heap::kNew, silent);
+ return Integer::New(mint_value << shift_count, Heap::kNew, silent);
case Token::kSHR:
- return Integer::New(mint_value >> amount.Value(), Heap::kNew, silent);
+ return Integer::New(mint_value >> -shift_count, Heap::kNew, silent);
default:
UNIMPLEMENTED();
}
« no previous file with comments | « no previous file | runtime/platform/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698