| 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 781 } |
| 782 | 782 |
| 783 | 783 |
| 784 TYPE_CHECKER(Code, CODE_TYPE) | 784 TYPE_CHECKER(Code, CODE_TYPE) |
| 785 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 785 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
| 786 TYPE_CHECKER(Cell, CELL_TYPE) | 786 TYPE_CHECKER(Cell, CELL_TYPE) |
| 787 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) | 787 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
| 788 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 788 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
| 789 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 789 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 790 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 790 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
| 791 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | |
| 792 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 791 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
| 793 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 792 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
| 794 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 793 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
| 795 | 794 |
| 796 bool HeapObject::IsAbstractCode() const { | 795 bool HeapObject::IsAbstractCode() const { |
| 797 return IsBytecodeArray() || IsCode(); | 796 return IsBytecodeArray() || IsCode(); |
| 798 } | 797 } |
| 799 | 798 |
| 800 bool HeapObject::IsStringWrapper() const { | 799 bool HeapObject::IsStringWrapper() const { |
| 801 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 800 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 // Check for the most common kind of JavaScript object before | 2019 // Check for the most common kind of JavaScript object before |
| 2021 // falling into the generic switch. This speeds up the internal | 2020 // falling into the generic switch. This speeds up the internal |
| 2022 // field operations considerably on average. | 2021 // field operations considerably on average. |
| 2023 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 2022 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
| 2024 switch (type) { | 2023 switch (type) { |
| 2025 case JS_API_OBJECT_TYPE: | 2024 case JS_API_OBJECT_TYPE: |
| 2026 case JS_SPECIAL_API_OBJECT_TYPE: | 2025 case JS_SPECIAL_API_OBJECT_TYPE: |
| 2027 return JSObject::kHeaderSize; | 2026 return JSObject::kHeaderSize; |
| 2028 case JS_GENERATOR_OBJECT_TYPE: | 2027 case JS_GENERATOR_OBJECT_TYPE: |
| 2029 return JSGeneratorObject::kSize; | 2028 return JSGeneratorObject::kSize; |
| 2030 case JS_MODULE_TYPE: | |
| 2031 return JSModule::kSize; | |
| 2032 case JS_GLOBAL_PROXY_TYPE: | 2029 case JS_GLOBAL_PROXY_TYPE: |
| 2033 return JSGlobalProxy::kSize; | 2030 return JSGlobalProxy::kSize; |
| 2034 case JS_GLOBAL_OBJECT_TYPE: | 2031 case JS_GLOBAL_OBJECT_TYPE: |
| 2035 return JSGlobalObject::kSize; | 2032 return JSGlobalObject::kSize; |
| 2036 case JS_BOUND_FUNCTION_TYPE: | 2033 case JS_BOUND_FUNCTION_TYPE: |
| 2037 return JSBoundFunction::kSize; | 2034 return JSBoundFunction::kSize; |
| 2038 case JS_FUNCTION_TYPE: | 2035 case JS_FUNCTION_TYPE: |
| 2039 return JSFunction::kSize; | 2036 return JSFunction::kSize; |
| 2040 case JS_VALUE_TYPE: | 2037 case JS_VALUE_TYPE: |
| 2041 return JSValue::kSize; | 2038 return JSValue::kSize; |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3167 CAST_ACCESSOR(JSBoundFunction) | 3164 CAST_ACCESSOR(JSBoundFunction) |
| 3168 CAST_ACCESSOR(JSDataView) | 3165 CAST_ACCESSOR(JSDataView) |
| 3169 CAST_ACCESSOR(JSDate) | 3166 CAST_ACCESSOR(JSDate) |
| 3170 CAST_ACCESSOR(JSFunction) | 3167 CAST_ACCESSOR(JSFunction) |
| 3171 CAST_ACCESSOR(JSGeneratorObject) | 3168 CAST_ACCESSOR(JSGeneratorObject) |
| 3172 CAST_ACCESSOR(JSGlobalObject) | 3169 CAST_ACCESSOR(JSGlobalObject) |
| 3173 CAST_ACCESSOR(JSGlobalProxy) | 3170 CAST_ACCESSOR(JSGlobalProxy) |
| 3174 CAST_ACCESSOR(JSMap) | 3171 CAST_ACCESSOR(JSMap) |
| 3175 CAST_ACCESSOR(JSMapIterator) | 3172 CAST_ACCESSOR(JSMapIterator) |
| 3176 CAST_ACCESSOR(JSMessageObject) | 3173 CAST_ACCESSOR(JSMessageObject) |
| 3177 CAST_ACCESSOR(JSModule) | |
| 3178 CAST_ACCESSOR(JSObject) | 3174 CAST_ACCESSOR(JSObject) |
| 3179 CAST_ACCESSOR(JSProxy) | 3175 CAST_ACCESSOR(JSProxy) |
| 3180 CAST_ACCESSOR(JSReceiver) | 3176 CAST_ACCESSOR(JSReceiver) |
| 3181 CAST_ACCESSOR(JSRegExp) | 3177 CAST_ACCESSOR(JSRegExp) |
| 3182 CAST_ACCESSOR(JSSet) | 3178 CAST_ACCESSOR(JSSet) |
| 3183 CAST_ACCESSOR(JSSetIterator) | 3179 CAST_ACCESSOR(JSSetIterator) |
| 3184 CAST_ACCESSOR(JSTypedArray) | 3180 CAST_ACCESSOR(JSTypedArray) |
| 3185 CAST_ACCESSOR(JSValue) | 3181 CAST_ACCESSOR(JSValue) |
| 3186 CAST_ACCESSOR(JSWeakMap) | 3182 CAST_ACCESSOR(JSWeakMap) |
| 3187 CAST_ACCESSOR(JSWeakSet) | 3183 CAST_ACCESSOR(JSWeakSet) |
| (...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6355 } | 6351 } |
| 6356 | 6352 |
| 6357 bool JSGeneratorObject::is_closed() const { | 6353 bool JSGeneratorObject::is_closed() const { |
| 6358 return continuation() == kGeneratorClosed; | 6354 return continuation() == kGeneratorClosed; |
| 6359 } | 6355 } |
| 6360 | 6356 |
| 6361 bool JSGeneratorObject::is_executing() const { | 6357 bool JSGeneratorObject::is_executing() const { |
| 6362 return continuation() == kGeneratorExecuting; | 6358 return continuation() == kGeneratorExecuting; |
| 6363 } | 6359 } |
| 6364 | 6360 |
| 6365 ACCESSORS(JSModule, context, Object, kContextOffset) | |
| 6366 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) | |
| 6367 | |
| 6368 | |
| 6369 ACCESSORS(JSValue, value, Object, kValueOffset) | 6361 ACCESSORS(JSValue, value, Object, kValueOffset) |
| 6370 | 6362 |
| 6371 | 6363 |
| 6372 HeapNumber* HeapNumber::cast(Object* object) { | 6364 HeapNumber* HeapNumber::cast(Object* object) { |
| 6373 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); | 6365 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); |
| 6374 return reinterpret_cast<HeapNumber*>(object); | 6366 return reinterpret_cast<HeapNumber*>(object); |
| 6375 } | 6367 } |
| 6376 | 6368 |
| 6377 | 6369 |
| 6378 const HeapNumber* HeapNumber::cast(const Object* object) { | 6370 const HeapNumber* HeapNumber::cast(const Object* object) { |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7909 #undef WRITE_INT64_FIELD | 7901 #undef WRITE_INT64_FIELD |
| 7910 #undef READ_BYTE_FIELD | 7902 #undef READ_BYTE_FIELD |
| 7911 #undef WRITE_BYTE_FIELD | 7903 #undef WRITE_BYTE_FIELD |
| 7912 #undef NOBARRIER_READ_BYTE_FIELD | 7904 #undef NOBARRIER_READ_BYTE_FIELD |
| 7913 #undef NOBARRIER_WRITE_BYTE_FIELD | 7905 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7914 | 7906 |
| 7915 } // namespace internal | 7907 } // namespace internal |
| 7916 } // namespace v8 | 7908 } // namespace v8 |
| 7917 | 7909 |
| 7918 #endif // V8_OBJECTS_INL_H_ | 7910 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |