| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 TYPE_CHECKER(Code, CODE_TYPE) | 783 TYPE_CHECKER(Code, CODE_TYPE) |
| 784 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 784 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
| 785 TYPE_CHECKER(Cell, CELL_TYPE) | 785 TYPE_CHECKER(Cell, CELL_TYPE) |
| 786 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) | 786 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
| 787 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 787 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
| 788 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 788 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 789 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 789 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
| 790 TYPE_CHECKER(JSError, JS_ERROR_TYPE) | 790 TYPE_CHECKER(JSError, JS_ERROR_TYPE) |
| 791 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 791 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
| 792 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 792 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
| 793 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | |
| 794 TYPE_CHECKER(JSPromise, JS_PROMISE_TYPE) | 793 TYPE_CHECKER(JSPromise, JS_PROMISE_TYPE) |
| 795 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 794 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
| 796 | 795 |
| 797 bool HeapObject::IsAbstractCode() const { | 796 bool HeapObject::IsAbstractCode() const { |
| 798 return IsBytecodeArray() || IsCode(); | 797 return IsBytecodeArray() || IsCode(); |
| 799 } | 798 } |
| 800 | 799 |
| 801 bool HeapObject::IsStringWrapper() const { | 800 bool HeapObject::IsStringWrapper() const { |
| 802 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 801 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
| 803 } | 802 } |
| (...skipping 1216 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 CAST_ACCESSOR(JSBoundFunction) | 3168 CAST_ACCESSOR(JSBoundFunction) |
| 3172 CAST_ACCESSOR(JSDataView) | 3169 CAST_ACCESSOR(JSDataView) |
| 3173 CAST_ACCESSOR(JSDate) | 3170 CAST_ACCESSOR(JSDate) |
| 3174 CAST_ACCESSOR(JSFunction) | 3171 CAST_ACCESSOR(JSFunction) |
| 3175 CAST_ACCESSOR(JSGeneratorObject) | 3172 CAST_ACCESSOR(JSGeneratorObject) |
| 3176 CAST_ACCESSOR(JSGlobalObject) | 3173 CAST_ACCESSOR(JSGlobalObject) |
| 3177 CAST_ACCESSOR(JSGlobalProxy) | 3174 CAST_ACCESSOR(JSGlobalProxy) |
| 3178 CAST_ACCESSOR(JSMap) | 3175 CAST_ACCESSOR(JSMap) |
| 3179 CAST_ACCESSOR(JSMapIterator) | 3176 CAST_ACCESSOR(JSMapIterator) |
| 3180 CAST_ACCESSOR(JSMessageObject) | 3177 CAST_ACCESSOR(JSMessageObject) |
| 3181 CAST_ACCESSOR(JSModule) | |
| 3182 CAST_ACCESSOR(JSObject) | 3178 CAST_ACCESSOR(JSObject) |
| 3183 CAST_ACCESSOR(JSProxy) | 3179 CAST_ACCESSOR(JSProxy) |
| 3184 CAST_ACCESSOR(JSReceiver) | 3180 CAST_ACCESSOR(JSReceiver) |
| 3185 CAST_ACCESSOR(JSRegExp) | 3181 CAST_ACCESSOR(JSRegExp) |
| 3186 CAST_ACCESSOR(JSSet) | 3182 CAST_ACCESSOR(JSSet) |
| 3187 CAST_ACCESSOR(JSSetIterator) | 3183 CAST_ACCESSOR(JSSetIterator) |
| 3188 CAST_ACCESSOR(JSTypedArray) | 3184 CAST_ACCESSOR(JSTypedArray) |
| 3189 CAST_ACCESSOR(JSValue) | 3185 CAST_ACCESSOR(JSValue) |
| 3190 CAST_ACCESSOR(JSWeakMap) | 3186 CAST_ACCESSOR(JSWeakMap) |
| 3191 CAST_ACCESSOR(JSWeakSet) | 3187 CAST_ACCESSOR(JSWeakSet) |
| (...skipping 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6385 } | 6381 } |
| 6386 | 6382 |
| 6387 bool JSGeneratorObject::is_closed() const { | 6383 bool JSGeneratorObject::is_closed() const { |
| 6388 return continuation() == kGeneratorClosed; | 6384 return continuation() == kGeneratorClosed; |
| 6389 } | 6385 } |
| 6390 | 6386 |
| 6391 bool JSGeneratorObject::is_executing() const { | 6387 bool JSGeneratorObject::is_executing() const { |
| 6392 return continuation() == kGeneratorExecuting; | 6388 return continuation() == kGeneratorExecuting; |
| 6393 } | 6389 } |
| 6394 | 6390 |
| 6395 ACCESSORS(JSModule, context, Object, kContextOffset) | |
| 6396 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) | |
| 6397 | |
| 6398 | |
| 6399 ACCESSORS(JSValue, value, Object, kValueOffset) | 6391 ACCESSORS(JSValue, value, Object, kValueOffset) |
| 6400 | 6392 |
| 6401 | 6393 |
| 6402 HeapNumber* HeapNumber::cast(Object* object) { | 6394 HeapNumber* HeapNumber::cast(Object* object) { |
| 6403 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); | 6395 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); |
| 6404 return reinterpret_cast<HeapNumber*>(object); | 6396 return reinterpret_cast<HeapNumber*>(object); |
| 6405 } | 6397 } |
| 6406 | 6398 |
| 6407 | 6399 |
| 6408 const HeapNumber* HeapNumber::cast(const Object* object) { | 6400 const HeapNumber* HeapNumber::cast(const Object* object) { |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7961 #undef WRITE_INT64_FIELD | 7953 #undef WRITE_INT64_FIELD |
| 7962 #undef READ_BYTE_FIELD | 7954 #undef READ_BYTE_FIELD |
| 7963 #undef WRITE_BYTE_FIELD | 7955 #undef WRITE_BYTE_FIELD |
| 7964 #undef NOBARRIER_READ_BYTE_FIELD | 7956 #undef NOBARRIER_READ_BYTE_FIELD |
| 7965 #undef NOBARRIER_WRITE_BYTE_FIELD | 7957 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7966 | 7958 |
| 7967 } // namespace internal | 7959 } // namespace internal |
| 7968 } // namespace v8 | 7960 } // namespace v8 |
| 7969 | 7961 |
| 7970 #endif // V8_OBJECTS_INL_H_ | 7962 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |