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 6087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6098 DCHECK(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); | 6098 DCHECK(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); |
6099 #ifdef DEBUG | 6099 #ifdef DEBUG |
6100 Code::VerifyRecompiledCode(code(), value); | 6100 Code::VerifyRecompiledCode(code(), value); |
6101 #endif // DEBUG | 6101 #endif // DEBUG |
6102 | 6102 |
6103 set_code(value); | 6103 set_code(value); |
6104 | 6104 |
6105 if (is_compiled()) set_never_compiled(false); | 6105 if (is_compiled()) set_never_compiled(false); |
6106 } | 6106 } |
6107 | 6107 |
| 6108 bool SharedFunctionInfo::HasBaselineCode() const { |
| 6109 return code()->kind() == Code::FUNCTION; |
| 6110 } |
6108 | 6111 |
6109 ScopeInfo* SharedFunctionInfo::scope_info() const { | 6112 ScopeInfo* SharedFunctionInfo::scope_info() const { |
6110 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); | 6113 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); |
6111 } | 6114 } |
6112 | 6115 |
6113 | 6116 |
6114 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, | 6117 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, |
6115 WriteBarrierMode mode) { | 6118 WriteBarrierMode mode) { |
6116 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 6119 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); |
6117 CONDITIONAL_WRITE_BARRIER(GetHeap(), | 6120 CONDITIONAL_WRITE_BARRIER(GetHeap(), |
6118 this, | 6121 this, |
6119 kScopeInfoOffset, | 6122 kScopeInfoOffset, |
6120 reinterpret_cast<Object*>(value), | 6123 reinterpret_cast<Object*>(value), |
6121 mode); | 6124 mode); |
6122 } | 6125 } |
6123 | 6126 |
6124 | 6127 bool SharedFunctionInfo::is_compiled() const { |
6125 bool SharedFunctionInfo::is_compiled() { | |
6126 Builtins* builtins = GetIsolate()->builtins(); | 6128 Builtins* builtins = GetIsolate()->builtins(); |
6127 DCHECK(code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent)); | 6129 DCHECK(code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent)); |
6128 DCHECK(code() != builtins->builtin(Builtins::kCompileOptimized)); | 6130 DCHECK(code() != builtins->builtin(Builtins::kCompileOptimized)); |
6129 DCHECK(code() != builtins->builtin(Builtins::kCompileBaseline)); | 6131 DCHECK(code() != builtins->builtin(Builtins::kCompileBaseline)); |
6130 return code() != builtins->builtin(Builtins::kCompileLazy); | 6132 return code() != builtins->builtin(Builtins::kCompileLazy); |
6131 } | 6133 } |
6132 | 6134 |
6133 | 6135 |
6134 bool SharedFunctionInfo::has_simple_parameters() { | 6136 bool SharedFunctionInfo::has_simple_parameters() { |
6135 return scope_info()->HasSimpleParameters(); | 6137 return scope_info()->HasSimpleParameters(); |
6136 } | 6138 } |
6137 | 6139 |
6138 | 6140 |
6139 bool SharedFunctionInfo::HasDebugInfo() { | 6141 bool SharedFunctionInfo::HasDebugInfo() { |
6140 bool has_debug_info = debug_info()->IsStruct(); | 6142 bool has_debug_info = debug_info()->IsStruct(); |
6141 DCHECK(!has_debug_info || HasDebugCode()); | 6143 DCHECK(!has_debug_info || HasDebugCode()); |
6142 return has_debug_info; | 6144 return has_debug_info; |
6143 } | 6145 } |
6144 | 6146 |
6145 | 6147 |
6146 DebugInfo* SharedFunctionInfo::GetDebugInfo() { | 6148 DebugInfo* SharedFunctionInfo::GetDebugInfo() { |
6147 DCHECK(HasDebugInfo()); | 6149 DCHECK(HasDebugInfo()); |
6148 return DebugInfo::cast(debug_info()); | 6150 return DebugInfo::cast(debug_info()); |
6149 } | 6151 } |
6150 | 6152 |
6151 | 6153 |
6152 bool SharedFunctionInfo::HasDebugCode() { | 6154 bool SharedFunctionInfo::HasDebugCode() { |
6153 return HasBytecodeArray() || | 6155 return HasBytecodeArray() || |
6154 (code()->kind() == Code::FUNCTION && code()->has_debug_break_slots()); | 6156 (HasBaselineCode() && code()->has_debug_break_slots()); |
6155 } | 6157 } |
6156 | 6158 |
6157 | 6159 |
6158 bool SharedFunctionInfo::IsApiFunction() { | 6160 bool SharedFunctionInfo::IsApiFunction() { |
6159 return function_data()->IsFunctionTemplateInfo(); | 6161 return function_data()->IsFunctionTemplateInfo(); |
6160 } | 6162 } |
6161 | 6163 |
6162 | 6164 |
6163 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 6165 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { |
6164 DCHECK(IsApiFunction()); | 6166 DCHECK(IsApiFunction()); |
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8186 #undef WRITE_INT64_FIELD | 8188 #undef WRITE_INT64_FIELD |
8187 #undef READ_BYTE_FIELD | 8189 #undef READ_BYTE_FIELD |
8188 #undef WRITE_BYTE_FIELD | 8190 #undef WRITE_BYTE_FIELD |
8189 #undef NOBARRIER_READ_BYTE_FIELD | 8191 #undef NOBARRIER_READ_BYTE_FIELD |
8190 #undef NOBARRIER_WRITE_BYTE_FIELD | 8192 #undef NOBARRIER_WRITE_BYTE_FIELD |
8191 | 8193 |
8192 } // namespace internal | 8194 } // namespace internal |
8193 } // namespace v8 | 8195 } // namespace v8 |
8194 | 8196 |
8195 #endif // V8_OBJECTS_INL_H_ | 8197 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |