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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 Handle<String> string) { | 1926 Handle<String> string) { |
1927 int hash = NumberCacheHash(number_string_cache(), number); | 1927 int hash = NumberCacheHash(number_string_cache(), number); |
1928 if (number_string_cache()->get(hash * 2) != *undefined_value()) { | 1928 if (number_string_cache()->get(hash * 2) != *undefined_value()) { |
1929 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); | 1929 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); |
1930 if (number_string_cache()->length() != full_size) { | 1930 if (number_string_cache()->length() != full_size) { |
1931 // The first time we have a hash collision, we move to the full sized | 1931 // The first time we have a hash collision, we move to the full sized |
1932 // number string cache. The idea is to have a small number string | 1932 // number string cache. The idea is to have a small number string |
1933 // cache in the snapshot to keep boot-time memory usage down. | 1933 // cache in the snapshot to keep boot-time memory usage down. |
1934 // If we expand the number string cache already while creating | 1934 // If we expand the number string cache already while creating |
1935 // the snapshot then that didn't work out. | 1935 // the snapshot then that didn't work out. |
1936 ASSERT(!Serializer::enabled() || FLAG_extra_code != NULL); | 1936 ASSERT(!Serializer::enabled(isolate()) || FLAG_extra_code != NULL); |
1937 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); | 1937 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); |
1938 isolate()->heap()->set_number_string_cache(*new_cache); | 1938 isolate()->heap()->set_number_string_cache(*new_cache); |
1939 return; | 1939 return; |
1940 } | 1940 } |
1941 } | 1941 } |
1942 number_string_cache()->set(hash * 2, *number); | 1942 number_string_cache()->set(hash * 2, *number); |
1943 number_string_cache()->set(hash * 2 + 1, *string); | 1943 number_string_cache()->set(hash * 2 + 1, *string); |
1944 } | 1944 } |
1945 | 1945 |
1946 | 1946 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 return Handle<Object>::null(); | 2332 return Handle<Object>::null(); |
2333 } | 2333 } |
2334 | 2334 |
2335 | 2335 |
2336 Handle<Object> Factory::ToBoolean(bool value) { | 2336 Handle<Object> Factory::ToBoolean(bool value) { |
2337 return value ? true_value() : false_value(); | 2337 return value ? true_value() : false_value(); |
2338 } | 2338 } |
2339 | 2339 |
2340 | 2340 |
2341 } } // namespace v8::internal | 2341 } } // namespace v8::internal |
OLD | NEW |