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

Side by Side Diff: src/objects-inl.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/objects.cc ('k') | src/runtime/runtime-array.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ 211 #define IS_TYPE_FUNCTION_DEF(Type, Value) \
212 bool Object::Is##Type(Isolate* isolate) const { \ 212 bool Object::Is##Type(Isolate* isolate) const { \
213 return this == isolate->heap()->Value(); \ 213 return this == isolate->heap()->Value(); \
214 } \ 214 } \
215 bool HeapObject::Is##Type(Isolate* isolate) const { \ 215 bool HeapObject::Is##Type(Isolate* isolate) const { \
216 return this == isolate->heap()->Value(); \ 216 return this == isolate->heap()->Value(); \
217 } 217 }
218 ODDBALL_LIST(IS_TYPE_FUNCTION_DEF) 218 ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
219 #undef IS_TYPE_FUNCTION_DEF 219 #undef IS_TYPE_FUNCTION_DEF
220 220
221 bool Object::IsNullOrUndefined(Isolate* isolate) const {
222 Heap* heap = isolate->heap();
223 return this == heap->null_value() || this == heap->undefined_value();
224 }
225
226 bool HeapObject::IsNullOrUndefined(Isolate* isolate) const {
227 Heap* heap = isolate->heap();
228 return this == heap->null_value() || this == heap->undefined_value();
229 }
230
221 bool HeapObject::IsString() const { 231 bool HeapObject::IsString() const {
222 return map()->instance_type() < FIRST_NONSTRING_TYPE; 232 return map()->instance_type() < FIRST_NONSTRING_TYPE;
223 } 233 }
224 234
225 bool HeapObject::IsName() const { 235 bool HeapObject::IsName() const {
226 return map()->instance_type() <= LAST_NAME_TYPE; 236 return map()->instance_type() <= LAST_NAME_TYPE;
227 } 237 }
228 238
229 bool HeapObject::IsUniqueName() const { 239 bool HeapObject::IsUniqueName() const {
230 return IsInternalizedString() || IsSymbol(); 240 return IsInternalizedString() || IsSymbol();
(...skipping 8220 matching lines...) Expand 10 before | Expand all | Expand 10 after
8451 #undef WRITE_INT64_FIELD 8461 #undef WRITE_INT64_FIELD
8452 #undef READ_BYTE_FIELD 8462 #undef READ_BYTE_FIELD
8453 #undef WRITE_BYTE_FIELD 8463 #undef WRITE_BYTE_FIELD
8454 #undef NOBARRIER_READ_BYTE_FIELD 8464 #undef NOBARRIER_READ_BYTE_FIELD
8455 #undef NOBARRIER_WRITE_BYTE_FIELD 8465 #undef NOBARRIER_WRITE_BYTE_FIELD
8456 8466
8457 } // namespace internal 8467 } // namespace internal
8458 } // namespace v8 8468 } // namespace v8
8459 8469
8460 #endif // V8_OBJECTS_INL_H_ 8470 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698