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 5571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, | 5582 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, |
5583 kFeedbackVectorOffset) | 5583 kFeedbackVectorOffset) |
5584 #if TRACE_MAPS | 5584 #if TRACE_MAPS |
5585 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) | 5585 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) |
5586 #endif | 5586 #endif |
5587 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5587 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
5588 kInstanceClassNameOffset) | 5588 kInstanceClassNameOffset) |
5589 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5589 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
5590 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5590 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
5591 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5591 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
5592 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 5592 ACCESSORS(SharedFunctionInfo, function_identifier, Object, |
5593 | 5593 kFunctionIdentifierOffset) |
5594 | 5594 |
5595 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) | 5595 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) |
5596 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 5596 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
5597 kHiddenPrototypeBit) | 5597 kHiddenPrototypeBit) |
5598 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) | 5598 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) |
5599 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, | 5599 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, |
5600 kNeedsAccessCheckBit) | 5600 kNeedsAccessCheckBit) |
5601 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, | 5601 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, |
5602 kReadOnlyPrototypeBit) | 5602 kReadOnlyPrototypeBit) |
5603 BOOL_ACCESSORS(FunctionTemplateInfo, flag, remove_prototype, | 5603 BOOL_ACCESSORS(FunctionTemplateInfo, flag, remove_prototype, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 5916 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { |
5917 DCHECK(IsApiFunction()); | 5917 DCHECK(IsApiFunction()); |
5918 return FunctionTemplateInfo::cast(function_data()); | 5918 return FunctionTemplateInfo::cast(function_data()); |
5919 } | 5919 } |
5920 | 5920 |
5921 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { | 5921 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { |
5922 DCHECK(function_data()->IsUndefined()); | 5922 DCHECK(function_data()->IsUndefined()); |
5923 set_function_data(data); | 5923 set_function_data(data); |
5924 } | 5924 } |
5925 | 5925 |
5926 bool SharedFunctionInfo::HasBuiltinFunctionId() { | |
5927 return function_data()->IsSmi(); | |
5928 } | |
5929 | |
5930 | |
5931 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() { | |
5932 DCHECK(HasBuiltinFunctionId()); | |
5933 return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value()); | |
5934 } | |
5935 | |
5936 void SharedFunctionInfo::set_builtin_function_id(BuiltinFunctionId id) { | |
5937 DCHECK(function_data()->IsUndefined() || HasBuiltinFunctionId()); | |
5938 set_function_data(Smi::FromInt(id)); | |
5939 } | |
5940 | |
5941 bool SharedFunctionInfo::HasBytecodeArray() { | 5926 bool SharedFunctionInfo::HasBytecodeArray() { |
5942 return function_data()->IsBytecodeArray(); | 5927 return function_data()->IsBytecodeArray(); |
5943 } | 5928 } |
5944 | 5929 |
5945 | 5930 |
5946 BytecodeArray* SharedFunctionInfo::bytecode_array() { | 5931 BytecodeArray* SharedFunctionInfo::bytecode_array() { |
5947 DCHECK(HasBytecodeArray()); | 5932 DCHECK(HasBytecodeArray()); |
5948 return BytecodeArray::cast(function_data()); | 5933 return BytecodeArray::cast(function_data()); |
5949 } | 5934 } |
5950 | 5935 |
5951 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { | 5936 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { |
5952 DCHECK(function_data()->IsUndefined()); | 5937 DCHECK(function_data()->IsUndefined()); |
5953 set_function_data(bytecode); | 5938 set_function_data(bytecode); |
5954 } | 5939 } |
5955 | 5940 |
5956 void SharedFunctionInfo::ClearBytecodeArray() { | 5941 void SharedFunctionInfo::ClearBytecodeArray() { |
5957 DCHECK(function_data()->IsUndefined() || HasBytecodeArray()); | 5942 DCHECK(function_data()->IsUndefined() || HasBytecodeArray()); |
5958 set_function_data(GetHeap()->undefined_value()); | 5943 set_function_data(GetHeap()->undefined_value()); |
5959 } | 5944 } |
5960 | 5945 |
| 5946 bool SharedFunctionInfo::HasBuiltinFunctionId() { |
| 5947 return function_identifier()->IsSmi(); |
| 5948 } |
| 5949 |
| 5950 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() { |
| 5951 DCHECK(HasBuiltinFunctionId()); |
| 5952 return static_cast<BuiltinFunctionId>( |
| 5953 Smi::cast(function_identifier())->value()); |
| 5954 } |
| 5955 |
| 5956 void SharedFunctionInfo::set_builtin_function_id(BuiltinFunctionId id) { |
| 5957 set_function_identifier(Smi::FromInt(id)); |
| 5958 } |
| 5959 |
| 5960 bool SharedFunctionInfo::HasInferredName() { |
| 5961 return function_identifier()->IsString(); |
| 5962 } |
| 5963 |
| 5964 String* SharedFunctionInfo::inferred_name() { |
| 5965 if (HasInferredName()) { |
| 5966 return String::cast(function_identifier()); |
| 5967 } |
| 5968 DCHECK(function_identifier()->IsUndefined() || HasBuiltinFunctionId()); |
| 5969 return GetIsolate()->heap()->empty_string(); |
| 5970 } |
| 5971 |
| 5972 void SharedFunctionInfo::set_inferred_name(String* inferred_name) { |
| 5973 DCHECK(function_identifier()->IsUndefined() || HasInferredName()); |
| 5974 set_function_identifier(inferred_name); |
| 5975 } |
| 5976 |
5961 int SharedFunctionInfo::ic_age() { | 5977 int SharedFunctionInfo::ic_age() { |
5962 return ICAgeBits::decode(counters()); | 5978 return ICAgeBits::decode(counters()); |
5963 } | 5979 } |
5964 | 5980 |
5965 | 5981 |
5966 void SharedFunctionInfo::set_ic_age(int ic_age) { | 5982 void SharedFunctionInfo::set_ic_age(int ic_age) { |
5967 set_counters(ICAgeBits::update(counters(), ic_age)); | 5983 set_counters(ICAgeBits::update(counters(), ic_age)); |
5968 } | 5984 } |
5969 | 5985 |
5970 | 5986 |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7789 #undef WRITE_INT64_FIELD | 7805 #undef WRITE_INT64_FIELD |
7790 #undef READ_BYTE_FIELD | 7806 #undef READ_BYTE_FIELD |
7791 #undef WRITE_BYTE_FIELD | 7807 #undef WRITE_BYTE_FIELD |
7792 #undef NOBARRIER_READ_BYTE_FIELD | 7808 #undef NOBARRIER_READ_BYTE_FIELD |
7793 #undef NOBARRIER_WRITE_BYTE_FIELD | 7809 #undef NOBARRIER_WRITE_BYTE_FIELD |
7794 | 7810 |
7795 } // namespace internal | 7811 } // namespace internal |
7796 } // namespace v8 | 7812 } // namespace v8 |
7797 | 7813 |
7798 #endif // V8_OBJECTS_INL_H_ | 7814 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |