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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 int num = Handle<Smi>::cast(number)->value(); | 2222 int num = Handle<Smi>::cast(number)->value(); |
2223 str = IntToCString(num, buffer); | 2223 str = IntToCString(num, buffer); |
2224 } else { | 2224 } else { |
2225 double num = Handle<HeapNumber>::cast(number)->value(); | 2225 double num = Handle<HeapNumber>::cast(number)->value(); |
2226 str = DoubleToCString(num, buffer); | 2226 str = DoubleToCString(num, buffer); |
2227 } | 2227 } |
2228 | 2228 |
2229 // We tenure the allocated string since it is referenced from the | 2229 // We tenure the allocated string since it is referenced from the |
2230 // number-string cache which lives in the old space. | 2230 // number-string cache which lives in the old space. |
2231 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); | 2231 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); |
2232 // Make sure the string cached in the number cache is also the internalized | |
2233 // version of the same string. | |
2234 js_string = InternalizeString(js_string); | |
2235 SetNumberStringCache(number, js_string); | 2232 SetNumberStringCache(number, js_string); |
2236 return js_string; | 2233 return js_string; |
2237 } | 2234 } |
2238 | 2235 |
2239 | 2236 |
2240 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { | 2237 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
2241 // Allocate initial fixed array for active break points before allocating the | 2238 // Allocate initial fixed array for active break points before allocating the |
2242 // debug info object to avoid allocation while setting up the debug info | 2239 // debug info object to avoid allocation while setting up the debug info |
2243 // object. | 2240 // object. |
2244 Handle<FixedArray> break_points( | 2241 Handle<FixedArray> break_points( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 } | 2388 } |
2392 | 2389 |
2393 | 2390 |
2394 Handle<Object> Factory::ToBoolean(bool value) { | 2391 Handle<Object> Factory::ToBoolean(bool value) { |
2395 return value ? true_value() : false_value(); | 2392 return value ? true_value() : false_value(); |
2396 } | 2393 } |
2397 | 2394 |
2398 | 2395 |
2399 } // namespace internal | 2396 } // namespace internal |
2400 } // namespace v8 | 2397 } // namespace v8 |
OLD | NEW |