OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 ZoneList<ReplacementPart> parts_; | 2658 ZoneList<ReplacementPart> parts_; |
2659 ZoneList<Handle<String> > replacement_substrings_; | 2659 ZoneList<Handle<String> > replacement_substrings_; |
2660 }; | 2660 }; |
2661 | 2661 |
2662 | 2662 |
2663 void CompiledReplacement::Compile(Handle<String> replacement, | 2663 void CompiledReplacement::Compile(Handle<String> replacement, |
2664 int capture_count, | 2664 int capture_count, |
2665 int subject_length) { | 2665 int subject_length) { |
2666 { | 2666 { |
2667 AssertNoAllocation no_alloc; | 2667 AssertNoAllocation no_alloc; |
2668 String::FlatContent content = replacement->GetFlatContent(no_alloc); | 2668 String::FlatContent content = replacement->GetFlatContent(); |
2669 ASSERT(content.IsFlat()); | 2669 ASSERT(content.IsFlat()); |
2670 if (content.IsAscii()) { | 2670 if (content.IsAscii()) { |
2671 ParseReplacementPattern(&parts_, | 2671 ParseReplacementPattern(&parts_, |
2672 content.ToAsciiVector(), | 2672 content.ToAsciiVector(), |
2673 capture_count, | 2673 capture_count, |
2674 subject_length); | 2674 subject_length); |
2675 } else { | 2675 } else { |
2676 ASSERT(content.IsTwoByte()); | 2676 ASSERT(content.IsTwoByte()); |
2677 ParseReplacementPattern(&parts_, | 2677 ParseReplacementPattern(&parts_, |
2678 content.ToUC16Vector(), | 2678 content.ToUC16Vector(), |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 if (pattern_length == 0) return start_index; | 3043 if (pattern_length == 0) return start_index; |
3044 | 3044 |
3045 int subject_length = sub->length(); | 3045 int subject_length = sub->length(); |
3046 if (start_index + pattern_length > subject_length) return -1; | 3046 if (start_index + pattern_length > subject_length) return -1; |
3047 | 3047 |
3048 if (!sub->IsFlat()) FlattenString(sub); | 3048 if (!sub->IsFlat()) FlattenString(sub); |
3049 if (!pat->IsFlat()) FlattenString(pat); | 3049 if (!pat->IsFlat()) FlattenString(pat); |
3050 | 3050 |
3051 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid | 3051 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid |
3052 // Extract flattened substrings of cons strings before determining asciiness. | 3052 // Extract flattened substrings of cons strings before determining asciiness. |
3053 String::FlatContent seq_sub = sub->GetFlatContent(no_heap_allocation); | 3053 String::FlatContent seq_sub = sub->GetFlatContent(); |
3054 String::FlatContent seq_pat = pat->GetFlatContent(no_heap_allocation); | 3054 String::FlatContent seq_pat = pat->GetFlatContent(); |
3055 | 3055 |
3056 // dispatch on type of strings | 3056 // dispatch on type of strings |
3057 if (seq_pat.IsAscii()) { | 3057 if (seq_pat.IsAscii()) { |
3058 Vector<const char> pat_vector = seq_pat.ToAsciiVector(); | 3058 Vector<const char> pat_vector = seq_pat.ToAsciiVector(); |
3059 if (seq_sub.IsAscii()) { | 3059 if (seq_sub.IsAscii()) { |
3060 return SearchString(isolate, | 3060 return SearchString(isolate, |
3061 seq_sub.ToAsciiVector(), | 3061 seq_sub.ToAsciiVector(), |
3062 pat_vector, | 3062 pat_vector, |
3063 start_index); | 3063 start_index); |
3064 } | 3064 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3154 if (pat_length == 0) { | 3154 if (pat_length == 0) { |
3155 return Smi::FromInt(start_index); | 3155 return Smi::FromInt(start_index); |
3156 } | 3156 } |
3157 | 3157 |
3158 if (!sub->IsFlat()) FlattenString(sub); | 3158 if (!sub->IsFlat()) FlattenString(sub); |
3159 if (!pat->IsFlat()) FlattenString(pat); | 3159 if (!pat->IsFlat()) FlattenString(pat); |
3160 | 3160 |
3161 int position = -1; | 3161 int position = -1; |
3162 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid | 3162 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid |
3163 | 3163 |
3164 String::FlatContent sub_content = sub->GetFlatContent(no_heap_allocation); | 3164 String::FlatContent sub_content = sub->GetFlatContent(); |
3165 String::FlatContent pat_content = pat->GetFlatContent(no_heap_allocation); | 3165 String::FlatContent pat_content = pat->GetFlatContent(); |
3166 | 3166 |
3167 if (pat_content.IsAscii()) { | 3167 if (pat_content.IsAscii()) { |
3168 Vector<const char> pat_vector = pat_content.ToAsciiVector(); | 3168 Vector<const char> pat_vector = pat_content.ToAsciiVector(); |
3169 if (sub_content.IsAscii()) { | 3169 if (sub_content.IsAscii()) { |
3170 position = StringMatchBackwards(sub_content.ToAsciiVector(), | 3170 position = StringMatchBackwards(sub_content.ToAsciiVector(), |
3171 pat_vector, | 3171 pat_vector, |
3172 start_index); | 3172 start_index); |
3173 } else { | 3173 } else { |
3174 position = StringMatchBackwards(sub_content.ToUC16Vector(), | 3174 position = StringMatchBackwards(sub_content.ToUC16Vector(), |
3175 pat_vector, | 3175 pat_vector, |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 FixedArrayBuilder* builder) { | 3393 FixedArrayBuilder* builder) { |
3394 ASSERT(subject->IsFlat()); | 3394 ASSERT(subject->IsFlat()); |
3395 ASSERT(pattern->IsFlat()); | 3395 ASSERT(pattern->IsFlat()); |
3396 | 3396 |
3397 // Treating as if a previous match was before first character. | 3397 // Treating as if a previous match was before first character. |
3398 int match_pos = -pattern->length(); | 3398 int match_pos = -pattern->length(); |
3399 | 3399 |
3400 for (;;) { // Break when search complete. | 3400 for (;;) { // Break when search complete. |
3401 builder->EnsureCapacity(kMaxBuilderEntriesPerRegExpMatch); | 3401 builder->EnsureCapacity(kMaxBuilderEntriesPerRegExpMatch); |
3402 AssertNoAllocation no_gc; | 3402 AssertNoAllocation no_gc; |
3403 String::FlatContent subject_content = subject->GetFlatContent(no_gc); | 3403 String::FlatContent subject_content = subject->GetFlatContent(); |
3404 String::FlatContent pattern_content = pattern->GetFlatContent(no_gc); | 3404 String::FlatContent pattern_content = pattern->GetFlatContent(); |
3405 if (subject_content.IsAscii()) { | 3405 if (subject_content.IsAscii()) { |
3406 Vector<const char> subject_vector = subject_content.ToAsciiVector(); | 3406 Vector<const char> subject_vector = subject_content.ToAsciiVector(); |
3407 if (pattern_content.IsAscii()) { | 3407 if (pattern_content.IsAscii()) { |
3408 if (SearchStringMultiple(isolate, | 3408 if (SearchStringMultiple(isolate, |
3409 subject_vector, | 3409 subject_vector, |
3410 pattern_content.ToAsciiVector(), | 3410 pattern_content.ToAsciiVector(), |
3411 *pattern, | 3411 *pattern, |
3412 builder, | 3412 builder, |
3413 &match_pos)) break; | 3413 &match_pos)) break; |
3414 } else { | 3414 } else { |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5412 CONVERT_CHECKED(String, str, args[0]); | 5412 CONVERT_CHECKED(String, str, args[0]); |
5413 if (!str->IsFlat()) { | 5413 if (!str->IsFlat()) { |
5414 MaybeObject* try_flatten = str->TryFlatten(); | 5414 MaybeObject* try_flatten = str->TryFlatten(); |
5415 Object* flat; | 5415 Object* flat; |
5416 if (!try_flatten->ToObject(&flat)) { | 5416 if (!try_flatten->ToObject(&flat)) { |
5417 return try_flatten; | 5417 return try_flatten; |
5418 } | 5418 } |
5419 str = String::cast(flat); | 5419 str = String::cast(flat); |
5420 ASSERT(str->IsFlat()); | 5420 ASSERT(str->IsFlat()); |
5421 } | 5421 } |
5422 AssertNoAllocation no_alloc; | 5422 String::FlatContent flat = str->GetFlatContent(); |
5423 String::FlatContent flat = str->GetFlatContent(no_alloc); | |
5424 ASSERT(flat.IsFlat()); | 5423 ASSERT(flat.IsFlat()); |
5425 if (flat.IsTwoByte()) { | 5424 if (flat.IsTwoByte()) { |
5426 return QuoteJsonString<uc16, SeqTwoByteString, false>(isolate, | 5425 return QuoteJsonString<uc16, SeqTwoByteString, false>(isolate, |
5427 flat.ToUC16Vector()); | 5426 flat.ToUC16Vector()); |
5428 } else { | 5427 } else { |
5429 return QuoteJsonString<char, SeqAsciiString, false>(isolate, | 5428 return QuoteJsonString<char, SeqAsciiString, false>(isolate, |
5430 flat.ToAsciiVector()); | 5429 flat.ToAsciiVector()); |
5431 } | 5430 } |
5432 } | 5431 } |
5433 | 5432 |
5434 | 5433 |
5435 RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringComma) { | 5434 RUNTIME_FUNCTION(MaybeObject*, Runtime_QuoteJSONStringComma) { |
5436 NoHandleAllocation ha; | 5435 NoHandleAllocation ha; |
5437 CONVERT_CHECKED(String, str, args[0]); | 5436 CONVERT_CHECKED(String, str, args[0]); |
5438 if (!str->IsFlat()) { | 5437 if (!str->IsFlat()) { |
5439 MaybeObject* try_flatten = str->TryFlatten(); | 5438 MaybeObject* try_flatten = str->TryFlatten(); |
5440 Object* flat; | 5439 Object* flat; |
5441 if (!try_flatten->ToObject(&flat)) { | 5440 if (!try_flatten->ToObject(&flat)) { |
5442 return try_flatten; | 5441 return try_flatten; |
5443 } | 5442 } |
5444 str = String::cast(flat); | 5443 str = String::cast(flat); |
5445 ASSERT(str->IsFlat()); | 5444 ASSERT(str->IsFlat()); |
5446 } | 5445 } |
5447 AssertNoAllocation no_alloc; | 5446 String::FlatContent flat = str->GetFlatContent(); |
5448 String::FlatContent flat = str->GetFlatContent(no_alloc); | |
5449 if (flat.IsTwoByte()) { | 5447 if (flat.IsTwoByte()) { |
5450 return QuoteJsonString<uc16, SeqTwoByteString, true>(isolate, | 5448 return QuoteJsonString<uc16, SeqTwoByteString, true>(isolate, |
5451 flat.ToUC16Vector()); | 5449 flat.ToUC16Vector()); |
5452 } else { | 5450 } else { |
5453 return QuoteJsonString<char, SeqAsciiString, true>(isolate, | 5451 return QuoteJsonString<char, SeqAsciiString, true>(isolate, |
5454 flat.ToAsciiVector()); | 5452 flat.ToAsciiVector()); |
5455 } | 5453 } |
5456 } | 5454 } |
5457 | 5455 |
5458 | 5456 |
(...skipping 20 matching lines...) Expand all Loading... |
5479 StringType* new_string = StringType::cast(new_object); | 5477 StringType* new_string = StringType::cast(new_object); |
5480 ASSERT(isolate->heap()->new_space()->Contains(new_string)); | 5478 ASSERT(isolate->heap()->new_space()->Contains(new_string)); |
5481 | 5479 |
5482 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); | 5480 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); |
5483 Char* write_cursor = reinterpret_cast<Char*>( | 5481 Char* write_cursor = reinterpret_cast<Char*>( |
5484 new_string->address() + SeqAsciiString::kHeaderSize); | 5482 new_string->address() + SeqAsciiString::kHeaderSize); |
5485 *(write_cursor++) = '['; | 5483 *(write_cursor++) = '['; |
5486 for (int i = 0; i < length; i++) { | 5484 for (int i = 0; i < length; i++) { |
5487 if (i != 0) *(write_cursor++) = ','; | 5485 if (i != 0) *(write_cursor++) = ','; |
5488 String* str = String::cast(array->get(i)); | 5486 String* str = String::cast(array->get(i)); |
5489 String::FlatContent content = str->GetFlatContent(no_gc); | 5487 String::FlatContent content = str->GetFlatContent(); |
5490 ASSERT(content.IsFlat()); | 5488 ASSERT(content.IsFlat()); |
5491 if (content.IsTwoByte()) { | 5489 if (content.IsTwoByte()) { |
5492 write_cursor = WriteQuoteJsonString<Char, uc16>(isolate, | 5490 write_cursor = WriteQuoteJsonString<Char, uc16>(isolate, |
5493 write_cursor, | 5491 write_cursor, |
5494 content.ToUC16Vector()); | 5492 content.ToUC16Vector()); |
5495 } else { | 5493 } else { |
5496 write_cursor = WriteQuoteJsonString<Char, char>(isolate, | 5494 write_cursor = WriteQuoteJsonString<Char, char>(isolate, |
5497 write_cursor, | 5495 write_cursor, |
5498 content.ToAsciiVector()); | 5496 content.ToAsciiVector()); |
5499 } | 5497 } |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 | 5965 |
5968 ZoneScope scope(isolate, DELETE_ON_EXIT); | 5966 ZoneScope scope(isolate, DELETE_ON_EXIT); |
5969 | 5967 |
5970 // Find (up to limit) indices of separator and end-of-string in subject | 5968 // Find (up to limit) indices of separator and end-of-string in subject |
5971 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit); | 5969 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit); |
5972 ZoneList<int> indices(initial_capacity); | 5970 ZoneList<int> indices(initial_capacity); |
5973 if (!pattern->IsFlat()) FlattenString(pattern); | 5971 if (!pattern->IsFlat()) FlattenString(pattern); |
5974 | 5972 |
5975 // No allocation block. | 5973 // No allocation block. |
5976 { | 5974 { |
5977 AssertNoAllocation no_gc; | 5975 AssertNoAllocation nogc; |
5978 String::FlatContent subject_content = subject->GetFlatContent(no_gc); | 5976 String::FlatContent subject_content = subject->GetFlatContent(); |
5979 String::FlatContent pattern_content = pattern->GetFlatContent(no_gc); | 5977 String::FlatContent pattern_content = pattern->GetFlatContent(); |
5980 ASSERT(subject_content.IsFlat()); | 5978 ASSERT(subject_content.IsFlat()); |
5981 ASSERT(pattern_content.IsFlat()); | 5979 ASSERT(pattern_content.IsFlat()); |
5982 if (subject_content.IsAscii()) { | 5980 if (subject_content.IsAscii()) { |
5983 Vector<const char> subject_vector = subject_content.ToAsciiVector(); | 5981 Vector<const char> subject_vector = subject_content.ToAsciiVector(); |
5984 if (pattern_content.IsAscii()) { | 5982 if (pattern_content.IsAscii()) { |
5985 Vector<const char> pattern_vector = pattern_content.ToAsciiVector(); | 5983 Vector<const char> pattern_vector = pattern_content.ToAsciiVector(); |
5986 if (pattern_vector.length() == 1) { | 5984 if (pattern_vector.length() == 1) { |
5987 FindAsciiStringIndices(subject_vector, | 5985 FindAsciiStringIndices(subject_vector, |
5988 pattern_vector[0], | 5986 pattern_vector[0], |
5989 &indices, | 5987 &indices, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6100 | 6098 |
6101 Handle<FixedArray> elements; | 6099 Handle<FixedArray> elements; |
6102 int position = 0; | 6100 int position = 0; |
6103 if (s->IsFlat() && s->IsAsciiRepresentation()) { | 6101 if (s->IsFlat() && s->IsAsciiRepresentation()) { |
6104 // Try using cached chars where possible. | 6102 // Try using cached chars where possible. |
6105 Object* obj; | 6103 Object* obj; |
6106 { MaybeObject* maybe_obj = | 6104 { MaybeObject* maybe_obj = |
6107 isolate->heap()->AllocateUninitializedFixedArray(length); | 6105 isolate->heap()->AllocateUninitializedFixedArray(length); |
6108 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 6106 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
6109 } | 6107 } |
6110 AssertNoAllocation no_alloc; | |
6111 elements = Handle<FixedArray>(FixedArray::cast(obj), isolate); | 6108 elements = Handle<FixedArray>(FixedArray::cast(obj), isolate); |
6112 String::FlatContent content = s->GetFlatContent(no_alloc); | 6109 String::FlatContent content = s->GetFlatContent(); |
6113 if (content.IsAscii()) { | 6110 if (content.IsAscii()) { |
6114 Vector<const char> chars = content.ToAsciiVector(); | 6111 Vector<const char> chars = content.ToAsciiVector(); |
6115 // Note, this will initialize all elements (not only the prefix) | 6112 // Note, this will initialize all elements (not only the prefix) |
6116 // to prevent GC from seeing partially initialized array. | 6113 // to prevent GC from seeing partially initialized array. |
6117 position = CopyCachedAsciiCharsToArray(isolate->heap(), | 6114 position = CopyCachedAsciiCharsToArray(isolate->heap(), |
6118 chars.start(), | 6115 chars.start(), |
6119 *elements, | 6116 *elements, |
6120 length); | 6117 length); |
6121 } else { | 6118 } else { |
6122 MemsetPointer(elements->data_start(), | 6119 MemsetPointer(elements->data_start(), |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6923 // x is (non-trivial) prefix of y: | 6920 // x is (non-trivial) prefix of y: |
6924 if (bufy.has_more()) return Smi::FromInt(LESS); | 6921 if (bufy.has_more()) return Smi::FromInt(LESS); |
6925 // y is prefix of x: | 6922 // y is prefix of x: |
6926 return Smi::FromInt(bufx.has_more() ? GREATER : EQUAL); | 6923 return Smi::FromInt(bufx.has_more() ? GREATER : EQUAL); |
6927 } | 6924 } |
6928 | 6925 |
6929 | 6926 |
6930 static Object* FlatStringCompare(String* x, String* y) { | 6927 static Object* FlatStringCompare(String* x, String* y) { |
6931 ASSERT(x->IsFlat()); | 6928 ASSERT(x->IsFlat()); |
6932 ASSERT(y->IsFlat()); | 6929 ASSERT(y->IsFlat()); |
6933 AssertNoAllocation no_alloc; | |
6934 Object* equal_prefix_result = Smi::FromInt(EQUAL); | 6930 Object* equal_prefix_result = Smi::FromInt(EQUAL); |
6935 int prefix_length = x->length(); | 6931 int prefix_length = x->length(); |
6936 if (y->length() < prefix_length) { | 6932 if (y->length() < prefix_length) { |
6937 prefix_length = y->length(); | 6933 prefix_length = y->length(); |
6938 equal_prefix_result = Smi::FromInt(GREATER); | 6934 equal_prefix_result = Smi::FromInt(GREATER); |
6939 } else if (y->length() > prefix_length) { | 6935 } else if (y->length() > prefix_length) { |
6940 equal_prefix_result = Smi::FromInt(LESS); | 6936 equal_prefix_result = Smi::FromInt(LESS); |
6941 } | 6937 } |
6942 int r; | 6938 int r; |
6943 String::FlatContent x_content = x->GetFlatContent(no_alloc); | 6939 String::FlatContent x_content = x->GetFlatContent(); |
6944 String::FlatContent y_content = y->GetFlatContent(no_alloc); | 6940 String::FlatContent y_content = y->GetFlatContent(); |
6945 if (x_content.IsAscii()) { | 6941 if (x_content.IsAscii()) { |
6946 Vector<const char> x_chars = x_content.ToAsciiVector(); | 6942 Vector<const char> x_chars = x_content.ToAsciiVector(); |
6947 if (y_content.IsAscii()) { | 6943 if (y_content.IsAscii()) { |
6948 Vector<const char> y_chars = y_content.ToAsciiVector(); | 6944 Vector<const char> y_chars = y_content.ToAsciiVector(); |
6949 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 6945 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
6950 } else { | 6946 } else { |
6951 Vector<const uc16> y_chars = y_content.ToUC16Vector(); | 6947 Vector<const uc16> y_chars = y_content.ToUC16Vector(); |
6952 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 6948 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
6953 } | 6949 } |
6954 } else { | 6950 } else { |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8831 FlattenString(str); | 8827 FlattenString(str); |
8832 | 8828 |
8833 CONVERT_ARG_CHECKED(JSArray, output, 1); | 8829 CONVERT_ARG_CHECKED(JSArray, output, 1); |
8834 RUNTIME_ASSERT(output->HasFastElements()); | 8830 RUNTIME_ASSERT(output->HasFastElements()); |
8835 | 8831 |
8836 AssertNoAllocation no_allocation; | 8832 AssertNoAllocation no_allocation; |
8837 | 8833 |
8838 FixedArray* output_array = FixedArray::cast(output->elements()); | 8834 FixedArray* output_array = FixedArray::cast(output->elements()); |
8839 RUNTIME_ASSERT(output_array->length() >= DateParser::OUTPUT_SIZE); | 8835 RUNTIME_ASSERT(output_array->length() >= DateParser::OUTPUT_SIZE); |
8840 bool result; | 8836 bool result; |
8841 String::FlatContent str_content = str->GetFlatContent(no_allocation); | 8837 String::FlatContent str_content = str->GetFlatContent(); |
8842 if (str_content.IsAscii()) { | 8838 if (str_content.IsAscii()) { |
8843 result = DateParser::Parse(str_content.ToAsciiVector(), | 8839 result = DateParser::Parse(str_content.ToAsciiVector(), |
8844 output_array, | 8840 output_array, |
8845 isolate->unicode_cache()); | 8841 isolate->unicode_cache()); |
8846 } else { | 8842 } else { |
8847 ASSERT(str_content.IsTwoByte()); | 8843 ASSERT(str_content.IsTwoByte()); |
8848 result = DateParser::Parse(str_content.ToUC16Vector(), | 8844 result = DateParser::Parse(str_content.ToUC16Vector(), |
8849 output_array, | 8845 output_array, |
8850 isolate->unicode_cache()); | 8846 isolate->unicode_cache()); |
8851 } | 8847 } |
(...skipping 3964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12816 #undef ADD_ENTRY | 12812 #undef ADD_ENTRY |
12817 ASSERT_EQ(index, entry_count); | 12813 ASSERT_EQ(index, entry_count); |
12818 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); | 12814 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); |
12819 return *result; | 12815 return *result; |
12820 } | 12816 } |
12821 #endif | 12817 #endif |
12822 | 12818 |
12823 | 12819 |
12824 RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) { | 12820 RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) { |
12825 ASSERT(args.length() == 2); | 12821 ASSERT(args.length() == 2); |
12826 AssertNoAllocation no_alloc; | |
12827 CONVERT_CHECKED(String, format, args[0]); | 12822 CONVERT_CHECKED(String, format, args[0]); |
12828 CONVERT_CHECKED(JSArray, elms, args[1]); | 12823 CONVERT_CHECKED(JSArray, elms, args[1]); |
12829 String::FlatContent format_content = format->GetFlatContent(no_alloc); | 12824 String::FlatContent format_content = format->GetFlatContent(); |
12830 RUNTIME_ASSERT(format_content.IsAscii()); | 12825 RUNTIME_ASSERT(format_content.IsAscii()); |
12831 Vector<const char> chars = format_content.ToAsciiVector(); | 12826 Vector<const char> chars = format_content.ToAsciiVector(); |
12832 LOGGER->LogRuntime(chars, elms); | 12827 LOGGER->LogRuntime(chars, elms); |
12833 return isolate->heap()->undefined_value(); | 12828 return isolate->heap()->undefined_value(); |
12834 } | 12829 } |
12835 | 12830 |
12836 | 12831 |
12837 RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) { | 12832 RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) { |
12838 UNREACHABLE(); // implemented as macro in the parser | 12833 UNREACHABLE(); // implemented as macro in the parser |
12839 return NULL; | 12834 return NULL; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12935 } else { | 12930 } else { |
12936 // Handle last resort GC and make sure to allow future allocations | 12931 // Handle last resort GC and make sure to allow future allocations |
12937 // to grow the heap without causing GCs (if possible). | 12932 // to grow the heap without causing GCs (if possible). |
12938 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12933 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12939 isolate->heap()->CollectAllGarbage(false); | 12934 isolate->heap()->CollectAllGarbage(false); |
12940 } | 12935 } |
12941 } | 12936 } |
12942 | 12937 |
12943 | 12938 |
12944 } } // namespace v8::internal | 12939 } } // namespace v8::internal |
OLD | NEW |