| OLD | NEW |
| 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/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 Handle<String> string) { | 2149 Handle<String> string) { |
| 2150 int hash = NumberCacheHash(number_string_cache(), number); | 2150 int hash = NumberCacheHash(number_string_cache(), number); |
| 2151 if (number_string_cache()->get(hash * 2) != *undefined_value()) { | 2151 if (number_string_cache()->get(hash * 2) != *undefined_value()) { |
| 2152 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); | 2152 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); |
| 2153 if (number_string_cache()->length() != full_size) { | 2153 if (number_string_cache()->length() != full_size) { |
| 2154 // The first time we have a hash collision, we move to the full sized | 2154 // The first time we have a hash collision, we move to the full sized |
| 2155 // number string cache. The idea is to have a small number string | 2155 // number string cache. The idea is to have a small number string |
| 2156 // cache in the snapshot to keep boot-time memory usage down. | 2156 // cache in the snapshot to keep boot-time memory usage down. |
| 2157 // If we expand the number string cache already while creating | 2157 // If we expand the number string cache already while creating |
| 2158 // the snapshot then that didn't work out. | 2158 // the snapshot then that didn't work out. |
| 2159 DCHECK(!isolate()->serializer_enabled() || FLAG_extra_code != NULL); | 2159 DCHECK(!isolate()->serializer_enabled()); |
| 2160 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); | 2160 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); |
| 2161 isolate()->heap()->set_number_string_cache(*new_cache); | 2161 isolate()->heap()->set_number_string_cache(*new_cache); |
| 2162 return; | 2162 return; |
| 2163 } | 2163 } |
| 2164 } | 2164 } |
| 2165 number_string_cache()->set(hash * 2, *number); | 2165 number_string_cache()->set(hash * 2, *number); |
| 2166 number_string_cache()->set(hash * 2 + 1, *string); | 2166 number_string_cache()->set(hash * 2 + 1, *string); |
| 2167 } | 2167 } |
| 2168 | 2168 |
| 2169 | 2169 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 return Handle<Object>::null(); | 2521 return Handle<Object>::null(); |
| 2522 } | 2522 } |
| 2523 | 2523 |
| 2524 | 2524 |
| 2525 Handle<Object> Factory::ToBoolean(bool value) { | 2525 Handle<Object> Factory::ToBoolean(bool value) { |
| 2526 return value ? true_value() : false_value(); | 2526 return value ? true_value() : false_value(); |
| 2527 } | 2527 } |
| 2528 | 2528 |
| 2529 | 2529 |
| 2530 } } // namespace v8::internal | 2530 } } // namespace v8::internal |
| OLD | NEW |