Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Side by Side Diff: src/runtime/runtime-strings.cc

Issue 2043183003: Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplifying checks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 } 1050 }
1051 1051
1052 Handle<SeqString> result; // Same length as input. 1052 Handle<SeqString> result; // Same length as input.
1053 if (s->IsOneByteRepresentation()) { 1053 if (s->IsOneByteRepresentation()) {
1054 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked(); 1054 result = isolate->factory()->NewRawOneByteString(length).ToHandleChecked();
1055 } else { 1055 } else {
1056 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked(); 1056 result = isolate->factory()->NewRawTwoByteString(length).ToHandleChecked();
1057 } 1057 }
1058 1058
1059 Object* answer = ConvertCaseHelper(isolate, *s, *result, length, mapping); 1059 Object* answer = ConvertCaseHelper(isolate, *s, *result, length, mapping);
1060 if (answer->IsException() || answer->IsString()) return answer; 1060 if (answer->IsException(isolate) || answer->IsString()) return answer;
1061 1061
1062 DCHECK(answer->IsSmi()); 1062 DCHECK(answer->IsSmi());
1063 length = Smi::cast(answer)->value(); 1063 length = Smi::cast(answer)->value();
1064 if (s->IsOneByteRepresentation() && length > 0) { 1064 if (s->IsOneByteRepresentation() && length > 0) {
1065 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1065 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1066 isolate, result, isolate->factory()->NewRawOneByteString(length)); 1066 isolate, result, isolate->factory()->NewRawOneByteString(length));
1067 } else { 1067 } else {
1068 if (length < 0) length = -length; 1068 if (length < 0) length = -length;
1069 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1069 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1070 isolate, result, isolate->factory()->NewRawTwoByteString(length)); 1070 isolate, result, isolate->factory()->NewRawTwoByteString(length));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 SealHandleScope shs(isolate); 1207 SealHandleScope shs(isolate);
1208 DCHECK(args.length() == 2); 1208 DCHECK(args.length() == 2);
1209 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1209 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1210 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1210 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1211 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1211 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1212 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1212 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1213 } 1213 }
1214 1214
1215 } // namespace internal 1215 } // namespace internal
1216 } // namespace v8 1216 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698