| OLD | NEW |
| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 149 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) |
| 150 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 150 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) |
| 151 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 151 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
| 152 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) | 152 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) |
| 153 | 153 |
| 154 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ | 154 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ |
| 155 bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); } | 155 bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); } |
| 156 SIMD128_TYPES(SIMD128_TYPE_CHECKER) | 156 SIMD128_TYPES(SIMD128_TYPE_CHECKER) |
| 157 #undef SIMD128_TYPE_CHECKER | 157 #undef SIMD128_TYPE_CHECKER |
| 158 | 158 |
| 159 // TODO(cbruni): remove once all the isolate-based versions are in place. | |
| 160 #define IS_TYPE_FUNCTION_DEF(type_) \ | 159 #define IS_TYPE_FUNCTION_DEF(type_) \ |
| 161 bool Object::Is##type_() const { \ | 160 bool Object::Is##type_() const { \ |
| 162 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ | 161 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ |
| 163 } | 162 } |
| 164 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) | 163 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) |
| 165 #undef IS_TYPE_FUNCTION_DEF | 164 #undef IS_TYPE_FUNCTION_DEF |
| 166 | 165 |
| 167 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ | 166 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ |
| 168 bool Object::Is##Type(Isolate* isolate) const { \ | 167 bool Object::Is##Type(Isolate* isolate) const { \ |
| 169 return this == isolate->heap()->Value(); \ | 168 return this == isolate->heap()->Value(); \ |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 return obj->IsJSFunction(); | 779 return obj->IsJSFunction(); |
| 781 } | 780 } |
| 782 | 781 |
| 783 | 782 |
| 784 TYPE_CHECKER(Code, CODE_TYPE) | 783 TYPE_CHECKER(Code, CODE_TYPE) |
| 785 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 784 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
| 786 TYPE_CHECKER(Cell, CELL_TYPE) | 785 TYPE_CHECKER(Cell, CELL_TYPE) |
| 787 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) | 786 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
| 788 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 787 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
| 789 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 788 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 789 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
| 790 TYPE_CHECKER(JSError, JS_ERROR_TYPE) |
| 790 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 791 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
| 792 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
| 791 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | 793 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
| 792 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 794 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
| 793 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | |
| 794 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | |
| 795 | 795 |
| 796 bool HeapObject::IsAbstractCode() const { | 796 bool HeapObject::IsAbstractCode() const { |
| 797 return IsBytecodeArray() || IsCode(); | 797 return IsBytecodeArray() || IsCode(); |
| 798 } | 798 } |
| 799 | 799 |
| 800 bool HeapObject::IsStringWrapper() const { | 800 bool HeapObject::IsStringWrapper() const { |
| 801 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 801 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
| 802 } | 802 } |
| 803 | 803 |
| 804 | 804 |
| (...skipping 7146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7951 #undef WRITE_INT64_FIELD | 7951 #undef WRITE_INT64_FIELD |
| 7952 #undef READ_BYTE_FIELD | 7952 #undef READ_BYTE_FIELD |
| 7953 #undef WRITE_BYTE_FIELD | 7953 #undef WRITE_BYTE_FIELD |
| 7954 #undef NOBARRIER_READ_BYTE_FIELD | 7954 #undef NOBARRIER_READ_BYTE_FIELD |
| 7955 #undef NOBARRIER_WRITE_BYTE_FIELD | 7955 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7956 | 7956 |
| 7957 } // namespace internal | 7957 } // namespace internal |
| 7958 } // namespace v8 | 7958 } // namespace v8 |
| 7959 | 7959 |
| 7960 #endif // V8_OBJECTS_INL_H_ | 7960 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |