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