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

Side by Side Diff: src/runtime/runtime-symbol.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-strings.cc ('k') | src/runtime/runtime-uri.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/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/string-builder.h" 10 #include "src/string-builder.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) { 45 RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) {
46 HandleScope scope(isolate); 46 HandleScope scope(isolate);
47 DCHECK_EQ(1, args.length()); 47 DCHECK_EQ(1, args.length());
48 CONVERT_ARG_HANDLE_CHECKED(Symbol, symbol, 0); 48 CONVERT_ARG_HANDLE_CHECKED(Symbol, symbol, 0);
49 IncrementalStringBuilder builder(isolate); 49 IncrementalStringBuilder builder(isolate);
50 builder.AppendCString("Symbol("); 50 builder.AppendCString("Symbol(");
51 if (symbol->name()->IsString()) { 51 if (symbol->name()->IsString()) {
52 builder.AppendString(handle(String::cast(symbol->name()), isolate)); 52 builder.AppendString(handle(String::cast(symbol->name()), isolate));
53 } 53 }
54 builder.AppendCharacter(')'); 54 builder.AppendCharacter(')');
55 Handle<String> result; 55 RETURN_RESULT_OR_FAILURE(isolate, builder.Finish());
56 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, builder.Finish());
57 return *result;
58 } 56 }
59 57
60 58
61 RUNTIME_FUNCTION(Runtime_SymbolRegistry) { 59 RUNTIME_FUNCTION(Runtime_SymbolRegistry) {
62 HandleScope scope(isolate); 60 HandleScope scope(isolate);
63 DCHECK(args.length() == 0); 61 DCHECK(args.length() == 0);
64 return *isolate->GetSymbolRegistry(); 62 return *isolate->GetSymbolRegistry();
65 } 63 }
66 64
67 65
68 RUNTIME_FUNCTION(Runtime_SymbolIsPrivate) { 66 RUNTIME_FUNCTION(Runtime_SymbolIsPrivate) {
69 SealHandleScope shs(isolate); 67 SealHandleScope shs(isolate);
70 DCHECK(args.length() == 1); 68 DCHECK(args.length() == 1);
71 CONVERT_ARG_CHECKED(Symbol, symbol, 0); 69 CONVERT_ARG_CHECKED(Symbol, symbol, 0);
72 return isolate->heap()->ToBoolean(symbol->is_private()); 70 return isolate->heap()->ToBoolean(symbol->is_private());
73 } 71 }
74 } // namespace internal 72 } // namespace internal
75 } // namespace v8 73 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | src/runtime/runtime-uri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698