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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 return InternalizeStringWithKey(&key); | 237 return InternalizeStringWithKey(&key); |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 template<class StringTableKey> | 241 template<class StringTableKey> |
242 Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) { | 242 Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) { |
243 return StringTable::LookupKey(isolate(), key); | 243 return StringTable::LookupKey(isolate(), key); |
244 } | 244 } |
245 | 245 |
246 | 246 |
| 247 Handle<Name> Factory::InternalizeName(Handle<Name> name) { |
| 248 if (name->IsUniqueName()) return name; |
| 249 return InternalizeString(Handle<String>::cast(name)); |
| 250 } |
| 251 |
| 252 |
247 MaybeHandle<String> Factory::NewStringFromOneByte(Vector<const uint8_t> string, | 253 MaybeHandle<String> Factory::NewStringFromOneByte(Vector<const uint8_t> string, |
248 PretenureFlag pretenure) { | 254 PretenureFlag pretenure) { |
249 int length = string.length(); | 255 int length = string.length(); |
250 if (length == 1) return LookupSingleCharacterStringFromCode(string[0]); | 256 if (length == 1) return LookupSingleCharacterStringFromCode(string[0]); |
251 Handle<SeqOneByteString> result; | 257 Handle<SeqOneByteString> result; |
252 ASSIGN_RETURN_ON_EXCEPTION( | 258 ASSIGN_RETURN_ON_EXCEPTION( |
253 isolate(), | 259 isolate(), |
254 result, | 260 result, |
255 NewRawOneByteString(string.length(), pretenure), | 261 NewRawOneByteString(string.length(), pretenure), |
256 String); | 262 String); |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2390 } |
2385 | 2391 |
2386 | 2392 |
2387 Handle<Object> Factory::ToBoolean(bool value) { | 2393 Handle<Object> Factory::ToBoolean(bool value) { |
2388 return value ? true_value() : false_value(); | 2394 return value ? true_value() : false_value(); |
2389 } | 2395 } |
2390 | 2396 |
2391 | 2397 |
2392 } // namespace internal | 2398 } // namespace internal |
2393 } // namespace v8 | 2399 } // namespace v8 |
OLD | NEW |