OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 #endif | 1304 #endif |
1305 } | 1305 } |
1306 | 1306 |
1307 | 1307 |
1308 bool JSObject::ShouldTrackAllocationInfo() { | 1308 bool JSObject::ShouldTrackAllocationInfo() { |
1309 if (map()->CanTrackAllocationSite()) { | 1309 if (map()->CanTrackAllocationSite()) { |
1310 if (!IsJSArray()) { | 1310 if (!IsJSArray()) { |
1311 return true; | 1311 return true; |
1312 } | 1312 } |
1313 | 1313 |
1314 return AllocationSiteInfo::GetMode(GetElementsKind()) == | 1314 return AllocationSite::GetMode(GetElementsKind()) == |
1315 TRACK_ALLOCATION_SITE; | 1315 TRACK_ALLOCATION_SITE; |
1316 } | 1316 } |
1317 return false; | 1317 return false; |
1318 } | 1318 } |
1319 | 1319 |
1320 | 1320 |
1321 // Heuristic: We only need to create allocation site info if the boilerplate | 1321 // Heuristic: We only need to create allocation site info if the boilerplate |
1322 // elements kind is the initial elements kind. | 1322 // elements kind is the initial elements kind. |
1323 AllocationSiteMode AllocationSiteInfo::GetMode( | 1323 AllocationSiteMode AllocationSite::GetMode( |
1324 ElementsKind boilerplate_elements_kind) { | 1324 ElementsKind boilerplate_elements_kind) { |
1325 if (FLAG_track_allocation_sites && | 1325 if (FLAG_track_allocation_sites && |
1326 IsFastSmiElementsKind(boilerplate_elements_kind)) { | 1326 IsFastSmiElementsKind(boilerplate_elements_kind)) { |
1327 return TRACK_ALLOCATION_SITE; | 1327 return TRACK_ALLOCATION_SITE; |
1328 } | 1328 } |
1329 | 1329 |
1330 return DONT_TRACK_ALLOCATION_SITE; | 1330 return DONT_TRACK_ALLOCATION_SITE; |
1331 } | 1331 } |
1332 | 1332 |
1333 | 1333 |
1334 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from, | 1334 AllocationSiteMode AllocationSite::GetMode(ElementsKind from, |
1335 ElementsKind to) { | 1335 ElementsKind to) { |
1336 if (FLAG_track_allocation_sites && | 1336 if (FLAG_track_allocation_sites && |
1337 IsFastSmiElementsKind(from) && | 1337 IsFastSmiElementsKind(from) && |
1338 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) { | 1338 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) { |
1339 return TRACK_ALLOCATION_SITE; | 1339 return TRACK_ALLOCATION_SITE; |
1340 } | 1340 } |
1341 | 1341 |
1342 return DONT_TRACK_ALLOCATION_SITE; | 1342 return DONT_TRACK_ALLOCATION_SITE; |
1343 } | 1343 } |
1344 | 1344 |
1345 | 1345 |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3780 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 3780 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
3781 } | 3781 } |
3782 | 3782 |
3783 | 3783 |
3784 int Code::major_key() { | 3784 int Code::major_key() { |
3785 ASSERT(kind() == STUB || | 3785 ASSERT(kind() == STUB || |
3786 kind() == UNARY_OP_IC || | 3786 kind() == UNARY_OP_IC || |
3787 kind() == BINARY_OP_IC || | 3787 kind() == BINARY_OP_IC || |
3788 kind() == COMPARE_IC || | 3788 kind() == COMPARE_IC || |
3789 kind() == COMPARE_NIL_IC || | 3789 kind() == COMPARE_NIL_IC || |
| 3790 kind() == STORE_IC || |
3790 kind() == LOAD_IC || | 3791 kind() == LOAD_IC || |
3791 kind() == KEYED_LOAD_IC || | 3792 kind() == KEYED_LOAD_IC || |
3792 kind() == TO_BOOLEAN_IC); | 3793 kind() == TO_BOOLEAN_IC); |
3793 return StubMajorKeyField::decode( | 3794 return StubMajorKeyField::decode( |
3794 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 3795 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
3795 } | 3796 } |
3796 | 3797 |
3797 | 3798 |
3798 void Code::set_major_key(int major) { | 3799 void Code::set_major_key(int major) { |
3799 ASSERT(kind() == STUB || | 3800 ASSERT(kind() == STUB || |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4278 if (!transitions()->HasPrototypeTransitions()) { | 4279 if (!transitions()->HasPrototypeTransitions()) { |
4279 return GetHeap()->empty_fixed_array(); | 4280 return GetHeap()->empty_fixed_array(); |
4280 } | 4281 } |
4281 return transitions()->GetPrototypeTransitions(); | 4282 return transitions()->GetPrototypeTransitions(); |
4282 } | 4283 } |
4283 | 4284 |
4284 | 4285 |
4285 MaybeObject* Map::SetPrototypeTransitions(FixedArray* proto_transitions) { | 4286 MaybeObject* Map::SetPrototypeTransitions(FixedArray* proto_transitions) { |
4286 MaybeObject* allow_prototype = EnsureHasTransitionArray(this); | 4287 MaybeObject* allow_prototype = EnsureHasTransitionArray(this); |
4287 if (allow_prototype->IsFailure()) return allow_prototype; | 4288 if (allow_prototype->IsFailure()) return allow_prototype; |
| 4289 int old_number_of_transitions = NumberOfProtoTransitions(); |
4288 #ifdef DEBUG | 4290 #ifdef DEBUG |
4289 if (HasPrototypeTransitions()) { | 4291 if (HasPrototypeTransitions()) { |
4290 ASSERT(GetPrototypeTransitions() != proto_transitions); | 4292 ASSERT(GetPrototypeTransitions() != proto_transitions); |
4291 ZapPrototypeTransitions(); | 4293 ZapPrototypeTransitions(); |
4292 } | 4294 } |
4293 #endif | 4295 #endif |
4294 transitions()->SetPrototypeTransitions(proto_transitions); | 4296 transitions()->SetPrototypeTransitions(proto_transitions); |
| 4297 SetNumberOfProtoTransitions(old_number_of_transitions); |
4295 return this; | 4298 return this; |
4296 } | 4299 } |
4297 | 4300 |
4298 | 4301 |
4299 bool Map::HasPrototypeTransitions() { | 4302 bool Map::HasPrototypeTransitions() { |
4300 return HasTransitionArray() && transitions()->HasPrototypeTransitions(); | 4303 return HasTransitionArray() && transitions()->HasPrototypeTransitions(); |
4301 } | 4304 } |
4302 | 4305 |
4303 | 4306 |
4304 TransitionArray* Map::transitions() { | 4307 TransitionArray* Map::transitions() { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4438 | 4441 |
4439 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) | 4442 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) |
4440 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, | 4443 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, |
4441 kInternalFieldCountOffset) | 4444 kInternalFieldCountOffset) |
4442 | 4445 |
4443 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) | 4446 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) |
4444 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) | 4447 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) |
4445 | 4448 |
4446 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) | 4449 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) |
4447 | 4450 |
4448 ACCESSORS(AllocationSiteInfo, payload, Object, kPayloadOffset) | 4451 ACCESSORS(AllocationSite, payload, Object, kPayloadOffset) |
| 4452 ACCESSORS(AllocationSiteInfo, allocation_site, Object, kAllocationSiteOffset) |
4449 | 4453 |
4450 ACCESSORS(Script, source, Object, kSourceOffset) | 4454 ACCESSORS(Script, source, Object, kSourceOffset) |
4451 ACCESSORS(Script, name, Object, kNameOffset) | 4455 ACCESSORS(Script, name, Object, kNameOffset) |
4452 ACCESSORS(Script, id, Smi, kIdOffset) | 4456 ACCESSORS(Script, id, Smi, kIdOffset) |
4453 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) | 4457 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) |
4454 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) | 4458 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) |
4455 ACCESSORS(Script, data, Object, kDataOffset) | 4459 ACCESSORS(Script, data, Object, kDataOffset) |
4456 ACCESSORS(Script, context_data, Object, kContextOffset) | 4460 ACCESSORS(Script, context_data, Object, kContextOffset) |
4457 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) | 4461 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) |
4458 ACCESSORS_TO_SMI(Script, type, kTypeOffset) | 4462 ACCESSORS_TO_SMI(Script, type, kTypeOffset) |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6178 #undef WRITE_UINT32_FIELD | 6182 #undef WRITE_UINT32_FIELD |
6179 #undef READ_SHORT_FIELD | 6183 #undef READ_SHORT_FIELD |
6180 #undef WRITE_SHORT_FIELD | 6184 #undef WRITE_SHORT_FIELD |
6181 #undef READ_BYTE_FIELD | 6185 #undef READ_BYTE_FIELD |
6182 #undef WRITE_BYTE_FIELD | 6186 #undef WRITE_BYTE_FIELD |
6183 | 6187 |
6184 | 6188 |
6185 } } // namespace v8::internal | 6189 } } // namespace v8::internal |
6186 | 6190 |
6187 #endif // V8_OBJECTS_INL_H_ | 6191 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |