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 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 Handle<String> string) { | 1983 Handle<String> string) { |
1984 int hash = NumberCacheHash(number_string_cache(), number); | 1984 int hash = NumberCacheHash(number_string_cache(), number); |
1985 if (number_string_cache()->get(hash * 2) != *undefined_value()) { | 1985 if (number_string_cache()->get(hash * 2) != *undefined_value()) { |
1986 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); | 1986 int full_size = isolate()->heap()->FullSizeNumberStringCacheLength(); |
1987 if (number_string_cache()->length() != full_size) { | 1987 if (number_string_cache()->length() != full_size) { |
1988 // The first time we have a hash collision, we move to the full sized | 1988 // The first time we have a hash collision, we move to the full sized |
1989 // number string cache. The idea is to have a small number string | 1989 // number string cache. The idea is to have a small number string |
1990 // cache in the snapshot to keep boot-time memory usage down. | 1990 // cache in the snapshot to keep boot-time memory usage down. |
1991 // If we expand the number string cache already while creating | 1991 // If we expand the number string cache already while creating |
1992 // the snapshot then that didn't work out. | 1992 // the snapshot then that didn't work out. |
1993 ASSERT(!Serializer::enabled(isolate()) || FLAG_extra_code != NULL); | 1993 ASSERT(!isolate()->serializer_enabled() || FLAG_extra_code != NULL); |
1994 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); | 1994 Handle<FixedArray> new_cache = NewFixedArray(full_size, TENURED); |
1995 isolate()->heap()->set_number_string_cache(*new_cache); | 1995 isolate()->heap()->set_number_string_cache(*new_cache); |
1996 return; | 1996 return; |
1997 } | 1997 } |
1998 } | 1998 } |
1999 number_string_cache()->set(hash * 2, *number); | 1999 number_string_cache()->set(hash * 2, *number); |
2000 number_string_cache()->set(hash * 2 + 1, *string); | 2000 number_string_cache()->set(hash * 2 + 1, *string); |
2001 } | 2001 } |
2002 | 2002 |
2003 | 2003 |
(...skipping 328 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 |