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 4054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4065 } else { | 4065 } else { |
4066 set_bit_field2(bit_field2() & ~(1 << kIsExtensible)); | 4066 set_bit_field2(bit_field2() & ~(1 << kIsExtensible)); |
4067 } | 4067 } |
4068 } | 4068 } |
4069 | 4069 |
4070 bool Map::is_extensible() { | 4070 bool Map::is_extensible() { |
4071 return ((1 << kIsExtensible) & bit_field2()) != 0; | 4071 return ((1 << kIsExtensible) & bit_field2()) != 0; |
4072 } | 4072 } |
4073 | 4073 |
4074 | 4074 |
| 4075 void Map::set_attached_to_shared_function_info(bool value) { |
| 4076 if (value) { |
| 4077 set_bit_field2(bit_field2() | (1 << kAttachedToSharedFunctionInfo)); |
| 4078 } else { |
| 4079 set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo)); |
| 4080 } |
| 4081 } |
| 4082 |
| 4083 bool Map::attached_to_shared_function_info() { |
| 4084 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; |
| 4085 } |
| 4086 |
| 4087 |
4075 void Map::set_is_shared(bool value) { | 4088 void Map::set_is_shared(bool value) { |
4076 set_bit_field3(IsShared::update(bit_field3(), value)); | 4089 set_bit_field3(IsShared::update(bit_field3(), value)); |
4077 } | 4090 } |
4078 | 4091 |
4079 | 4092 |
4080 bool Map::is_shared() { | 4093 bool Map::is_shared() { |
4081 return IsShared::decode(bit_field3()); } | 4094 return IsShared::decode(bit_field3()); } |
4082 | 4095 |
4083 | 4096 |
4084 void Map::set_dictionary_map(bool value) { | 4097 void Map::set_dictionary_map(bool value) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4131 void Map::set_migration_target(bool value) { | 4144 void Map::set_migration_target(bool value) { |
4132 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); | 4145 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); |
4133 } | 4146 } |
4134 | 4147 |
4135 | 4148 |
4136 bool Map::is_migration_target() { | 4149 bool Map::is_migration_target() { |
4137 return IsMigrationTarget::decode(bit_field3()); | 4150 return IsMigrationTarget::decode(bit_field3()); |
4138 } | 4151 } |
4139 | 4152 |
4140 | 4153 |
4141 void Map::set_done_inobject_slack_tracking(bool value) { | |
4142 set_bit_field3(DoneInobjectSlackTracking::update(bit_field3(), value)); | |
4143 } | |
4144 | |
4145 | |
4146 bool Map::done_inobject_slack_tracking() { | |
4147 return DoneInobjectSlackTracking::decode(bit_field3()); | |
4148 } | |
4149 | |
4150 | |
4151 void Map::set_construction_count(int value) { | |
4152 set_bit_field3(ConstructionCount::update(bit_field3(), value)); | |
4153 } | |
4154 | |
4155 | |
4156 int Map::construction_count() { | |
4157 return ConstructionCount::decode(bit_field3()); | |
4158 } | |
4159 | |
4160 | |
4161 void Map::freeze() { | 4154 void Map::freeze() { |
4162 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 4155 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
4163 } | 4156 } |
4164 | 4157 |
4165 | 4158 |
4166 bool Map::is_frozen() { | 4159 bool Map::is_frozen() { |
4167 return IsFrozen::decode(bit_field3()); | 4160 return IsFrozen::decode(bit_field3()); |
4168 } | 4161 } |
4169 | 4162 |
4170 | 4163 |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5051 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) | 5044 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) |
5052 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) | 5045 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) |
5053 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5046 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
5054 | 5047 |
5055 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5048 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
5056 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object, | 5049 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object, |
5057 kOptimizedCodeMapOffset) | 5050 kOptimizedCodeMapOffset) |
5058 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5051 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
5059 ACCESSORS(SharedFunctionInfo, feedback_vector, FixedArray, | 5052 ACCESSORS(SharedFunctionInfo, feedback_vector, FixedArray, |
5060 kFeedbackVectorOffset) | 5053 kFeedbackVectorOffset) |
| 5054 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset) |
5061 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5055 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
5062 kInstanceClassNameOffset) | 5056 kInstanceClassNameOffset) |
5063 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5057 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
5064 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5058 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
5065 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5059 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
5066 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 5060 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
5067 | 5061 |
5068 | 5062 |
5069 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) | 5063 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) |
5070 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 5064 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5175 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 5169 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
5176 ast_node_count, | 5170 ast_node_count, |
5177 kAstNodeCountOffset) | 5171 kAstNodeCountOffset) |
5178 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5172 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
5179 profiler_ticks, | 5173 profiler_ticks, |
5180 kProfilerTicksOffset) | 5174 kProfilerTicksOffset) |
5181 | 5175 |
5182 #endif | 5176 #endif |
5183 | 5177 |
5184 | 5178 |
| 5179 int SharedFunctionInfo::construction_count() { |
| 5180 return READ_BYTE_FIELD(this, kConstructionCountOffset); |
| 5181 } |
| 5182 |
| 5183 |
| 5184 void SharedFunctionInfo::set_construction_count(int value) { |
| 5185 ASSERT(0 <= value && value < 256); |
| 5186 WRITE_BYTE_FIELD(this, kConstructionCountOffset, static_cast<byte>(value)); |
| 5187 } |
| 5188 |
| 5189 |
| 5190 BOOL_ACCESSORS(SharedFunctionInfo, |
| 5191 compiler_hints, |
| 5192 live_objects_may_exist, |
| 5193 kLiveObjectsMayExist) |
| 5194 |
| 5195 |
| 5196 bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() { |
| 5197 return initial_map() != GetHeap()->undefined_value(); |
| 5198 } |
| 5199 |
| 5200 |
5185 BOOL_GETTER(SharedFunctionInfo, | 5201 BOOL_GETTER(SharedFunctionInfo, |
5186 compiler_hints, | 5202 compiler_hints, |
5187 optimization_disabled, | 5203 optimization_disabled, |
5188 kOptimizationDisabled) | 5204 kOptimizationDisabled) |
5189 | 5205 |
5190 | 5206 |
5191 void SharedFunctionInfo::set_optimization_disabled(bool disable) { | 5207 void SharedFunctionInfo::set_optimization_disabled(bool disable) { |
5192 set_compiler_hints(BooleanBit::set(compiler_hints(), | 5208 set_compiler_hints(BooleanBit::set(compiler_hints(), |
5193 kOptimizationDisabled, | 5209 kOptimizationDisabled, |
5194 disable)); | 5210 disable)); |
(...skipping 30 matching lines...) Expand all Loading... |
5225 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 5241 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
5226 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 5242 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
5227 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, | 5243 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, |
5228 kDontOptimize) | 5244 kDontOptimize) |
5229 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) | 5245 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) |
5230 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) | 5246 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) |
5231 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush) | 5247 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush) |
5232 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_generator, kIsGenerator) | 5248 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_generator, kIsGenerator) |
5233 | 5249 |
5234 void SharedFunctionInfo::BeforeVisitingPointers() { | 5250 void SharedFunctionInfo::BeforeVisitingPointers() { |
| 5251 if (IsInobjectSlackTrackingInProgress()) DetachInitialMap(); |
5235 } | 5252 } |
5236 | 5253 |
5237 | 5254 |
5238 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | 5255 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) |
5239 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | 5256 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) |
5240 | 5257 |
5241 ACCESSORS(PolymorphicCodeCache, cache, Object, kCacheOffset) | 5258 ACCESSORS(PolymorphicCodeCache, cache, Object, kCacheOffset) |
5242 | 5259 |
5243 bool Script::HasValidSource() { | 5260 bool Script::HasValidSource() { |
5244 Object* src = this->source(); | 5261 Object* src = this->source(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5449 Builtins::kCompileOptimizedConcurrent); | 5466 Builtins::kCompileOptimizedConcurrent); |
5450 } | 5467 } |
5451 | 5468 |
5452 | 5469 |
5453 bool JSFunction::IsInOptimizationQueue() { | 5470 bool JSFunction::IsInOptimizationQueue() { |
5454 return code() == GetIsolate()->builtins()->builtin( | 5471 return code() == GetIsolate()->builtins()->builtin( |
5455 Builtins::kInOptimizationQueue); | 5472 Builtins::kInOptimizationQueue); |
5456 } | 5473 } |
5457 | 5474 |
5458 | 5475 |
5459 bool JSFunction::IsInobjectSlackTrackingInProgress() { | |
5460 return has_initial_map() && | |
5461 initial_map()->construction_count() != JSFunction::kNoSlackTracking; | |
5462 } | |
5463 | |
5464 | |
5465 Code* JSFunction::code() { | 5476 Code* JSFunction::code() { |
5466 return Code::cast( | 5477 return Code::cast( |
5467 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 5478 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
5468 } | 5479 } |
5469 | 5480 |
5470 | 5481 |
5471 void JSFunction::set_code(Code* value) { | 5482 void JSFunction::set_code(Code* value) { |
5472 ASSERT(!GetHeap()->InNewSpace(value)); | 5483 ASSERT(!GetHeap()->InNewSpace(value)); |
5473 Address entry = value->entry(); | 5484 Address entry = value->entry(); |
5474 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5485 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6849 #undef READ_SHORT_FIELD | 6860 #undef READ_SHORT_FIELD |
6850 #undef WRITE_SHORT_FIELD | 6861 #undef WRITE_SHORT_FIELD |
6851 #undef READ_BYTE_FIELD | 6862 #undef READ_BYTE_FIELD |
6852 #undef WRITE_BYTE_FIELD | 6863 #undef WRITE_BYTE_FIELD |
6853 #undef NOBARRIER_READ_BYTE_FIELD | 6864 #undef NOBARRIER_READ_BYTE_FIELD |
6854 #undef NOBARRIER_WRITE_BYTE_FIELD | 6865 #undef NOBARRIER_WRITE_BYTE_FIELD |
6855 | 6866 |
6856 } } // namespace v8::internal | 6867 } } // namespace v8::internal |
6857 | 6868 |
6858 #endif // V8_OBJECTS_INL_H_ | 6869 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |