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

Side by Side Diff: src/factory.cc

Issue 2105683006: Remove DoubleRepresentation from globals.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/conversions.h ('k') | src/globals.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 return share; 2154 return share;
2155 } 2155 }
2156 2156
2157 2157
2158 static inline int NumberCacheHash(Handle<FixedArray> cache, 2158 static inline int NumberCacheHash(Handle<FixedArray> cache,
2159 Handle<Object> number) { 2159 Handle<Object> number) {
2160 int mask = (cache->length() >> 1) - 1; 2160 int mask = (cache->length() >> 1) - 1;
2161 if (number->IsSmi()) { 2161 if (number->IsSmi()) {
2162 return Handle<Smi>::cast(number)->value() & mask; 2162 return Handle<Smi>::cast(number)->value() & mask;
2163 } else { 2163 } else {
2164 DoubleRepresentation rep(number->Number()); 2164 int64_t bits = bit_cast<int64_t>(number->Number());
2165 return 2165 return (static_cast<int>(bits) ^ static_cast<int>(bits >> 32)) & mask;
2166 (static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)) & mask;
2167 } 2166 }
2168 } 2167 }
2169 2168
2170 2169
2171 Handle<Object> Factory::GetNumberStringCache(Handle<Object> number) { 2170 Handle<Object> Factory::GetNumberStringCache(Handle<Object> number) {
2172 DisallowHeapAllocation no_gc; 2171 DisallowHeapAllocation no_gc;
2173 int hash = NumberCacheHash(number_string_cache(), number); 2172 int hash = NumberCacheHash(number_string_cache(), number);
2174 Object* key = number_string_cache()->get(hash * 2); 2173 Object* key = number_string_cache()->get(hash * 2);
2175 if (key == *number || (key->IsHeapNumber() && number->IsHeapNumber() && 2174 if (key == *number || (key->IsHeapNumber() && number->IsHeapNumber() &&
2176 key->Number() == number->Number())) { 2175 key->Number() == number->Number())) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 } 2376 }
2378 2377
2379 2378
2380 Handle<Object> Factory::ToBoolean(bool value) { 2379 Handle<Object> Factory::ToBoolean(bool value) {
2381 return value ? true_value() : false_value(); 2380 return value ? true_value() : false_value();
2382 } 2381 }
2383 2382
2384 2383
2385 } // namespace internal 2384 } // namespace internal
2386 } // namespace v8 2385 } // namespace v8
OLDNEW
« no previous file with comments | « src/conversions.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698