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 5883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5894 } | 5894 } |
5895 | 5895 |
5896 | 5896 |
5897 DebugInfo* SharedFunctionInfo::GetDebugInfo() { | 5897 DebugInfo* SharedFunctionInfo::GetDebugInfo() { |
5898 DCHECK(HasDebugInfo()); | 5898 DCHECK(HasDebugInfo()); |
5899 return DebugInfo::cast(debug_info()); | 5899 return DebugInfo::cast(debug_info()); |
5900 } | 5900 } |
5901 | 5901 |
5902 | 5902 |
5903 bool SharedFunctionInfo::HasDebugCode() { | 5903 bool SharedFunctionInfo::HasDebugCode() { |
5904 return IsInterpreted() || | 5904 return HasBytecodeArray() || |
5905 (code()->kind() == Code::FUNCTION && code()->has_debug_break_slots()); | 5905 (code()->kind() == Code::FUNCTION && code()->has_debug_break_slots()); |
5906 } | 5906 } |
5907 | 5907 |
5908 | 5908 |
5909 bool SharedFunctionInfo::IsApiFunction() { | 5909 bool SharedFunctionInfo::IsApiFunction() { |
5910 return function_data()->IsFunctionTemplateInfo(); | 5910 return function_data()->IsFunctionTemplateInfo(); |
5911 } | 5911 } |
5912 | 5912 |
5913 | 5913 |
5914 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 5914 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { |
5915 DCHECK(IsApiFunction()); | 5915 DCHECK(IsApiFunction()); |
5916 return FunctionTemplateInfo::cast(function_data()); | 5916 return FunctionTemplateInfo::cast(function_data()); |
5917 } | 5917 } |
5918 | 5918 |
5919 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { | 5919 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { |
5920 DCHECK(function_data()->IsUndefined()); | 5920 DCHECK(function_data()->IsUndefined()); |
5921 set_function_data(data); | 5921 set_function_data(data); |
5922 } | 5922 } |
5923 | 5923 |
5924 bool SharedFunctionInfo::HasBytecodeArray() { | 5924 bool SharedFunctionInfo::HasBytecodeArray() { |
5925 return function_data()->IsBytecodeArray(); | 5925 return function_data()->IsBytecodeArray(); |
5926 } | 5926 } |
5927 | 5927 |
5928 bool SharedFunctionInfo::IsInterpreted() { | |
5929 // Currently, having bytecode does not mean the function is actually being | |
5930 // interpreted. However, the debugger has to know precisely what is going to | |
5931 // be executed. | |
5932 // TODO(yangguo,mstarzinger): make this a synonym of HasBytecodeArray(). | |
5933 return code() == | |
5934 GetIsolate()->builtins()->builtin( | |
5935 Builtins::kInterpreterEntryTrampoline); | |
5936 } | |
5937 | |
5938 BytecodeArray* SharedFunctionInfo::bytecode_array() { | 5928 BytecodeArray* SharedFunctionInfo::bytecode_array() { |
5939 DCHECK(HasBytecodeArray()); | 5929 DCHECK(HasBytecodeArray()); |
5940 return BytecodeArray::cast(function_data()); | 5930 return BytecodeArray::cast(function_data()); |
5941 } | 5931 } |
5942 | 5932 |
5943 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { | 5933 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { |
5944 DCHECK(function_data()->IsUndefined()); | 5934 DCHECK(function_data()->IsUndefined()); |
5945 set_function_data(bytecode); | 5935 set_function_data(bytecode); |
5946 } | 5936 } |
5947 | 5937 |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7851 #undef WRITE_INT64_FIELD | 7841 #undef WRITE_INT64_FIELD |
7852 #undef READ_BYTE_FIELD | 7842 #undef READ_BYTE_FIELD |
7853 #undef WRITE_BYTE_FIELD | 7843 #undef WRITE_BYTE_FIELD |
7854 #undef NOBARRIER_READ_BYTE_FIELD | 7844 #undef NOBARRIER_READ_BYTE_FIELD |
7855 #undef NOBARRIER_WRITE_BYTE_FIELD | 7845 #undef NOBARRIER_WRITE_BYTE_FIELD |
7856 | 7846 |
7857 } // namespace internal | 7847 } // namespace internal |
7858 } // namespace v8 | 7848 } // namespace v8 |
7859 | 7849 |
7860 #endif // V8_OBJECTS_INL_H_ | 7850 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |