Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/objects-inl.h

Issue 1730853005: [interpreter] Make setting of function data more resilient. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-test-enable-strong
Patch Set: Addressed comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5799 matching lines...) Expand 10 before | Expand all | Expand 10 after
5810 bool SharedFunctionInfo::IsApiFunction() { 5810 bool SharedFunctionInfo::IsApiFunction() {
5811 return function_data()->IsFunctionTemplateInfo(); 5811 return function_data()->IsFunctionTemplateInfo();
5812 } 5812 }
5813 5813
5814 5814
5815 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { 5815 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() {
5816 DCHECK(IsApiFunction()); 5816 DCHECK(IsApiFunction());
5817 return FunctionTemplateInfo::cast(function_data()); 5817 return FunctionTemplateInfo::cast(function_data());
5818 } 5818 }
5819 5819
5820 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) {
5821 DCHECK(function_data()->IsUndefined());
5822 set_function_data(data);
5823 }
5820 5824
5821 bool SharedFunctionInfo::HasBuiltinFunctionId() { 5825 bool SharedFunctionInfo::HasBuiltinFunctionId() {
5822 return function_data()->IsSmi(); 5826 return function_data()->IsSmi();
5823 } 5827 }
5824 5828
5825 5829
5826 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() { 5830 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
5827 DCHECK(HasBuiltinFunctionId()); 5831 DCHECK(HasBuiltinFunctionId());
5828 return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value()); 5832 return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value());
5829 } 5833 }
5830 5834
5835 void SharedFunctionInfo::set_builtin_function_id(BuiltinFunctionId id) {
5836 DCHECK(function_data()->IsUndefined() || HasBuiltinFunctionId());
5837 set_function_data(Smi::FromInt(id));
5838 }
5831 5839
5832 bool SharedFunctionInfo::HasBytecodeArray() { 5840 bool SharedFunctionInfo::HasBytecodeArray() {
5833 return function_data()->IsBytecodeArray(); 5841 return function_data()->IsBytecodeArray();
5834 } 5842 }
5835 5843
5836 5844
5837 BytecodeArray* SharedFunctionInfo::bytecode_array() { 5845 BytecodeArray* SharedFunctionInfo::bytecode_array() {
5838 DCHECK(HasBytecodeArray()); 5846 DCHECK(HasBytecodeArray());
5839 return BytecodeArray::cast(function_data()); 5847 return BytecodeArray::cast(function_data());
5840 } 5848 }
5841 5849
5850 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) {
5851 DCHECK(function_data()->IsUndefined());
Michael Starzinger 2016/02/25 14:43:43 This would now imply the DCHECKs in compiler.cc ab
rmcilroy 2016/02/25 15:33:55 SGTM
5852 set_function_data(bytecode);
5853 }
5854
5855 void SharedFunctionInfo::ClearBytecodeArray() {
5856 DCHECK(function_data()->IsUndefined() || HasBytecodeArray());
5857 set_function_data(GetHeap()->undefined_value());
5858 }
5842 5859
5843 int SharedFunctionInfo::ic_age() { 5860 int SharedFunctionInfo::ic_age() {
5844 return ICAgeBits::decode(counters()); 5861 return ICAgeBits::decode(counters());
5845 } 5862 }
5846 5863
5847 5864
5848 void SharedFunctionInfo::set_ic_age(int ic_age) { 5865 void SharedFunctionInfo::set_ic_age(int ic_age) {
5849 set_counters(ICAgeBits::update(counters(), ic_age)); 5866 set_counters(ICAgeBits::update(counters(), ic_age));
5850 } 5867 }
5851 5868
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
7682 #undef WRITE_INT64_FIELD 7699 #undef WRITE_INT64_FIELD
7683 #undef READ_BYTE_FIELD 7700 #undef READ_BYTE_FIELD
7684 #undef WRITE_BYTE_FIELD 7701 #undef WRITE_BYTE_FIELD
7685 #undef NOBARRIER_READ_BYTE_FIELD 7702 #undef NOBARRIER_READ_BYTE_FIELD
7686 #undef NOBARRIER_WRITE_BYTE_FIELD 7703 #undef NOBARRIER_WRITE_BYTE_FIELD
7687 7704
7688 } // namespace internal 7705 } // namespace internal
7689 } // namespace v8 7706 } // namespace v8
7690 7707
7691 #endif // V8_OBJECTS_INL_H_ 7708 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698