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