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

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

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master 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
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | src/s390/code-stubs-s390.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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 RUNTIME_FUNCTION(Runtime_CreateSymbol) { 15 RUNTIME_FUNCTION(Runtime_CreateSymbol) {
16 HandleScope scope(isolate); 16 HandleScope scope(isolate);
17 DCHECK(args.length() == 1); 17 DCHECK(args.length() == 1);
18 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); 18 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
19 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 19 RUNTIME_ASSERT(name->IsString() || name->IsUndefined(isolate));
20 Handle<Symbol> symbol = isolate->factory()->NewSymbol(); 20 Handle<Symbol> symbol = isolate->factory()->NewSymbol();
21 if (name->IsString()) symbol->set_name(*name); 21 if (name->IsString()) symbol->set_name(*name);
22 return *symbol; 22 return *symbol;
23 } 23 }
24 24
25 25
26 RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) { 26 RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) {
27 HandleScope scope(isolate); 27 HandleScope scope(isolate);
28 DCHECK(args.length() == 1); 28 DCHECK(args.length() == 1);
29 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); 29 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
30 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 30 RUNTIME_ASSERT(name->IsString() || name->IsUndefined(isolate));
31 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol(); 31 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol();
32 if (name->IsString()) symbol->set_name(*name); 32 if (name->IsString()) symbol->set_name(*name);
33 return *symbol; 33 return *symbol;
34 } 34 }
35 35
36 36
37 RUNTIME_FUNCTION(Runtime_SymbolDescription) { 37 RUNTIME_FUNCTION(Runtime_SymbolDescription) {
38 SealHandleScope shs(isolate); 38 SealHandleScope shs(isolate);
39 DCHECK(args.length() == 1); 39 DCHECK(args.length() == 1);
40 CONVERT_ARG_CHECKED(Symbol, symbol, 0); 40 CONVERT_ARG_CHECKED(Symbol, symbol, 0);
(...skipping 23 matching lines...) Expand all
64 64
65 65
66 RUNTIME_FUNCTION(Runtime_SymbolIsPrivate) { 66 RUNTIME_FUNCTION(Runtime_SymbolIsPrivate) {
67 SealHandleScope shs(isolate); 67 SealHandleScope shs(isolate);
68 DCHECK(args.length() == 1); 68 DCHECK(args.length() == 1);
69 CONVERT_ARG_CHECKED(Symbol, symbol, 0); 69 CONVERT_ARG_CHECKED(Symbol, symbol, 0);
70 return isolate->heap()->ToBoolean(symbol->is_private()); 70 return isolate->heap()->ToBoolean(symbol->is_private());
71 } 71 }
72 } // namespace internal 72 } // namespace internal
73 } // namespace v8 73 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698