OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3231 typedef BitField<int, 0, kStringBuilderConcatHelperLengthBits> | 3231 typedef BitField<int, 0, kStringBuilderConcatHelperLengthBits> |
3232 StringBuilderSubstringLength; | 3232 StringBuilderSubstringLength; |
3233 typedef BitField<int, | 3233 typedef BitField<int, |
3234 kStringBuilderConcatHelperLengthBits, | 3234 kStringBuilderConcatHelperLengthBits, |
3235 kStringBuilderConcatHelperPositionBits> | 3235 kStringBuilderConcatHelperPositionBits> |
3236 StringBuilderSubstringPosition; | 3236 StringBuilderSubstringPosition; |
3237 | 3237 |
3238 | 3238 |
3239 class ReplacementStringBuilder { | 3239 class ReplacementStringBuilder { |
3240 public: | 3240 public: |
3241 ReplacementStringBuilder(Heap* heap, | 3241 ReplacementStringBuilder(Heap* heap, Handle<String> subject, |
3242 Handle<String> subject, | |
3243 int estimated_part_count) | 3242 int estimated_part_count) |
3244 : heap_(heap), | 3243 : heap_(heap), |
3245 array_builder_(heap->isolate(), estimated_part_count), | 3244 array_builder_(heap->isolate(), estimated_part_count), |
3246 subject_(subject), | 3245 subject_(subject), |
3247 character_count_(0), | 3246 character_count_(0), |
3248 is_ascii_(subject->IsOneByteRepresentation()) { | 3247 is_one_byte_(subject->IsOneByteRepresentation()) { |
3249 // Require a non-zero initial size. Ensures that doubling the size to | 3248 // Require a non-zero initial size. Ensures that doubling the size to |
3250 // extend the array will work. | 3249 // extend the array will work. |
3251 DCHECK(estimated_part_count > 0); | 3250 DCHECK(estimated_part_count > 0); |
3252 } | 3251 } |
3253 | 3252 |
3254 static inline void AddSubjectSlice(FixedArrayBuilder* builder, | 3253 static inline void AddSubjectSlice(FixedArrayBuilder* builder, |
3255 int from, | 3254 int from, |
3256 int to) { | 3255 int to) { |
3257 DCHECK(from >= 0); | 3256 DCHECK(from >= 0); |
3258 int length = to - from; | 3257 int length = to - from; |
(...skipping 20 matching lines...) Expand all Loading... |
3279 AddSubjectSlice(&array_builder_, from, to); | 3278 AddSubjectSlice(&array_builder_, from, to); |
3280 IncrementCharacterCount(to - from); | 3279 IncrementCharacterCount(to - from); |
3281 } | 3280 } |
3282 | 3281 |
3283 | 3282 |
3284 void AddString(Handle<String> string) { | 3283 void AddString(Handle<String> string) { |
3285 int length = string->length(); | 3284 int length = string->length(); |
3286 DCHECK(length > 0); | 3285 DCHECK(length > 0); |
3287 AddElement(*string); | 3286 AddElement(*string); |
3288 if (!string->IsOneByteRepresentation()) { | 3287 if (!string->IsOneByteRepresentation()) { |
3289 is_ascii_ = false; | 3288 is_one_byte_ = false; |
3290 } | 3289 } |
3291 IncrementCharacterCount(length); | 3290 IncrementCharacterCount(length); |
3292 } | 3291 } |
3293 | 3292 |
3294 | 3293 |
3295 MaybeHandle<String> ToString() { | 3294 MaybeHandle<String> ToString() { |
3296 Isolate* isolate = heap_->isolate(); | 3295 Isolate* isolate = heap_->isolate(); |
3297 if (array_builder_.length() == 0) { | 3296 if (array_builder_.length() == 0) { |
3298 return isolate->factory()->empty_string(); | 3297 return isolate->factory()->empty_string(); |
3299 } | 3298 } |
3300 | 3299 |
3301 Handle<String> joined_string; | 3300 Handle<String> joined_string; |
3302 if (is_ascii_) { | 3301 if (is_one_byte_) { |
3303 Handle<SeqOneByteString> seq; | 3302 Handle<SeqOneByteString> seq; |
3304 ASSIGN_RETURN_ON_EXCEPTION( | 3303 ASSIGN_RETURN_ON_EXCEPTION( |
3305 isolate, seq, | 3304 isolate, seq, |
3306 isolate->factory()->NewRawOneByteString(character_count_), | 3305 isolate->factory()->NewRawOneByteString(character_count_), |
3307 String); | 3306 String); |
3308 | 3307 |
3309 DisallowHeapAllocation no_gc; | 3308 DisallowHeapAllocation no_gc; |
3310 uint8_t* char_buffer = seq->GetChars(); | 3309 uint8_t* char_buffer = seq->GetChars(); |
3311 StringBuilderConcatHelper(*subject_, | 3310 StringBuilderConcatHelper(*subject_, |
3312 char_buffer, | 3311 char_buffer, |
3313 *array_builder_.array(), | 3312 *array_builder_.array(), |
3314 array_builder_.length()); | 3313 array_builder_.length()); |
3315 joined_string = Handle<String>::cast(seq); | 3314 joined_string = Handle<String>::cast(seq); |
3316 } else { | 3315 } else { |
3317 // Non-ASCII. | 3316 // Two-byte. |
3318 Handle<SeqTwoByteString> seq; | 3317 Handle<SeqTwoByteString> seq; |
3319 ASSIGN_RETURN_ON_EXCEPTION( | 3318 ASSIGN_RETURN_ON_EXCEPTION( |
3320 isolate, seq, | 3319 isolate, seq, |
3321 isolate->factory()->NewRawTwoByteString(character_count_), | 3320 isolate->factory()->NewRawTwoByteString(character_count_), |
3322 String); | 3321 String); |
3323 | 3322 |
3324 DisallowHeapAllocation no_gc; | 3323 DisallowHeapAllocation no_gc; |
3325 uc16* char_buffer = seq->GetChars(); | 3324 uc16* char_buffer = seq->GetChars(); |
3326 StringBuilderConcatHelper(*subject_, | 3325 StringBuilderConcatHelper(*subject_, |
3327 char_buffer, | 3326 char_buffer, |
(...skipping 18 matching lines...) Expand all Loading... |
3346 void AddElement(Object* element) { | 3345 void AddElement(Object* element) { |
3347 DCHECK(element->IsSmi() || element->IsString()); | 3346 DCHECK(element->IsSmi() || element->IsString()); |
3348 DCHECK(array_builder_.capacity() > array_builder_.length()); | 3347 DCHECK(array_builder_.capacity() > array_builder_.length()); |
3349 array_builder_.Add(element); | 3348 array_builder_.Add(element); |
3350 } | 3349 } |
3351 | 3350 |
3352 Heap* heap_; | 3351 Heap* heap_; |
3353 FixedArrayBuilder array_builder_; | 3352 FixedArrayBuilder array_builder_; |
3354 Handle<String> subject_; | 3353 Handle<String> subject_; |
3355 int character_count_; | 3354 int character_count_; |
3356 bool is_ascii_; | 3355 bool is_one_byte_; |
3357 }; | 3356 }; |
3358 | 3357 |
3359 | 3358 |
3360 class CompiledReplacement { | 3359 class CompiledReplacement { |
3361 public: | 3360 public: |
3362 explicit CompiledReplacement(Zone* zone) | 3361 explicit CompiledReplacement(Zone* zone) |
3363 : parts_(1, zone), replacement_substrings_(0, zone), zone_(zone) {} | 3362 : parts_(1, zone), replacement_substrings_(0, zone), zone_(zone) {} |
3364 | 3363 |
3365 // Return whether the replacement is simple. | 3364 // Return whether the replacement is simple. |
3366 bool Compile(Handle<String> replacement, | 3365 bool Compile(Handle<String> replacement, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 | 3551 |
3553 | 3552 |
3554 bool CompiledReplacement::Compile(Handle<String> replacement, | 3553 bool CompiledReplacement::Compile(Handle<String> replacement, |
3555 int capture_count, | 3554 int capture_count, |
3556 int subject_length) { | 3555 int subject_length) { |
3557 { | 3556 { |
3558 DisallowHeapAllocation no_gc; | 3557 DisallowHeapAllocation no_gc; |
3559 String::FlatContent content = replacement->GetFlatContent(); | 3558 String::FlatContent content = replacement->GetFlatContent(); |
3560 DCHECK(content.IsFlat()); | 3559 DCHECK(content.IsFlat()); |
3561 bool simple = false; | 3560 bool simple = false; |
3562 if (content.IsAscii()) { | 3561 if (content.IsOneByte()) { |
3563 simple = ParseReplacementPattern(&parts_, | 3562 simple = ParseReplacementPattern(&parts_, |
3564 content.ToOneByteVector(), | 3563 content.ToOneByteVector(), |
3565 capture_count, | 3564 capture_count, |
3566 subject_length, | 3565 subject_length, |
3567 zone()); | 3566 zone()); |
3568 } else { | 3567 } else { |
3569 DCHECK(content.IsTwoByte()); | 3568 DCHECK(content.IsTwoByte()); |
3570 simple = ParseReplacementPattern(&parts_, | 3569 simple = ParseReplacementPattern(&parts_, |
3571 content.ToUC16Vector(), | 3570 content.ToUC16Vector(), |
3572 capture_count, | 3571 capture_count, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 case REPLACEMENT_STRING: | 3629 case REPLACEMENT_STRING: |
3631 builder->AddString(replacement_substrings_[part.data]); | 3630 builder->AddString(replacement_substrings_[part.data]); |
3632 break; | 3631 break; |
3633 default: | 3632 default: |
3634 UNREACHABLE(); | 3633 UNREACHABLE(); |
3635 } | 3634 } |
3636 } | 3635 } |
3637 } | 3636 } |
3638 | 3637 |
3639 | 3638 |
3640 void FindAsciiStringIndices(Vector<const uint8_t> subject, | 3639 void FindOneByteStringIndices(Vector<const uint8_t> subject, char pattern, |
3641 char pattern, | 3640 ZoneList<int>* indices, unsigned int limit, |
3642 ZoneList<int>* indices, | 3641 Zone* zone) { |
3643 unsigned int limit, | |
3644 Zone* zone) { | |
3645 DCHECK(limit > 0); | 3642 DCHECK(limit > 0); |
3646 // Collect indices of pattern in subject using memchr. | 3643 // Collect indices of pattern in subject using memchr. |
3647 // Stop after finding at most limit values. | 3644 // Stop after finding at most limit values. |
3648 const uint8_t* subject_start = subject.start(); | 3645 const uint8_t* subject_start = subject.start(); |
3649 const uint8_t* subject_end = subject_start + subject.length(); | 3646 const uint8_t* subject_end = subject_start + subject.length(); |
3650 const uint8_t* pos = subject_start; | 3647 const uint8_t* pos = subject_start; |
3651 while (limit > 0) { | 3648 while (limit > 0) { |
3652 pos = reinterpret_cast<const uint8_t*>( | 3649 pos = reinterpret_cast<const uint8_t*>( |
3653 memchr(pos, pattern, subject_end - pos)); | 3650 memchr(pos, pattern, subject_end - pos)); |
3654 if (pos == NULL) return; | 3651 if (pos == NULL) return; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 String* pattern, | 3701 String* pattern, |
3705 ZoneList<int>* indices, | 3702 ZoneList<int>* indices, |
3706 unsigned int limit, | 3703 unsigned int limit, |
3707 Zone* zone) { | 3704 Zone* zone) { |
3708 { | 3705 { |
3709 DisallowHeapAllocation no_gc; | 3706 DisallowHeapAllocation no_gc; |
3710 String::FlatContent subject_content = subject->GetFlatContent(); | 3707 String::FlatContent subject_content = subject->GetFlatContent(); |
3711 String::FlatContent pattern_content = pattern->GetFlatContent(); | 3708 String::FlatContent pattern_content = pattern->GetFlatContent(); |
3712 DCHECK(subject_content.IsFlat()); | 3709 DCHECK(subject_content.IsFlat()); |
3713 DCHECK(pattern_content.IsFlat()); | 3710 DCHECK(pattern_content.IsFlat()); |
3714 if (subject_content.IsAscii()) { | 3711 if (subject_content.IsOneByte()) { |
3715 Vector<const uint8_t> subject_vector = subject_content.ToOneByteVector(); | 3712 Vector<const uint8_t> subject_vector = subject_content.ToOneByteVector(); |
3716 if (pattern_content.IsAscii()) { | 3713 if (pattern_content.IsOneByte()) { |
3717 Vector<const uint8_t> pattern_vector = | 3714 Vector<const uint8_t> pattern_vector = |
3718 pattern_content.ToOneByteVector(); | 3715 pattern_content.ToOneByteVector(); |
3719 if (pattern_vector.length() == 1) { | 3716 if (pattern_vector.length() == 1) { |
3720 FindAsciiStringIndices(subject_vector, | 3717 FindOneByteStringIndices(subject_vector, pattern_vector[0], indices, |
3721 pattern_vector[0], | 3718 limit, zone); |
3722 indices, | |
3723 limit, | |
3724 zone); | |
3725 } else { | 3719 } else { |
3726 FindStringIndices(isolate, | 3720 FindStringIndices(isolate, |
3727 subject_vector, | 3721 subject_vector, |
3728 pattern_vector, | 3722 pattern_vector, |
3729 indices, | 3723 indices, |
3730 limit, | 3724 limit, |
3731 zone); | 3725 zone); |
3732 } | 3726 } |
3733 } else { | 3727 } else { |
3734 FindStringIndices(isolate, | 3728 FindStringIndices(isolate, |
3735 subject_vector, | 3729 subject_vector, |
3736 pattern_content.ToUC16Vector(), | 3730 pattern_content.ToUC16Vector(), |
3737 indices, | 3731 indices, |
3738 limit, | 3732 limit, |
3739 zone); | 3733 zone); |
3740 } | 3734 } |
3741 } else { | 3735 } else { |
3742 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); | 3736 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); |
3743 if (pattern_content.IsAscii()) { | 3737 if (pattern_content.IsOneByte()) { |
3744 Vector<const uint8_t> pattern_vector = | 3738 Vector<const uint8_t> pattern_vector = |
3745 pattern_content.ToOneByteVector(); | 3739 pattern_content.ToOneByteVector(); |
3746 if (pattern_vector.length() == 1) { | 3740 if (pattern_vector.length() == 1) { |
3747 FindTwoByteStringIndices(subject_vector, | 3741 FindTwoByteStringIndices(subject_vector, |
3748 pattern_vector[0], | 3742 pattern_vector[0], |
3749 indices, | 3743 indices, |
3750 limit, | 3744 limit, |
3751 zone); | 3745 zone); |
3752 } else { | 3746 } else { |
3753 FindStringIndices(isolate, | 3747 FindStringIndices(isolate, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3815 STATIC_ASSERT(String::kMaxLength < kMaxInt); | 3809 STATIC_ASSERT(String::kMaxLength < kMaxInt); |
3816 result_len = kMaxInt; // Provoke exception. | 3810 result_len = kMaxInt; // Provoke exception. |
3817 } else { | 3811 } else { |
3818 result_len = static_cast<int>(result_len_64); | 3812 result_len = static_cast<int>(result_len_64); |
3819 } | 3813 } |
3820 | 3814 |
3821 int subject_pos = 0; | 3815 int subject_pos = 0; |
3822 int result_pos = 0; | 3816 int result_pos = 0; |
3823 | 3817 |
3824 MaybeHandle<SeqString> maybe_res; | 3818 MaybeHandle<SeqString> maybe_res; |
3825 if (ResultSeqString::kHasAsciiEncoding) { | 3819 if (ResultSeqString::kHasOneByteEncoding) { |
3826 maybe_res = isolate->factory()->NewRawOneByteString(result_len); | 3820 maybe_res = isolate->factory()->NewRawOneByteString(result_len); |
3827 } else { | 3821 } else { |
3828 maybe_res = isolate->factory()->NewRawTwoByteString(result_len); | 3822 maybe_res = isolate->factory()->NewRawTwoByteString(result_len); |
3829 } | 3823 } |
3830 Handle<SeqString> untyped_res; | 3824 Handle<SeqString> untyped_res; |
3831 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, untyped_res, maybe_res); | 3825 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, untyped_res, maybe_res); |
3832 Handle<ResultSeqString> result = Handle<ResultSeqString>::cast(untyped_res); | 3826 Handle<ResultSeqString> result = Handle<ResultSeqString>::cast(untyped_res); |
3833 | 3827 |
3834 for (int i = 0; i < matches; i++) { | 3828 for (int i = 0; i < matches; i++) { |
3835 // Copy non-matched subject content. | 3829 // Copy non-matched subject content. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 | 3989 |
3996 int start = current_match[0]; | 3990 int start = current_match[0]; |
3997 int end = current_match[1]; | 3991 int end = current_match[1]; |
3998 int capture_count = regexp->CaptureCount(); | 3992 int capture_count = regexp->CaptureCount(); |
3999 int subject_length = subject->length(); | 3993 int subject_length = subject->length(); |
4000 | 3994 |
4001 int new_length = subject_length - (end - start); | 3995 int new_length = subject_length - (end - start); |
4002 if (new_length == 0) return isolate->heap()->empty_string(); | 3996 if (new_length == 0) return isolate->heap()->empty_string(); |
4003 | 3997 |
4004 Handle<ResultSeqString> answer; | 3998 Handle<ResultSeqString> answer; |
4005 if (ResultSeqString::kHasAsciiEncoding) { | 3999 if (ResultSeqString::kHasOneByteEncoding) { |
4006 answer = Handle<ResultSeqString>::cast( | 4000 answer = Handle<ResultSeqString>::cast( |
4007 isolate->factory()->NewRawOneByteString(new_length).ToHandleChecked()); | 4001 isolate->factory()->NewRawOneByteString(new_length).ToHandleChecked()); |
4008 } else { | 4002 } else { |
4009 answer = Handle<ResultSeqString>::cast( | 4003 answer = Handle<ResultSeqString>::cast( |
4010 isolate->factory()->NewRawTwoByteString(new_length).ToHandleChecked()); | 4004 isolate->factory()->NewRawTwoByteString(new_length).ToHandleChecked()); |
4011 } | 4005 } |
4012 | 4006 |
4013 int prev = 0; | 4007 int prev = 0; |
4014 int position = 0; | 4008 int position = 0; |
4015 | 4009 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4186 int pattern_length = pat->length(); | 4180 int pattern_length = pat->length(); |
4187 if (pattern_length == 0) return start_index; | 4181 if (pattern_length == 0) return start_index; |
4188 | 4182 |
4189 int subject_length = sub->length(); | 4183 int subject_length = sub->length(); |
4190 if (start_index + pattern_length > subject_length) return -1; | 4184 if (start_index + pattern_length > subject_length) return -1; |
4191 | 4185 |
4192 sub = String::Flatten(sub); | 4186 sub = String::Flatten(sub); |
4193 pat = String::Flatten(pat); | 4187 pat = String::Flatten(pat); |
4194 | 4188 |
4195 DisallowHeapAllocation no_gc; // ensure vectors stay valid | 4189 DisallowHeapAllocation no_gc; // ensure vectors stay valid |
4196 // Extract flattened substrings of cons strings before determining asciiness. | 4190 // Extract flattened substrings of cons strings before getting encoding. |
4197 String::FlatContent seq_sub = sub->GetFlatContent(); | 4191 String::FlatContent seq_sub = sub->GetFlatContent(); |
4198 String::FlatContent seq_pat = pat->GetFlatContent(); | 4192 String::FlatContent seq_pat = pat->GetFlatContent(); |
4199 | 4193 |
4200 // dispatch on type of strings | 4194 // dispatch on type of strings |
4201 if (seq_pat.IsAscii()) { | 4195 if (seq_pat.IsOneByte()) { |
4202 Vector<const uint8_t> pat_vector = seq_pat.ToOneByteVector(); | 4196 Vector<const uint8_t> pat_vector = seq_pat.ToOneByteVector(); |
4203 if (seq_sub.IsAscii()) { | 4197 if (seq_sub.IsOneByte()) { |
4204 return SearchString(isolate, | 4198 return SearchString(isolate, |
4205 seq_sub.ToOneByteVector(), | 4199 seq_sub.ToOneByteVector(), |
4206 pat_vector, | 4200 pat_vector, |
4207 start_index); | 4201 start_index); |
4208 } | 4202 } |
4209 return SearchString(isolate, | 4203 return SearchString(isolate, |
4210 seq_sub.ToUC16Vector(), | 4204 seq_sub.ToUC16Vector(), |
4211 pat_vector, | 4205 pat_vector, |
4212 start_index); | 4206 start_index); |
4213 } | 4207 } |
4214 Vector<const uc16> pat_vector = seq_pat.ToUC16Vector(); | 4208 Vector<const uc16> pat_vector = seq_pat.ToUC16Vector(); |
4215 if (seq_sub.IsAscii()) { | 4209 if (seq_sub.IsOneByte()) { |
4216 return SearchString(isolate, | 4210 return SearchString(isolate, |
4217 seq_sub.ToOneByteVector(), | 4211 seq_sub.ToOneByteVector(), |
4218 pat_vector, | 4212 pat_vector, |
4219 start_index); | 4213 start_index); |
4220 } | 4214 } |
4221 return SearchString(isolate, | 4215 return SearchString(isolate, |
4222 seq_sub.ToUC16Vector(), | 4216 seq_sub.ToUC16Vector(), |
4223 pat_vector, | 4217 pat_vector, |
4224 start_index); | 4218 start_index); |
4225 } | 4219 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4301 | 4295 |
4302 sub = String::Flatten(sub); | 4296 sub = String::Flatten(sub); |
4303 pat = String::Flatten(pat); | 4297 pat = String::Flatten(pat); |
4304 | 4298 |
4305 int position = -1; | 4299 int position = -1; |
4306 DisallowHeapAllocation no_gc; // ensure vectors stay valid | 4300 DisallowHeapAllocation no_gc; // ensure vectors stay valid |
4307 | 4301 |
4308 String::FlatContent sub_content = sub->GetFlatContent(); | 4302 String::FlatContent sub_content = sub->GetFlatContent(); |
4309 String::FlatContent pat_content = pat->GetFlatContent(); | 4303 String::FlatContent pat_content = pat->GetFlatContent(); |
4310 | 4304 |
4311 if (pat_content.IsAscii()) { | 4305 if (pat_content.IsOneByte()) { |
4312 Vector<const uint8_t> pat_vector = pat_content.ToOneByteVector(); | 4306 Vector<const uint8_t> pat_vector = pat_content.ToOneByteVector(); |
4313 if (sub_content.IsAscii()) { | 4307 if (sub_content.IsOneByte()) { |
4314 position = StringMatchBackwards(sub_content.ToOneByteVector(), | 4308 position = StringMatchBackwards(sub_content.ToOneByteVector(), |
4315 pat_vector, | 4309 pat_vector, |
4316 start_index); | 4310 start_index); |
4317 } else { | 4311 } else { |
4318 position = StringMatchBackwards(sub_content.ToUC16Vector(), | 4312 position = StringMatchBackwards(sub_content.ToUC16Vector(), |
4319 pat_vector, | 4313 pat_vector, |
4320 start_index); | 4314 start_index); |
4321 } | 4315 } |
4322 } else { | 4316 } else { |
4323 Vector<const uc16> pat_vector = pat_content.ToUC16Vector(); | 4317 Vector<const uc16> pat_vector = pat_content.ToUC16Vector(); |
4324 if (sub_content.IsAscii()) { | 4318 if (sub_content.IsOneByte()) { |
4325 position = StringMatchBackwards(sub_content.ToOneByteVector(), | 4319 position = StringMatchBackwards(sub_content.ToOneByteVector(), |
4326 pat_vector, | 4320 pat_vector, |
4327 start_index); | 4321 start_index); |
4328 } else { | 4322 } else { |
4329 position = StringMatchBackwards(sub_content.ToUC16Vector(), | 4323 position = StringMatchBackwards(sub_content.ToUC16Vector(), |
4330 pat_vector, | 4324 pat_vector, |
4331 start_index); | 4325 start_index); |
4332 } | 4326 } |
4333 } | 4327 } |
4334 | 4328 |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6339 CONVERT_NUMBER_CHECKED(int, radix, Int32, args[1]); | 6333 CONVERT_NUMBER_CHECKED(int, radix, Int32, args[1]); |
6340 RUNTIME_ASSERT(radix == 0 || (2 <= radix && radix <= 36)); | 6334 RUNTIME_ASSERT(radix == 0 || (2 <= radix && radix <= 36)); |
6341 | 6335 |
6342 subject = String::Flatten(subject); | 6336 subject = String::Flatten(subject); |
6343 double value; | 6337 double value; |
6344 | 6338 |
6345 { DisallowHeapAllocation no_gc; | 6339 { DisallowHeapAllocation no_gc; |
6346 String::FlatContent flat = subject->GetFlatContent(); | 6340 String::FlatContent flat = subject->GetFlatContent(); |
6347 | 6341 |
6348 // ECMA-262 section 15.1.2.3, empty string is NaN | 6342 // ECMA-262 section 15.1.2.3, empty string is NaN |
6349 if (flat.IsAscii()) { | 6343 if (flat.IsOneByte()) { |
6350 value = StringToInt( | 6344 value = StringToInt( |
6351 isolate->unicode_cache(), flat.ToOneByteVector(), radix); | 6345 isolate->unicode_cache(), flat.ToOneByteVector(), radix); |
6352 } else { | 6346 } else { |
6353 value = StringToInt( | 6347 value = StringToInt( |
6354 isolate->unicode_cache(), flat.ToUC16Vector(), radix); | 6348 isolate->unicode_cache(), flat.ToUC16Vector(), radix); |
6355 } | 6349 } |
6356 } | 6350 } |
6357 | 6351 |
6358 return *isolate->factory()->NewNumber(value); | 6352 return *isolate->factory()->NewNumber(value); |
6359 } | 6353 } |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6797 pattern, | 6791 pattern, |
6798 elements, | 6792 elements, |
6799 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); | 6793 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); |
6800 } | 6794 } |
6801 } | 6795 } |
6802 | 6796 |
6803 return *result; | 6797 return *result; |
6804 } | 6798 } |
6805 | 6799 |
6806 | 6800 |
6807 // Copies ASCII characters to the given fixed array looking up | 6801 // Copies Latin1 characters to the given fixed array looking up |
6808 // one-char strings in the cache. Gives up on the first char that is | 6802 // one-char strings in the cache. Gives up on the first char that is |
6809 // not in the cache and fills the remainder with smi zeros. Returns | 6803 // not in the cache and fills the remainder with smi zeros. Returns |
6810 // the length of the successfully copied prefix. | 6804 // the length of the successfully copied prefix. |
6811 static int CopyCachedAsciiCharsToArray(Heap* heap, | 6805 static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars, |
6812 const uint8_t* chars, | 6806 FixedArray* elements, int length) { |
6813 FixedArray* elements, | |
6814 int length) { | |
6815 DisallowHeapAllocation no_gc; | 6807 DisallowHeapAllocation no_gc; |
6816 FixedArray* ascii_cache = heap->single_character_string_cache(); | 6808 FixedArray* one_byte_cache = heap->single_character_string_cache(); |
6817 Object* undefined = heap->undefined_value(); | 6809 Object* undefined = heap->undefined_value(); |
6818 int i; | 6810 int i; |
6819 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); | 6811 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); |
6820 for (i = 0; i < length; ++i) { | 6812 for (i = 0; i < length; ++i) { |
6821 Object* value = ascii_cache->get(chars[i]); | 6813 Object* value = one_byte_cache->get(chars[i]); |
6822 if (value == undefined) break; | 6814 if (value == undefined) break; |
6823 elements->set(i, value, mode); | 6815 elements->set(i, value, mode); |
6824 } | 6816 } |
6825 if (i < length) { | 6817 if (i < length) { |
6826 DCHECK(Smi::FromInt(0) == 0); | 6818 DCHECK(Smi::FromInt(0) == 0); |
6827 memset(elements->data_start() + i, 0, kPointerSize * (length - i)); | 6819 memset(elements->data_start() + i, 0, kPointerSize * (length - i)); |
6828 } | 6820 } |
6829 #ifdef DEBUG | 6821 #ifdef DEBUG |
6830 for (int j = 0; j < length; ++j) { | 6822 for (int j = 0; j < length; ++j) { |
6831 Object* element = elements->get(j); | 6823 Object* element = elements->get(j); |
(...skipping 17 matching lines...) Expand all Loading... |
6849 const int length = static_cast<int>(Min<uint32_t>(s->length(), limit)); | 6841 const int length = static_cast<int>(Min<uint32_t>(s->length(), limit)); |
6850 | 6842 |
6851 Handle<FixedArray> elements; | 6843 Handle<FixedArray> elements; |
6852 int position = 0; | 6844 int position = 0; |
6853 if (s->IsFlat() && s->IsOneByteRepresentation()) { | 6845 if (s->IsFlat() && s->IsOneByteRepresentation()) { |
6854 // Try using cached chars where possible. | 6846 // Try using cached chars where possible. |
6855 elements = isolate->factory()->NewUninitializedFixedArray(length); | 6847 elements = isolate->factory()->NewUninitializedFixedArray(length); |
6856 | 6848 |
6857 DisallowHeapAllocation no_gc; | 6849 DisallowHeapAllocation no_gc; |
6858 String::FlatContent content = s->GetFlatContent(); | 6850 String::FlatContent content = s->GetFlatContent(); |
6859 if (content.IsAscii()) { | 6851 if (content.IsOneByte()) { |
6860 Vector<const uint8_t> chars = content.ToOneByteVector(); | 6852 Vector<const uint8_t> chars = content.ToOneByteVector(); |
6861 // Note, this will initialize all elements (not only the prefix) | 6853 // Note, this will initialize all elements (not only the prefix) |
6862 // to prevent GC from seeing partially initialized array. | 6854 // to prevent GC from seeing partially initialized array. |
6863 position = CopyCachedAsciiCharsToArray(isolate->heap(), | 6855 position = CopyCachedOneByteCharsToArray(isolate->heap(), chars.start(), |
6864 chars.start(), | 6856 *elements, length); |
6865 *elements, | |
6866 length); | |
6867 } else { | 6857 } else { |
6868 MemsetPointer(elements->data_start(), | 6858 MemsetPointer(elements->data_start(), |
6869 isolate->heap()->undefined_value(), | 6859 isolate->heap()->undefined_value(), |
6870 length); | 6860 length); |
6871 } | 6861 } |
6872 } else { | 6862 } else { |
6873 elements = isolate->factory()->NewFixedArray(length); | 6863 elements = isolate->factory()->NewFixedArray(length); |
6874 } | 6864 } |
6875 for (int i = position; i < length; ++i) { | 6865 for (int i = position; i < length; ++i) { |
6876 Handle<Object> str = | 6866 Handle<Object> str = |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7313 | 7303 |
7314 RUNTIME_ASSERT(fixed_array->get(i)->IsString()); | 7304 RUNTIME_ASSERT(fixed_array->get(i)->IsString()); |
7315 String* element = String::cast(fixed_array->get(i)); | 7305 String* element = String::cast(fixed_array->get(i)); |
7316 int element_length = element->length(); | 7306 int element_length = element->length(); |
7317 DCHECK(sink + element_length <= end); | 7307 DCHECK(sink + element_length <= end); |
7318 String::WriteToFlat(element, sink, 0, element_length); | 7308 String::WriteToFlat(element, sink, 0, element_length); |
7319 sink += element_length; | 7309 sink += element_length; |
7320 } | 7310 } |
7321 DCHECK(sink == end); | 7311 DCHECK(sink == end); |
7322 | 7312 |
7323 // Use %_FastAsciiArrayJoin instead. | 7313 // Use %_FastOneByteArrayJoin instead. |
7324 DCHECK(!answer->IsOneByteRepresentation()); | 7314 DCHECK(!answer->IsOneByteRepresentation()); |
7325 return *answer; | 7315 return *answer; |
7326 } | 7316 } |
7327 | 7317 |
7328 template <typename Char> | 7318 template <typename Char> |
7329 static void JoinSparseArrayWithSeparator(FixedArray* elements, | 7319 static void JoinSparseArrayWithSeparator(FixedArray* elements, |
7330 int elements_length, | 7320 int elements_length, |
7331 uint32_t array_length, | 7321 uint32_t array_length, |
7332 String* separator, | 7322 String* separator, |
7333 Vector<Char> buffer) { | 7323 Vector<Char> buffer) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7375 CONVERT_ARG_HANDLE_CHECKED(String, separator, 2); | 7365 CONVERT_ARG_HANDLE_CHECKED(String, separator, 2); |
7376 // elements_array is fast-mode JSarray of alternating positions | 7366 // elements_array is fast-mode JSarray of alternating positions |
7377 // (increasing order) and strings. | 7367 // (increasing order) and strings. |
7378 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements()); | 7368 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements()); |
7379 // array_length is length of original array (used to add separators); | 7369 // array_length is length of original array (used to add separators); |
7380 // separator is string to put between elements. Assumed to be non-empty. | 7370 // separator is string to put between elements. Assumed to be non-empty. |
7381 RUNTIME_ASSERT(array_length > 0); | 7371 RUNTIME_ASSERT(array_length > 0); |
7382 | 7372 |
7383 // Find total length of join result. | 7373 // Find total length of join result. |
7384 int string_length = 0; | 7374 int string_length = 0; |
7385 bool is_ascii = separator->IsOneByteRepresentation(); | 7375 bool is_one_byte = separator->IsOneByteRepresentation(); |
7386 bool overflow = false; | 7376 bool overflow = false; |
7387 CONVERT_NUMBER_CHECKED(int, elements_length, Int32, elements_array->length()); | 7377 CONVERT_NUMBER_CHECKED(int, elements_length, Int32, elements_array->length()); |
7388 RUNTIME_ASSERT(elements_length <= elements_array->elements()->length()); | 7378 RUNTIME_ASSERT(elements_length <= elements_array->elements()->length()); |
7389 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length. | 7379 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length. |
7390 FixedArray* elements = FixedArray::cast(elements_array->elements()); | 7380 FixedArray* elements = FixedArray::cast(elements_array->elements()); |
7391 for (int i = 0; i < elements_length; i += 2) { | 7381 for (int i = 0; i < elements_length; i += 2) { |
7392 RUNTIME_ASSERT(elements->get(i)->IsNumber()); | 7382 RUNTIME_ASSERT(elements->get(i)->IsNumber()); |
7393 CONVERT_NUMBER_CHECKED(uint32_t, position, Uint32, elements->get(i)); | 7383 CONVERT_NUMBER_CHECKED(uint32_t, position, Uint32, elements->get(i)); |
7394 RUNTIME_ASSERT(position < array_length); | 7384 RUNTIME_ASSERT(position < array_length); |
7395 RUNTIME_ASSERT(elements->get(i + 1)->IsString()); | 7385 RUNTIME_ASSERT(elements->get(i + 1)->IsString()); |
7396 } | 7386 } |
7397 | 7387 |
7398 { DisallowHeapAllocation no_gc; | 7388 { DisallowHeapAllocation no_gc; |
7399 for (int i = 0; i < elements_length; i += 2) { | 7389 for (int i = 0; i < elements_length; i += 2) { |
7400 String* string = String::cast(elements->get(i + 1)); | 7390 String* string = String::cast(elements->get(i + 1)); |
7401 int length = string->length(); | 7391 int length = string->length(); |
7402 if (is_ascii && !string->IsOneByteRepresentation()) { | 7392 if (is_one_byte && !string->IsOneByteRepresentation()) { |
7403 is_ascii = false; | 7393 is_one_byte = false; |
7404 } | 7394 } |
7405 if (length > String::kMaxLength || | 7395 if (length > String::kMaxLength || |
7406 String::kMaxLength - length < string_length) { | 7396 String::kMaxLength - length < string_length) { |
7407 overflow = true; | 7397 overflow = true; |
7408 break; | 7398 break; |
7409 } | 7399 } |
7410 string_length += length; | 7400 string_length += length; |
7411 } | 7401 } |
7412 } | 7402 } |
7413 | 7403 |
(...skipping 15 matching lines...) Expand all Loading... |
7429 overflow = true; | 7419 overflow = true; |
7430 } | 7420 } |
7431 } | 7421 } |
7432 if (overflow) { | 7422 if (overflow) { |
7433 // Throw an exception if the resulting string is too large. See | 7423 // Throw an exception if the resulting string is too large. See |
7434 // https://code.google.com/p/chromium/issues/detail?id=336820 | 7424 // https://code.google.com/p/chromium/issues/detail?id=336820 |
7435 // for details. | 7425 // for details. |
7436 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); | 7426 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); |
7437 } | 7427 } |
7438 | 7428 |
7439 if (is_ascii) { | 7429 if (is_one_byte) { |
7440 Handle<SeqOneByteString> result = isolate->factory()->NewRawOneByteString( | 7430 Handle<SeqOneByteString> result = isolate->factory()->NewRawOneByteString( |
7441 string_length).ToHandleChecked(); | 7431 string_length).ToHandleChecked(); |
7442 JoinSparseArrayWithSeparator<uint8_t>( | 7432 JoinSparseArrayWithSeparator<uint8_t>( |
7443 FixedArray::cast(elements_array->elements()), | 7433 FixedArray::cast(elements_array->elements()), |
7444 elements_length, | 7434 elements_length, |
7445 array_length, | 7435 array_length, |
7446 *separator, | 7436 *separator, |
7447 Vector<uint8_t>(result->GetChars(), string_length)); | 7437 Vector<uint8_t>(result->GetChars(), string_length)); |
7448 return *result; | 7438 return *result; |
7449 } else { | 7439 } else { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7680 int prefix_length = x->length(); | 7670 int prefix_length = x->length(); |
7681 if (y->length() < prefix_length) { | 7671 if (y->length() < prefix_length) { |
7682 prefix_length = y->length(); | 7672 prefix_length = y->length(); |
7683 equal_prefix_result = Smi::FromInt(GREATER); | 7673 equal_prefix_result = Smi::FromInt(GREATER); |
7684 } else if (y->length() > prefix_length) { | 7674 } else if (y->length() > prefix_length) { |
7685 equal_prefix_result = Smi::FromInt(LESS); | 7675 equal_prefix_result = Smi::FromInt(LESS); |
7686 } | 7676 } |
7687 int r; | 7677 int r; |
7688 String::FlatContent x_content = x->GetFlatContent(); | 7678 String::FlatContent x_content = x->GetFlatContent(); |
7689 String::FlatContent y_content = y->GetFlatContent(); | 7679 String::FlatContent y_content = y->GetFlatContent(); |
7690 if (x_content.IsAscii()) { | 7680 if (x_content.IsOneByte()) { |
7691 Vector<const uint8_t> x_chars = x_content.ToOneByteVector(); | 7681 Vector<const uint8_t> x_chars = x_content.ToOneByteVector(); |
7692 if (y_content.IsAscii()) { | 7682 if (y_content.IsOneByte()) { |
7693 Vector<const uint8_t> y_chars = y_content.ToOneByteVector(); | 7683 Vector<const uint8_t> y_chars = y_content.ToOneByteVector(); |
7694 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 7684 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
7695 } else { | 7685 } else { |
7696 Vector<const uc16> y_chars = y_content.ToUC16Vector(); | 7686 Vector<const uc16> y_chars = y_content.ToUC16Vector(); |
7697 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 7687 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
7698 } | 7688 } |
7699 } else { | 7689 } else { |
7700 Vector<const uc16> x_chars = x_content.ToUC16Vector(); | 7690 Vector<const uc16> x_chars = x_content.ToUC16Vector(); |
7701 if (y_content.IsAscii()) { | 7691 if (y_content.IsOneByte()) { |
7702 Vector<const uint8_t> y_chars = y_content.ToOneByteVector(); | 7692 Vector<const uint8_t> y_chars = y_content.ToOneByteVector(); |
7703 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 7693 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
7704 } else { | 7694 } else { |
7705 Vector<const uc16> y_chars = y_content.ToUC16Vector(); | 7695 Vector<const uc16> y_chars = y_content.ToUC16Vector(); |
7706 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); | 7696 r = CompareChars(x_chars.start(), y_chars.start(), prefix_length); |
7707 } | 7697 } |
7708 } | 7698 } |
7709 Object* result; | 7699 Object* result; |
7710 if (r == 0) { | 7700 if (r == 0) { |
7711 result = equal_prefix_result; | 7701 result = equal_prefix_result; |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8650 | 8640 |
8651 // If the function is optimized, just return. | 8641 // If the function is optimized, just return. |
8652 if (function->IsOptimized()) return isolate->heap()->undefined_value(); | 8642 if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
8653 | 8643 |
8654 function->MarkForOptimization(); | 8644 function->MarkForOptimization(); |
8655 | 8645 |
8656 Code* unoptimized = function->shared()->code(); | 8646 Code* unoptimized = function->shared()->code(); |
8657 if (args.length() == 2 && | 8647 if (args.length() == 2 && |
8658 unoptimized->kind() == Code::FUNCTION) { | 8648 unoptimized->kind() == Code::FUNCTION) { |
8659 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 8649 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
8660 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr")) && FLAG_use_osr) { | 8650 if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("osr")) && FLAG_use_osr) { |
8661 // Start patching from the currently patched loop nesting level. | 8651 // Start patching from the currently patched loop nesting level. |
8662 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); | 8652 DCHECK(BackEdgeTable::Verify(isolate, unoptimized)); |
8663 isolate->runtime_profiler()->AttemptOnStackReplacement( | 8653 isolate->runtime_profiler()->AttemptOnStackReplacement( |
8664 *function, Code::kMaxLoopNestingMarker); | 8654 *function, Code::kMaxLoopNestingMarker); |
8665 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && | 8655 } else if (type->IsOneByteEqualTo(STATIC_CHAR_VECTOR("concurrent")) && |
8666 isolate->concurrent_recompilation_enabled()) { | 8656 isolate->concurrent_recompilation_enabled()) { |
8667 function->MarkForConcurrentOptimization(); | 8657 function->MarkForConcurrentOptimization(); |
8668 } | 8658 } |
8669 } | 8659 } |
8670 | 8660 |
8671 return isolate->heap()->undefined_value(); | 8661 return isolate->heap()->undefined_value(); |
8672 } | 8662 } |
8673 | 8663 |
8674 | 8664 |
8675 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { | 8665 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { |
8676 HandleScope scope(isolate); | 8666 HandleScope scope(isolate); |
8677 DCHECK(args.length() == 1); | 8667 DCHECK(args.length() == 1); |
8678 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8668 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
8679 function->shared()->set_optimization_disabled(true); | 8669 function->shared()->set_optimization_disabled(true); |
8680 return isolate->heap()->undefined_value(); | 8670 return isolate->heap()->undefined_value(); |
8681 } | 8671 } |
8682 | 8672 |
8683 | 8673 |
8684 RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { | 8674 RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { |
8685 HandleScope scope(isolate); | 8675 HandleScope scope(isolate); |
8686 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8676 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
8687 if (!isolate->use_crankshaft()) { | 8677 if (!isolate->use_crankshaft()) { |
8688 return Smi::FromInt(4); // 4 == "never". | 8678 return Smi::FromInt(4); // 4 == "never". |
8689 } | 8679 } |
8690 bool sync_with_compiler_thread = true; | 8680 bool sync_with_compiler_thread = true; |
8691 if (args.length() == 2) { | 8681 if (args.length() == 2) { |
8692 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8682 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
8693 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8683 if (sync->IsOneByteEqualTo(STATIC_CHAR_VECTOR("no sync"))) { |
8694 sync_with_compiler_thread = false; | 8684 sync_with_compiler_thread = false; |
8695 } | 8685 } |
8696 } | 8686 } |
8697 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8687 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8698 if (isolate->concurrent_recompilation_enabled() && | 8688 if (isolate->concurrent_recompilation_enabled() && |
8699 sync_with_compiler_thread) { | 8689 sync_with_compiler_thread) { |
8700 while (function->IsInOptimizationQueue()) { | 8690 while (function->IsInOptimizationQueue()) { |
8701 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8691 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
8702 base::OS::Sleep(50); | 8692 base::OS::Sleep(50); |
8703 } | 8693 } |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9684 JSObject::EnsureCanContainHeapObjectElements(output); | 9674 JSObject::EnsureCanContainHeapObjectElements(output); |
9685 RUNTIME_ASSERT(output->HasFastObjectElements()); | 9675 RUNTIME_ASSERT(output->HasFastObjectElements()); |
9686 Handle<FixedArray> output_array(FixedArray::cast(output->elements())); | 9676 Handle<FixedArray> output_array(FixedArray::cast(output->elements())); |
9687 RUNTIME_ASSERT(output_array->length() >= DateParser::OUTPUT_SIZE); | 9677 RUNTIME_ASSERT(output_array->length() >= DateParser::OUTPUT_SIZE); |
9688 | 9678 |
9689 str = String::Flatten(str); | 9679 str = String::Flatten(str); |
9690 DisallowHeapAllocation no_gc; | 9680 DisallowHeapAllocation no_gc; |
9691 | 9681 |
9692 bool result; | 9682 bool result; |
9693 String::FlatContent str_content = str->GetFlatContent(); | 9683 String::FlatContent str_content = str->GetFlatContent(); |
9694 if (str_content.IsAscii()) { | 9684 if (str_content.IsOneByte()) { |
9695 result = DateParser::Parse(str_content.ToOneByteVector(), | 9685 result = DateParser::Parse(str_content.ToOneByteVector(), |
9696 *output_array, | 9686 *output_array, |
9697 isolate->unicode_cache()); | 9687 isolate->unicode_cache()); |
9698 } else { | 9688 } else { |
9699 DCHECK(str_content.IsTwoByte()); | 9689 DCHECK(str_content.IsTwoByte()); |
9700 result = DateParser::Parse(str_content.ToUC16Vector(), | 9690 result = DateParser::Parse(str_content.ToUC16Vector(), |
9701 *output_array, | 9691 *output_array, |
9702 isolate->unicode_cache()); | 9692 isolate->unicode_cache()); |
9703 } | 9693 } |
9704 | 9694 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9777 !JSGlobalObject::cast(global)->IsDetached()); | 9767 !JSGlobalObject::cast(global)->IsDetached()); |
9778 } | 9768 } |
9779 | 9769 |
9780 | 9770 |
9781 RUNTIME_FUNCTION(Runtime_ParseJson) { | 9771 RUNTIME_FUNCTION(Runtime_ParseJson) { |
9782 HandleScope scope(isolate); | 9772 HandleScope scope(isolate); |
9783 DCHECK(args.length() == 1); | 9773 DCHECK(args.length() == 1); |
9784 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 9774 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); |
9785 | 9775 |
9786 source = String::Flatten(source); | 9776 source = String::Flatten(source); |
9787 // Optimized fast case where we only have ASCII characters. | 9777 // Optimized fast case where we only have Latin1 characters. |
9788 Handle<Object> result; | 9778 Handle<Object> result; |
9789 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 9779 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
9790 isolate, result, | 9780 isolate, result, |
9791 source->IsSeqOneByteString() ? JsonParser<true>::Parse(source) | 9781 source->IsSeqOneByteString() ? JsonParser<true>::Parse(source) |
9792 : JsonParser<false>::Parse(source)); | 9782 : JsonParser<false>::Parse(source)); |
9793 return *result; | 9783 return *result; |
9794 } | 9784 } |
9795 | 9785 |
9796 | 9786 |
9797 bool CodeGenerationFromStringsAllowed(Isolate* isolate, | 9787 bool CodeGenerationFromStringsAllowed(Isolate* isolate, |
(...skipping 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13883 | 13873 |
13884 // Set the locale | 13874 // Set the locale |
13885 char result[ULOC_FULLNAME_CAPACITY]; | 13875 char result[ULOC_FULLNAME_CAPACITY]; |
13886 UErrorCode status = U_ZERO_ERROR; | 13876 UErrorCode status = U_ZERO_ERROR; |
13887 uloc_toLanguageTag( | 13877 uloc_toLanguageTag( |
13888 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); | 13878 default_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
13889 if (U_SUCCESS(status)) { | 13879 if (U_SUCCESS(status)) { |
13890 return *factory->NewStringFromAsciiChecked(result); | 13880 return *factory->NewStringFromAsciiChecked(result); |
13891 } | 13881 } |
13892 | 13882 |
13893 return *factory->NewStringFromStaticAscii("und"); | 13883 return *factory->NewStringFromStaticChars("und"); |
13894 } | 13884 } |
13895 | 13885 |
13896 | 13886 |
13897 RUNTIME_FUNCTION(Runtime_GetLanguageTagVariants) { | 13887 RUNTIME_FUNCTION(Runtime_GetLanguageTagVariants) { |
13898 HandleScope scope(isolate); | 13888 HandleScope scope(isolate); |
13899 Factory* factory = isolate->factory(); | 13889 Factory* factory = isolate->factory(); |
13900 | 13890 |
13901 DCHECK(args.length() == 1); | 13891 DCHECK(args.length() == 1); |
13902 | 13892 |
13903 CONVERT_ARG_HANDLE_CHECKED(JSArray, input, 0); | 13893 CONVERT_ARG_HANDLE_CHECKED(JSArray, input, 0); |
13904 | 13894 |
13905 uint32_t length = static_cast<uint32_t>(input->length()->Number()); | 13895 uint32_t length = static_cast<uint32_t>(input->length()->Number()); |
13906 // Set some limit to prevent fuzz tests from going OOM. | 13896 // Set some limit to prevent fuzz tests from going OOM. |
13907 // Can be bumped when callers' requirements change. | 13897 // Can be bumped when callers' requirements change. |
13908 RUNTIME_ASSERT(length < 100); | 13898 RUNTIME_ASSERT(length < 100); |
13909 Handle<FixedArray> output = factory->NewFixedArray(length); | 13899 Handle<FixedArray> output = factory->NewFixedArray(length); |
13910 Handle<Name> maximized = factory->NewStringFromStaticAscii("maximized"); | 13900 Handle<Name> maximized = factory->NewStringFromStaticChars("maximized"); |
13911 Handle<Name> base = factory->NewStringFromStaticAscii("base"); | 13901 Handle<Name> base = factory->NewStringFromStaticChars("base"); |
13912 for (unsigned int i = 0; i < length; ++i) { | 13902 for (unsigned int i = 0; i < length; ++i) { |
13913 Handle<Object> locale_id; | 13903 Handle<Object> locale_id; |
13914 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 13904 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
13915 isolate, locale_id, Object::GetElement(isolate, input, i)); | 13905 isolate, locale_id, Object::GetElement(isolate, input, i)); |
13916 if (!locale_id->IsString()) { | 13906 if (!locale_id->IsString()) { |
13917 return isolate->Throw(*factory->illegal_argument_string()); | 13907 return isolate->Throw(*factory->illegal_argument_string()); |
13918 } | 13908 } |
13919 | 13909 |
13920 v8::String::Utf8Value utf8_locale_id( | 13910 v8::String::Utf8Value utf8_locale_id( |
13921 v8::Utils::ToLocal(Handle<String>::cast(locale_id))); | 13911 v8::Utils::ToLocal(Handle<String>::cast(locale_id))); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14078 | 14068 |
14079 // Set date time formatter as internal field of the resulting JS object. | 14069 // Set date time formatter as internal field of the resulting JS object. |
14080 icu::SimpleDateFormat* date_format = DateFormat::InitializeDateTimeFormat( | 14070 icu::SimpleDateFormat* date_format = DateFormat::InitializeDateTimeFormat( |
14081 isolate, locale, options, resolved); | 14071 isolate, locale, options, resolved); |
14082 | 14072 |
14083 if (!date_format) return isolate->ThrowIllegalOperation(); | 14073 if (!date_format) return isolate->ThrowIllegalOperation(); |
14084 | 14074 |
14085 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); | 14075 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); |
14086 | 14076 |
14087 Factory* factory = isolate->factory(); | 14077 Factory* factory = isolate->factory(); |
14088 Handle<String> key = factory->NewStringFromStaticAscii("dateFormat"); | 14078 Handle<String> key = factory->NewStringFromStaticChars("dateFormat"); |
14089 Handle<String> value = factory->NewStringFromStaticAscii("valid"); | 14079 Handle<String> value = factory->NewStringFromStaticChars("valid"); |
14090 JSObject::AddProperty(local_object, key, value, NONE); | 14080 JSObject::AddProperty(local_object, key, value, NONE); |
14091 | 14081 |
14092 // Make object handle weak so we can delete the data format once GC kicks in. | 14082 // Make object handle weak so we can delete the data format once GC kicks in. |
14093 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14083 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14094 GlobalHandles::MakeWeak(wrapper.location(), | 14084 GlobalHandles::MakeWeak(wrapper.location(), |
14095 reinterpret_cast<void*>(wrapper.location()), | 14085 reinterpret_cast<void*>(wrapper.location()), |
14096 DateFormat::DeleteDateFormat); | 14086 DateFormat::DeleteDateFormat); |
14097 return *local_object; | 14087 return *local_object; |
14098 } | 14088 } |
14099 | 14089 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14175 | 14165 |
14176 // Set number formatter as internal field of the resulting JS object. | 14166 // Set number formatter as internal field of the resulting JS object. |
14177 icu::DecimalFormat* number_format = NumberFormat::InitializeNumberFormat( | 14167 icu::DecimalFormat* number_format = NumberFormat::InitializeNumberFormat( |
14178 isolate, locale, options, resolved); | 14168 isolate, locale, options, resolved); |
14179 | 14169 |
14180 if (!number_format) return isolate->ThrowIllegalOperation(); | 14170 if (!number_format) return isolate->ThrowIllegalOperation(); |
14181 | 14171 |
14182 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 14172 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
14183 | 14173 |
14184 Factory* factory = isolate->factory(); | 14174 Factory* factory = isolate->factory(); |
14185 Handle<String> key = factory->NewStringFromStaticAscii("numberFormat"); | 14175 Handle<String> key = factory->NewStringFromStaticChars("numberFormat"); |
14186 Handle<String> value = factory->NewStringFromStaticAscii("valid"); | 14176 Handle<String> value = factory->NewStringFromStaticChars("valid"); |
14187 JSObject::AddProperty(local_object, key, value, NONE); | 14177 JSObject::AddProperty(local_object, key, value, NONE); |
14188 | 14178 |
14189 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14179 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14190 GlobalHandles::MakeWeak(wrapper.location(), | 14180 GlobalHandles::MakeWeak(wrapper.location(), |
14191 reinterpret_cast<void*>(wrapper.location()), | 14181 reinterpret_cast<void*>(wrapper.location()), |
14192 NumberFormat::DeleteNumberFormat); | 14182 NumberFormat::DeleteNumberFormat); |
14193 return *local_object; | 14183 return *local_object; |
14194 } | 14184 } |
14195 | 14185 |
14196 | 14186 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14281 | 14271 |
14282 // Set collator as internal field of the resulting JS object. | 14272 // Set collator as internal field of the resulting JS object. |
14283 icu::Collator* collator = Collator::InitializeCollator( | 14273 icu::Collator* collator = Collator::InitializeCollator( |
14284 isolate, locale, options, resolved); | 14274 isolate, locale, options, resolved); |
14285 | 14275 |
14286 if (!collator) return isolate->ThrowIllegalOperation(); | 14276 if (!collator) return isolate->ThrowIllegalOperation(); |
14287 | 14277 |
14288 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 14278 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
14289 | 14279 |
14290 Factory* factory = isolate->factory(); | 14280 Factory* factory = isolate->factory(); |
14291 Handle<String> key = factory->NewStringFromStaticAscii("collator"); | 14281 Handle<String> key = factory->NewStringFromStaticChars("collator"); |
14292 Handle<String> value = factory->NewStringFromStaticAscii("valid"); | 14282 Handle<String> value = factory->NewStringFromStaticChars("valid"); |
14293 JSObject::AddProperty(local_object, key, value, NONE); | 14283 JSObject::AddProperty(local_object, key, value, NONE); |
14294 | 14284 |
14295 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14285 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14296 GlobalHandles::MakeWeak(wrapper.location(), | 14286 GlobalHandles::MakeWeak(wrapper.location(), |
14297 reinterpret_cast<void*>(wrapper.location()), | 14287 reinterpret_cast<void*>(wrapper.location()), |
14298 Collator::DeleteCollator); | 14288 Collator::DeleteCollator); |
14299 return *local_object; | 14289 return *local_object; |
14300 } | 14290 } |
14301 | 14291 |
14302 | 14292 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14385 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( | 14375 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( |
14386 isolate, locale, options, resolved); | 14376 isolate, locale, options, resolved); |
14387 | 14377 |
14388 if (!break_iterator) return isolate->ThrowIllegalOperation(); | 14378 if (!break_iterator) return isolate->ThrowIllegalOperation(); |
14389 | 14379 |
14390 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); | 14380 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); |
14391 // Make sure that the pointer to adopted text is NULL. | 14381 // Make sure that the pointer to adopted text is NULL. |
14392 local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL)); | 14382 local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL)); |
14393 | 14383 |
14394 Factory* factory = isolate->factory(); | 14384 Factory* factory = isolate->factory(); |
14395 Handle<String> key = factory->NewStringFromStaticAscii("breakIterator"); | 14385 Handle<String> key = factory->NewStringFromStaticChars("breakIterator"); |
14396 Handle<String> value = factory->NewStringFromStaticAscii("valid"); | 14386 Handle<String> value = factory->NewStringFromStaticChars("valid"); |
14397 JSObject::AddProperty(local_object, key, value, NONE); | 14387 JSObject::AddProperty(local_object, key, value, NONE); |
14398 | 14388 |
14399 // Make object handle weak so we can delete the break iterator once GC kicks | 14389 // Make object handle weak so we can delete the break iterator once GC kicks |
14400 // in. | 14390 // in. |
14401 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14391 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14402 GlobalHandles::MakeWeak(wrapper.location(), | 14392 GlobalHandles::MakeWeak(wrapper.location(), |
14403 reinterpret_cast<void*>(wrapper.location()), | 14393 reinterpret_cast<void*>(wrapper.location()), |
14404 BreakIterator::DeleteBreakIterator); | 14394 BreakIterator::DeleteBreakIterator); |
14405 return *local_object; | 14395 return *local_object; |
14406 } | 14396 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14488 icu::BreakIterator* break_iterator = | 14478 icu::BreakIterator* break_iterator = |
14489 BreakIterator::UnpackBreakIterator(isolate, break_iterator_holder); | 14479 BreakIterator::UnpackBreakIterator(isolate, break_iterator_holder); |
14490 if (!break_iterator) return isolate->ThrowIllegalOperation(); | 14480 if (!break_iterator) return isolate->ThrowIllegalOperation(); |
14491 | 14481 |
14492 // TODO(cira): Remove cast once ICU fixes base BreakIterator class. | 14482 // TODO(cira): Remove cast once ICU fixes base BreakIterator class. |
14493 icu::RuleBasedBreakIterator* rule_based_iterator = | 14483 icu::RuleBasedBreakIterator* rule_based_iterator = |
14494 static_cast<icu::RuleBasedBreakIterator*>(break_iterator); | 14484 static_cast<icu::RuleBasedBreakIterator*>(break_iterator); |
14495 int32_t status = rule_based_iterator->getRuleStatus(); | 14485 int32_t status = rule_based_iterator->getRuleStatus(); |
14496 // Keep return values in sync with JavaScript BreakType enum. | 14486 // Keep return values in sync with JavaScript BreakType enum. |
14497 if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) { | 14487 if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) { |
14498 return *isolate->factory()->NewStringFromStaticAscii("none"); | 14488 return *isolate->factory()->NewStringFromStaticChars("none"); |
14499 } else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) { | 14489 } else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) { |
14500 return *isolate->factory()->number_string(); | 14490 return *isolate->factory()->number_string(); |
14501 } else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) { | 14491 } else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) { |
14502 return *isolate->factory()->NewStringFromStaticAscii("letter"); | 14492 return *isolate->factory()->NewStringFromStaticChars("letter"); |
14503 } else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) { | 14493 } else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) { |
14504 return *isolate->factory()->NewStringFromStaticAscii("kana"); | 14494 return *isolate->factory()->NewStringFromStaticChars("kana"); |
14505 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 14495 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
14506 return *isolate->factory()->NewStringFromStaticAscii("ideo"); | 14496 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
14507 } else { | 14497 } else { |
14508 return *isolate->factory()->NewStringFromStaticAscii("unknown"); | 14498 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
14509 } | 14499 } |
14510 } | 14500 } |
14511 #endif // V8_I18N_SUPPORT | 14501 #endif // V8_I18N_SUPPORT |
14512 | 14502 |
14513 | 14503 |
14514 // Finds the script object from the script data. NOTE: This operation uses | 14504 // Finds the script object from the script data. NOTE: This operation uses |
14515 // heap traversal to find the function generated for the source position | 14505 // heap traversal to find the function generated for the source position |
14516 // for the requested break point. For lazily compiled functions several heap | 14506 // for the requested break point. For lazily compiled functions several heap |
14517 // traversals might be required rendering this operation as a rather slow | 14507 // traversals might be required rendering this operation as a rather slow |
14518 // operation. However for setting break points which is normally done through | 14508 // operation. However for setting break points which is normally done through |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14793 #define COUNT_ENTRY(Name, argc, ressize) + 1 | 14783 #define COUNT_ENTRY(Name, argc, ressize) + 1 |
14794 int entry_count = 0 | 14784 int entry_count = 0 |
14795 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) | 14785 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) |
14796 INLINE_FUNCTION_LIST(COUNT_ENTRY) | 14786 INLINE_FUNCTION_LIST(COUNT_ENTRY) |
14797 INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY); | 14787 INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY); |
14798 #undef COUNT_ENTRY | 14788 #undef COUNT_ENTRY |
14799 Factory* factory = isolate->factory(); | 14789 Factory* factory = isolate->factory(); |
14800 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); | 14790 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); |
14801 int index = 0; | 14791 int index = 0; |
14802 bool inline_runtime_functions = false; | 14792 bool inline_runtime_functions = false; |
14803 #define ADD_ENTRY(Name, argc, ressize) \ | 14793 #define ADD_ENTRY(Name, argc, ressize) \ |
14804 { \ | 14794 { \ |
14805 HandleScope inner(isolate); \ | 14795 HandleScope inner(isolate); \ |
14806 Handle<String> name; \ | 14796 Handle<String> name; \ |
14807 /* Inline runtime functions have an underscore in front of the name. */ \ | 14797 /* Inline runtime functions have an underscore in front of the name. */ \ |
14808 if (inline_runtime_functions) { \ | 14798 if (inline_runtime_functions) { \ |
14809 name = factory->NewStringFromStaticAscii("_" #Name); \ | 14799 name = factory->NewStringFromStaticChars("_" #Name); \ |
14810 } else { \ | 14800 } else { \ |
14811 name = factory->NewStringFromStaticAscii(#Name); \ | 14801 name = factory->NewStringFromStaticChars(#Name); \ |
14812 } \ | 14802 } \ |
14813 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ | 14803 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ |
14814 pair_elements->set(0, *name); \ | 14804 pair_elements->set(0, *name); \ |
14815 pair_elements->set(1, Smi::FromInt(argc)); \ | 14805 pair_elements->set(1, Smi::FromInt(argc)); \ |
14816 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ | 14806 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ |
14817 elements->set(index++, *pair); \ | 14807 elements->set(index++, *pair); \ |
14818 } | 14808 } |
14819 inline_runtime_functions = false; | 14809 inline_runtime_functions = false; |
14820 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 14810 RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
14821 INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY) | 14811 INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY) |
14822 inline_runtime_functions = true; | 14812 inline_runtime_functions = true; |
14823 INLINE_FUNCTION_LIST(ADD_ENTRY) | 14813 INLINE_FUNCTION_LIST(ADD_ENTRY) |
14824 #undef ADD_ENTRY | 14814 #undef ADD_ENTRY |
14825 DCHECK_EQ(index, entry_count); | 14815 DCHECK_EQ(index, entry_count); |
14826 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); | 14816 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); |
14827 return *result; | 14817 return *result; |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15493 } | 15483 } |
15494 | 15484 |
15495 | 15485 |
15496 RUNTIME_FUNCTION(RuntimeReference_GetCachedArrayIndex) { | 15486 RUNTIME_FUNCTION(RuntimeReference_GetCachedArrayIndex) { |
15497 SealHandleScope shs(isolate); | 15487 SealHandleScope shs(isolate); |
15498 DCHECK(args.length() == 1); | 15488 DCHECK(args.length() == 1); |
15499 return isolate->heap()->undefined_value(); | 15489 return isolate->heap()->undefined_value(); |
15500 } | 15490 } |
15501 | 15491 |
15502 | 15492 |
15503 RUNTIME_FUNCTION(RuntimeReference_FastAsciiArrayJoin) { | 15493 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) { |
15504 SealHandleScope shs(isolate); | 15494 SealHandleScope shs(isolate); |
15505 DCHECK(args.length() == 2); | 15495 DCHECK(args.length() == 2); |
15506 return isolate->heap()->undefined_value(); | 15496 return isolate->heap()->undefined_value(); |
15507 } | 15497 } |
15508 | 15498 |
15509 | 15499 |
15510 RUNTIME_FUNCTION(RuntimeReference_GeneratorNext) { | 15500 RUNTIME_FUNCTION(RuntimeReference_GeneratorNext) { |
15511 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). | 15501 UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
15512 return NULL; | 15502 return NULL; |
15513 } | 15503 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15666 } | 15656 } |
15667 return NULL; | 15657 return NULL; |
15668 } | 15658 } |
15669 | 15659 |
15670 | 15660 |
15671 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15661 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15672 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15662 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15673 } | 15663 } |
15674 | 15664 |
15675 } } // namespace v8::internal | 15665 } } // namespace v8::internal |
OLD | NEW |