OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/regexp/jsregexp-inl.h" | 8 #include "src/regexp/jsregexp-inl.h" |
9 #include "src/string-builder.h" | 9 #include "src/string-builder.h" |
10 #include "src/string-search.h" | 10 #include "src/string-search.h" |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 } | 1049 } |
1050 | 1050 |
1051 Handle<SeqString> result; // Same length as input. | 1051 Handle<SeqString> result; // Same length as input. |
1052 if (s->IsOneByteRepresentation()) { | 1052 if (s->IsOneByteRepresentation()) { |
1053 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); | 1053 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); |
1054 } else { | 1054 } else { |
1055 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); | 1055 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); |
1056 } | 1056 } |
1057 | 1057 |
1058 Object* answer = ConvertCaseHelper(isolate, *s, *result, length, mapping); | 1058 Object* answer = ConvertCaseHelper(isolate, *s, *result, length, mapping); |
1059 if (answer->IsException() || answer->IsString()) return answer; | 1059 if (answer->IsException(isolate) || answer->IsString()) return answer; |
1060 | 1060 |
1061 DCHECK(answer->IsSmi()); | 1061 DCHECK(answer->IsSmi()); |
1062 length = Smi::cast(answer)->value(); | 1062 length = Smi::cast(answer)->value(); |
1063 if (s->IsOneByteRepresentation() && length > 0) { | 1063 if (s->IsOneByteRepresentation() && length > 0) { |
1064 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1064 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1065 isolate, result, isolate->factory()->NewRawOneByteString(length)); | 1065 isolate, result, isolate->factory()->NewRawOneByteString(length)); |
1066 } else { | 1066 } else { |
1067 if (length < 0) length = -length; | 1067 if (length < 0) length = -length; |
1068 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1068 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1069 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 1069 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 SealHandleScope shs(isolate); | 1206 SealHandleScope shs(isolate); |
1207 DCHECK(args.length() == 2); | 1207 DCHECK(args.length() == 2); |
1208 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); | 1208 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); |
1209 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); | 1209 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); |
1210 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); | 1210 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); |
1211 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); | 1211 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); |
1212 } | 1212 } |
1213 | 1213 |
1214 } // namespace internal | 1214 } // namespace internal |
1215 } // namespace v8 | 1215 } // namespace v8 |
OLD | NEW |