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 "factory.h" | 5 #include "factory.h" |
6 | 6 |
7 #include "conversions.h" | 7 #include "conversions.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 | 10 |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 Handle<String> string) { | 1931 Handle<String> string) { |
1932 int hash = NumberCacheHash(number_string_cache(), number); | 1932 int hash = NumberCacheHash(number_string_cache(), number); |
1933 if (number_string_cache()->get(hash * 2) != *undefined_value()) { | 1933 if (number_string_cache()->get(hash * 2) != *undefined_value()) { |
1934 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); | 1934 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); |
1935 if (number_string_cache()->length() != full_size) { | 1935 if (number_string_cache()->length() != full_size) { |
1936 // The first time we have a hash collision, we move to the full sized | 1936 // The first time we have a hash collision, we move to the full sized |
1937 // number string cache. The idea is to have a small number string | 1937 // number string cache. The idea is to have a small number string |
1938 // cache in the snapshot to keep boot-time memory usage down. | 1938 // cache in the snapshot to keep boot-time memory usage down. |
1939 // If we expand the number string cache already while creating | 1939 // If we expand the number string cache already while creating |
1940 // the snapshot then that didn't work out. | 1940 // the snapshot then that didn't work out. |
1941 ASSERT(!Serializer::enabled() || FLAG_extra_code != NULL); | 1941 ASSERT(!Serializer::enabled(isolate()) || FLAG_extra_code != NULL); |
1942 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); | 1942 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); |
1943 isolate()->heap()->set_number_string_cache(*new_cache); | 1943 isolate()->heap()->set_number_string_cache(*new_cache); |
1944 return; | 1944 return; |
1945 } | 1945 } |
1946 } | 1946 } |
1947 number_string_cache()->set(hash * 2, *number); | 1947 number_string_cache()->set(hash * 2, *number); |
1948 number_string_cache()->set(hash * 2 + 1, *string); | 1948 number_string_cache()->set(hash * 2 + 1, *string); |
1949 } | 1949 } |
1950 | 1950 |
1951 | 1951 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 return Handle<Object>::null(); | 2328 return Handle<Object>::null(); |
2329 } | 2329 } |
2330 | 2330 |
2331 | 2331 |
2332 Handle<Object> Factory::ToBoolean(bool value) { | 2332 Handle<Object> Factory::ToBoolean(bool value) { |
2333 return value ? true_value() : false_value(); | 2333 return value ? true_value() : false_value(); |
2334 } | 2334 } |
2335 | 2335 |
2336 | 2336 |
2337 } } // namespace v8::internal | 2337 } } // namespace v8::internal |
OLD | NEW |