| 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 "macro-assembler.h" | 7 #include "macro-assembler.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "v8conversions.h" | 9 #include "v8conversions.h" |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { | 83 Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) { |
| 84 CALL_HEAP_FUNCTION( | 84 CALL_HEAP_FUNCTION( |
| 85 isolate(), | 85 isolate(), |
| 86 isolate()->heap()->AllocateUninitializedFixedArray(size), | 86 isolate()->heap()->AllocateUninitializedFixedArray(size), |
| 87 FixedArray); | 87 FixedArray); |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, | 91 Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size, |
| 92 PretenureFlag pretenure) { | 92 PretenureFlag pretenure) { |
| 93 ASSERT(0 <= size); | 93 ASSERT(0 <= size); |
| 94 CALL_HEAP_FUNCTION( | 94 CALL_HEAP_FUNCTION( |
| 95 isolate(), | 95 isolate(), |
| 96 isolate()->heap()->AllocateUninitializedFixedDoubleArray(size, pretenure), | 96 isolate()->heap()->AllocateUninitializedFixedDoubleArray(size, pretenure), |
| 97 FixedArrayBase); | 97 FixedArrayBase); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles( | 101 Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles( |
| 102 int size, | 102 int size, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 MUST_USE_RESULT Handle<String> Factory::NewTwoByteInternalizedString( | 304 MUST_USE_RESULT Handle<String> Factory::NewTwoByteInternalizedString( |
| 305 Vector<const uc16> str, | 305 Vector<const uc16> str, |
| 306 uint32_t hash_field) { | 306 uint32_t hash_field) { |
| 307 CALL_HEAP_FUNCTION( | 307 CALL_HEAP_FUNCTION( |
| 308 isolate(), | 308 isolate(), |
| 309 isolate()->heap()->AllocateTwoByteInternalizedString(str, hash_field), | 309 isolate()->heap()->AllocateTwoByteInternalizedString(str, hash_field), |
| 310 String); | 310 String); |
| 311 } | 311 } |
| 312 | 312 |
| 313 | 313 |
| 314 template<typename T> | |
| 315 Handle<String> Factory::NewInternalizedStringImpl( | 314 Handle<String> Factory::NewInternalizedStringImpl( |
| 316 T t, int chars, uint32_t hash_field) { | 315 Handle<String> string, int chars, uint32_t hash_field) { |
| 317 CALL_HEAP_FUNCTION( | 316 CALL_HEAP_FUNCTION( |
| 318 isolate(), | 317 isolate(), |
| 319 isolate()->heap()->AllocateInternalizedStringImpl(t, chars, hash_field), | 318 isolate()->heap()->AllocateInternalizedStringImpl( |
| 319 *string, chars, hash_field), |
| 320 String); | 320 String); |
| 321 } | 321 } |
| 322 | 322 |
| 323 template | |
| 324 Handle<String> Factory::NewInternalizedStringImpl(String*, int, uint32_t); | |
| 325 | |
| 326 | 323 |
| 327 MaybeHandle<Map> Factory::InternalizedStringMapForString( | 324 MaybeHandle<Map> Factory::InternalizedStringMapForString( |
| 328 Handle<String> string) { | 325 Handle<String> string) { |
| 329 // If the string is in new space it cannot be used as internalized. | 326 // If the string is in new space it cannot be used as internalized. |
| 330 if (isolate()->heap()->InNewSpace(*string)) return MaybeHandle<Map>(); | 327 if (isolate()->heap()->InNewSpace(*string)) return MaybeHandle<Map>(); |
| 331 | 328 |
| 332 // Find the corresponding internalized string map for strings. | 329 // Find the corresponding internalized string map for strings. |
| 333 switch (string->map()->instance_type()) { | 330 switch (string->map()->instance_type()) { |
| 334 case STRING_TYPE: return internalized_string_map(); | 331 case STRING_TYPE: return internalized_string_map(); |
| 335 case ASCII_STRING_TYPE: return ascii_internalized_string_map(); | 332 case ASCII_STRING_TYPE: return ascii_internalized_string_map(); |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2331 return Handle<Object>::null(); | 2328 return Handle<Object>::null(); |
| 2332 } | 2329 } |
| 2333 | 2330 |
| 2334 | 2331 |
| 2335 Handle<Object> Factory::ToBoolean(bool value) { | 2332 Handle<Object> Factory::ToBoolean(bool value) { |
| 2336 return value ? true_value() : false_value(); | 2333 return value ? true_value() : false_value(); |
| 2337 } | 2334 } |
| 2338 | 2335 |
| 2339 | 2336 |
| 2340 } } // namespace v8::internal | 2337 } } // namespace v8::internal |
| OLD | NEW |