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

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

Issue 2006673002: Reduce boilerplace for common pattern to return MaybeHandle. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 4 years, 7 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/runtime/runtime-i18n.cc ('k') | src/runtime/runtime-json.cc » ('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/ast/prettyprinter.h" 8 #include "src/ast/prettyprinter.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 362 }
363 363
364 364
365 RUNTIME_FUNCTION(Runtime_FormatMessageString) { 365 RUNTIME_FUNCTION(Runtime_FormatMessageString) {
366 HandleScope scope(isolate); 366 HandleScope scope(isolate);
367 DCHECK(args.length() == 4); 367 DCHECK(args.length() == 4);
368 CONVERT_INT32_ARG_CHECKED(template_index, 0); 368 CONVERT_INT32_ARG_CHECKED(template_index, 0);
369 CONVERT_ARG_HANDLE_CHECKED(String, arg0, 1); 369 CONVERT_ARG_HANDLE_CHECKED(String, arg0, 1);
370 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2); 370 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2);
371 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3); 371 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3);
372 Handle<String> result;
373 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
374 isolate, result,
375 MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2));
376 isolate->native_context()->IncrementErrorsThrown(); 372 isolate->native_context()->IncrementErrorsThrown();
377 return *result; 373 RETURN_RESULT_OR_FAILURE(isolate, MessageTemplate::FormatMessage(
374 template_index, arg0, arg1, arg2));
378 } 375 }
379 376
380 #define CALLSITE_GET(NAME, RETURN) \ 377 #define CALLSITE_GET(NAME, RETURN) \
381 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \ 378 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
382 HandleScope scope(isolate); \ 379 HandleScope scope(isolate); \
383 DCHECK(args.length() == 1); \ 380 DCHECK(args.length() == 1); \
384 CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \ 381 CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
385 Handle<String> result; \ 382 Handle<String> result; \
386 CallSite call_site(isolate, call_site_obj); \ 383 CallSite call_site(isolate, call_site_obj); \
387 RUNTIME_ASSERT(call_site.IsJavaScript() || call_site.IsWasm()); \ 384 RUNTIME_ASSERT(call_site.IsJavaScript() || call_site.IsWasm()); \
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 THROW_NEW_ERROR_RETURN_FAILURE( 505 THROW_NEW_ERROR_RETURN_FAILURE(
509 isolate, NewTypeError(MessageTemplate::kDerivedConstructorReturn)); 506 isolate, NewTypeError(MessageTemplate::kDerivedConstructorReturn));
510 } 507 }
511 508
512 509
513 // ES6 section 7.3.17 CreateListFromArrayLike (obj) 510 // ES6 section 7.3.17 CreateListFromArrayLike (obj)
514 RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) { 511 RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) {
515 HandleScope scope(isolate); 512 HandleScope scope(isolate);
516 DCHECK_EQ(1, args.length()); 513 DCHECK_EQ(1, args.length());
517 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 514 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
518 Handle<FixedArray> result; 515 RETURN_RESULT_OR_FAILURE(isolate, Object::CreateListFromArrayLike(
519 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 516 isolate, object, ElementTypes::kAll));
520 isolate, result,
521 Object::CreateListFromArrayLike(isolate, object, ElementTypes::kAll));
522 return *result;
523 } 517 }
524 518
525 519
526 RUNTIME_FUNCTION(Runtime_IncrementUseCounter) { 520 RUNTIME_FUNCTION(Runtime_IncrementUseCounter) {
527 HandleScope scope(isolate); 521 HandleScope scope(isolate);
528 DCHECK_EQ(1, args.length()); 522 DCHECK_EQ(1, args.length());
529 CONVERT_SMI_ARG_CHECKED(counter, 0); 523 CONVERT_SMI_ARG_CHECKED(counter, 0);
530 isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter)); 524 isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter));
531 return isolate->heap()->undefined_value(); 525 return isolate->heap()->undefined_value();
532 } 526 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 DCHECK(args.length() == 0); 584 DCHECK(args.length() == 0);
591 isolate->RunMicrotasks(); 585 isolate->RunMicrotasks();
592 return isolate->heap()->undefined_value(); 586 return isolate->heap()->undefined_value();
593 } 587 }
594 588
595 RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) { 589 RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
596 HandleScope scope(isolate); 590 HandleScope scope(isolate);
597 DCHECK_EQ(2, args.length()); 591 DCHECK_EQ(2, args.length());
598 CONVERT_ARG_HANDLE_CHECKED(Object, callable, 0); 592 CONVERT_ARG_HANDLE_CHECKED(Object, callable, 0);
599 CONVERT_ARG_HANDLE_CHECKED(Object, object, 1); 593 CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
600 Handle<Object> result; 594 RETURN_RESULT_OR_FAILURE(
601 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 595 isolate, Object::OrdinaryHasInstance(isolate, callable, object));
602 isolate, result, Object::OrdinaryHasInstance(isolate, callable, object));
603 return *result;
604 } 596 }
605 597
606 } // namespace internal 598 } // namespace internal
607 } // namespace v8 599 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-i18n.cc ('k') | src/runtime/runtime-json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698