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/builtins/builtins-utils.h

Issue 2601503002: Add Object::IsNullOrUndefined(Isolate*) helper method (Closed)
Patch Set: fixing merge conflicts Created 3 years, 11 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/builtins/builtins-object.cc ('k') | src/compiler/js-call-reducer.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ 5 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_
6 #define V8_BUILTINS_BUILTINS_UTILS_H_ 6 #define V8_BUILTINS_BUILTINS_UTILS_H_
7 7
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/builtins/builtins.h" 10 #include "src/builtins/builtins.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ 138 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \
139 isolate->factory()->NewStringFromAsciiChecked(method), \ 139 isolate->factory()->NewStringFromAsciiChecked(method), \
140 args.receiver())); \ 140 args.receiver())); \
141 } \ 141 } \
142 Handle<Type> name = Handle<Type>::cast(args.receiver()) 142 Handle<Type> name = Handle<Type>::cast(args.receiver())
143 143
144 // Throws a TypeError for {method} if the receiver is not coercible to Object, 144 // Throws a TypeError for {method} if the receiver is not coercible to Object,
145 // or converts the receiver to a String otherwise and assigns it to a new var 145 // or converts the receiver to a String otherwise and assigns it to a new var
146 // with the given {name}. 146 // with the given {name}.
147 #define TO_THIS_STRING(name, method) \ 147 #define TO_THIS_STRING(name, method) \
148 if (args.receiver()->IsNull(isolate) || \ 148 if (args.receiver()->IsNullOrUndefined(isolate)) { \
149 args.receiver()->IsUndefined(isolate)) { \
150 THROW_NEW_ERROR_RETURN_FAILURE( \ 149 THROW_NEW_ERROR_RETURN_FAILURE( \
151 isolate, \ 150 isolate, \
152 NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, \ 151 NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, \
153 isolate->factory()->NewStringFromAsciiChecked(method))); \ 152 isolate->factory()->NewStringFromAsciiChecked(method))); \
154 } \ 153 } \
155 Handle<String> name; \ 154 Handle<String> name; \
156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ 155 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
157 isolate, name, Object::ToString(isolate, args.receiver())) 156 isolate, name, Object::ToString(isolate, args.receiver()))
158 157
159 } // namespace internal 158 } // namespace internal
160 } // namespace v8 159 } // namespace v8
161 160
162 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ 161 #endif // V8_BUILTINS_BUILTINS_UTILS_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/compiler/js-call-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698