Lines Matching defs:String
232 Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
233 Utf8StringKey key(string, isolate()->heap()->HashSeed());
238 Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
239 OneByteStringKey key(string, isolate()->heap()->HashSeed());
244 Handle<String> Factory::InternalizeOneByteString(
245 Handle<SeqOneByteString> string, int from, int length) {
246 SeqOneByteSubStringKey key(string, from, length);
251 Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) {
252 TwoByteStringKey key(string, isolate()->heap()->HashSeed());
258 Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) {
263 MaybeHandle<String> Factory::NewStringFromOneByte(Vector<const uint8_t> string,
265 int length = string.length();
266 if (length == 1) return LookupSingleCharacterStringFromCode(string[0]);
271 NewRawOneByteString(string.length(), pretenure),
272 String);
277 string.start(),
282 MaybeHandle<String> Factory::NewStringFromUtf8(Vector<const char> string,
285 const char* start = string.start();
286 int length = string.length();
287 int non_ascii_start = String::NonAsciiStart(start, length);
289 // If the string is ASCII, we do not need to convert the characters
291 return NewStringFromOneByte(Vector<const uint8_t>::cast(string), pretenure);
297 decoder->Reset(string.start() + non_ascii_start,
301 // Allocate string.
306 String);
309 const char* ascii_data = string.start();
318 MaybeHandle<String> Factory::NewStringFromUtf8SubString(
323 int non_ascii_start = String::NonAsciiStart(start, length);
325 // If the string is ASCII, we can just make a substring.
336 // Allocate string.
340 NewRawTwoByteString(non_ascii_start + utf16_length, pretenure), String);
356 MaybeHandle<String> Factory::NewStringFromTwoByte(const uc16* string,
359 if (String::IsOneByte(string, length)) {
360 if (length == 1) return LookupSingleCharacterStringFromCode(string[0]);
366 String);
367 CopyChars(result->GetChars(), string, length);
375 String);
376 CopyChars(result->GetChars(), string, length);
381 MaybeHandle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string,
383 return NewStringFromTwoByte(string.start(), string.length(), pretenure);
386 MaybeHandle<String> Factory::NewStringFromTwoByte(
387 const ZoneVector<uc16>* string, PretenureFlag pretenure) {
388 return NewStringFromTwoByte(string->data(), static_cast<int>(string->size()),
392 Handle<String> Factory::NewInternalizedStringFromUtf8(Vector<const char> str,
399 String);
403 MUST_USE_RESULT Handle<String> Factory::NewOneByteInternalizedString(
409 String);
413 MUST_USE_RESULT Handle<String> Factory::NewOneByteInternalizedSubString(
414 Handle<SeqOneByteString> string, int offset, int length,
418 Vector<const uint8_t>(string->GetChars() + offset, length),
420 String);
424 MUST_USE_RESULT Handle<String> Factory::NewTwoByteInternalizedString(
430 String);
434 Handle<String> Factory::NewInternalizedStringImpl(
435 Handle<String> string, int chars, uint32_t hash_field) {
439 *string, chars, hash_field),
440 String);
445 Handle<String> string) {
446 // If the string is in new space it cannot be used as internalized.
447 if (isolate()->heap()->InNewSpace(*string)) return MaybeHandle<Map>();
449 // Find the corresponding internalized string map for strings.
450 switch (string->map()->instance_type()) {
472 if (length > String::kMaxLength || length < 0) {
484 if (length > String::kMaxLength || length < 0) {
494 Handle<String> Factory::LookupSingleCharacterStringFromCode(uint32_t code) {
495 if (code <= String::kMaxOneByteCharCodeU) {
500 return handle(String::cast(value), isolate());
505 Handle<String> result =
510 DCHECK(code <= String::kMaxUtf16CodeUnitU);
525 static inline Handle<String> MakeOrFindTwoCharacterString(Isolate* isolate,
531 Handle<String> result;
539 // when building the new string.
540 if (static_cast<unsigned>(c1 | c2) <= String::kMaxOneByteCharCodeU) {
542 DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU +
562 Handle<String> ConcatStringContent(Handle<StringType> result,
563 Handle<String> first,
564 Handle<String> second) {
567 String::WriteToFlat(*first, sink, 0, first->length());
568 String::WriteToFlat(*second, sink + first->length(), 0, second->length());
573 MaybeHandle<String> Factory::NewConsString(Handle<String> left,
574 Handle<String> right) {
589 // of the new cons string is too large.
590 if (length > String::kMaxLength || length < 0) {
591 THROW_NEW_ERROR(isolate(), NewInvalidStringLengthError(), String);
609 // If the resulting string is small make a flat string.
616 STATIC_ASSERT(ConsString::kMinLength <= String::kMaxLength);
651 result->set_hash_field(String::kEmptyHashField);
658 Handle<String> Factory::NewSurrogatePairString(uint16_t lead, uint16_t trail) {
672 Handle<String> Factory::NewProperSubString(Handle<String> str,
680 str = String::Flatten(str);
689 // dictionary. Check whether we already have the string in the string
702 String::WriteToFlat(*str, dest, begin, end);
709 String::WriteToFlat(*str, dest, begin, end);
718 str = Handle<String>(slice->parent(), isolate());
728 slice->set_hash_field(String::kEmptyHashField);
736 MaybeHandle<String> Factory::NewExternalStringFromOneByte(
739 if (length > static_cast<size_t>(String::kMaxLength)) {
740 THROW_NEW_ERROR(isolate(), NewInvalidStringLengthError(), String);
753 external_string->set_hash_field(String::kEmptyHashField);
760 MaybeHandle<String> Factory::NewExternalStringFromTwoByte(
763 if (length > static_cast<size_t>(String::kMaxLength)) {
764 THROW_NEW_ERROR(isolate(), NewInvalidStringLengthError(), String);
768 // one byte characters. If yes, we use a different string map.
771 String::IsOneByte(resource->data(), static_cast<int>(length));
784 external_string->set_hash_field(String::kEmptyHashField);
793 DCHECK_LE(length, static_cast<size_t>(String::kMaxLength));
799 external_string->set_hash_field(String::kEmptyHashField);
805 Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
808 Handle<String> flat_string = String::Flatten(string);
906 Handle<String> name,
1041 Handle<Script> Factory::NewScript(Handle<String> source) {
1320 Handle<String> message) {
1338 // Invalidate the "string length" protector.
1385 Handle<String> name,
1406 Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
1412 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
1422 Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
1433 Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
1459 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
2252 Handle<String> name, int number_of_literals, FunctionKind kind,
2288 Handle<String> name, MaybeHandle<Code> maybe_code, bool is_constructor) {
2291 name = String::Flatten(name, TENURED);
2365 return Handle<String>(
2366 String::cast(number_string_cache()->get(hash * 2 + 1)), isolate());
2373 Handle<String> string) {
2384 number_string_cache()->set(hash * 2 + 1, *string);
2388 Handle<String> Factory::NumberToString(Handle<Object> number,
2393 if (!cached->IsUndefined(isolate())) return Handle<String>::cast(cached);
2407 // We tenure the allocated string since it is referenced from the
2408 // number-string cache which lives in the old space.
2409 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED);
2520 Handle<String> source,
2535 Handle<String> source,
2584 Handle<String> Factory::ToPrimitiveHintString(ToPrimitiveHint hint) {
2594 return Handle<String>::null();