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

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

Issue 2132493002: [runtime] Fully remove RUNTIME_ASSERT for good. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-runtime-assert-robust
Patch Set: Rebased. Created 4 years, 5 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
« no previous file with comments | « src/debug/mirrors.js ('k') | src/runtime/runtime-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 286 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
287 int start, end; 287 int start, end;
288 // We have a fast integer-only case here to avoid a conversion to double in 288 // We have a fast integer-only case here to avoid a conversion to double in
289 // the common case where from and to are Smis. 289 // the common case where from and to are Smis.
290 if (args[1]->IsSmi() && args[2]->IsSmi()) { 290 if (args[1]->IsSmi() && args[2]->IsSmi()) {
291 CONVERT_SMI_ARG_CHECKED(from_number, 1); 291 CONVERT_SMI_ARG_CHECKED(from_number, 1);
292 CONVERT_SMI_ARG_CHECKED(to_number, 2); 292 CONVERT_SMI_ARG_CHECKED(to_number, 2);
293 start = from_number; 293 start = from_number;
294 end = to_number; 294 end = to_number;
295 } else { 295 } else if (args[1]->IsNumber() && args[2]->IsNumber()) {
296 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); 296 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1);
297 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); 297 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2);
298 start = FastD2IChecked(from_number); 298 start = FastD2IChecked(from_number);
299 end = FastD2IChecked(to_number); 299 end = FastD2IChecked(to_number);
300 } else {
301 return isolate->ThrowIllegalOperation();
300 } 302 }
301 // The following condition is intentionally robust because the SubStringStub 303 // The following condition is intentionally robust because the SubStringStub
302 // delegates here and we test this in cctest/test-strings/RobustSubStringStub. 304 // delegates here and we test this in cctest/test-strings/RobustSubStringStub.
303 if (end < start || start < 0 || end > string->length()) { 305 if (end < start || start < 0 || end > string->length()) {
304 return isolate->ThrowIllegalOperation(); 306 return isolate->ThrowIllegalOperation();
305 } 307 }
306 isolate->counters()->sub_string_runtime()->Increment(); 308 isolate->counters()->sub_string_runtime()->Increment();
307 309
308 return *isolate->factory()->NewSubString(string, start, end); 310 return *isolate->factory()->NewSubString(string, start, end);
309 } 311 }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 SealHandleScope shs(isolate); 1210 SealHandleScope shs(isolate);
1209 DCHECK(args.length() == 2); 1211 DCHECK(args.length() == 2);
1210 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1212 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1211 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1213 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1212 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1214 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1213 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1215 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1214 } 1216 }
1215 1217
1216 } // namespace internal 1218 } // namespace internal
1217 } // namespace v8 1219 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/mirrors.js ('k') | src/runtime/runtime-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698