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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 #if DEBUG | 1305 #if DEBUG |
1306 if (FLAG_enable_slow_asserts) { | 1306 if (FLAG_enable_slow_asserts) { |
1307 ElementsAccessor* accessor = GetElementsAccessor(); | 1307 ElementsAccessor* accessor = GetElementsAccessor(); |
1308 accessor->Validate(this); | 1308 accessor->Validate(this); |
1309 } | 1309 } |
1310 #endif | 1310 #endif |
1311 } | 1311 } |
1312 | 1312 |
1313 | 1313 |
1314 bool JSObject::ShouldTrackAllocationInfo() { | 1314 bool JSObject::ShouldTrackAllocationInfo() { |
1315 if (map()->CanTrackAllocationSite()) { | 1315 if (AllocationSite::CanTrack(map()->instance_type())) { |
1316 if (!IsJSArray()) { | 1316 if (!IsJSArray()) { |
1317 return true; | 1317 return true; |
1318 } | 1318 } |
1319 | 1319 |
1320 return AllocationSite::GetMode(GetElementsKind()) == | 1320 return AllocationSite::GetMode(GetElementsKind()) == |
1321 TRACK_ALLOCATION_SITE; | 1321 TRACK_ALLOCATION_SITE; |
1322 } | 1322 } |
1323 return false; | 1323 return false; |
1324 } | 1324 } |
1325 | 1325 |
(...skipping 16 matching lines...) Expand all Loading... |
1342 if (FLAG_track_allocation_sites && | 1342 if (FLAG_track_allocation_sites && |
1343 IsFastSmiElementsKind(from) && | 1343 IsFastSmiElementsKind(from) && |
1344 IsMoreGeneralElementsKindTransition(from, to)) { | 1344 IsMoreGeneralElementsKindTransition(from, to)) { |
1345 return TRACK_ALLOCATION_SITE; | 1345 return TRACK_ALLOCATION_SITE; |
1346 } | 1346 } |
1347 | 1347 |
1348 return DONT_TRACK_ALLOCATION_SITE; | 1348 return DONT_TRACK_ALLOCATION_SITE; |
1349 } | 1349 } |
1350 | 1350 |
1351 | 1351 |
| 1352 inline bool AllocationSite::CanTrack(InstanceType type) { |
| 1353 return type == JS_ARRAY_TYPE; |
| 1354 } |
| 1355 |
| 1356 |
1352 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { | 1357 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { |
1353 ValidateElements(); | 1358 ValidateElements(); |
1354 ElementsKind elements_kind = map()->elements_kind(); | 1359 ElementsKind elements_kind = map()->elements_kind(); |
1355 if (!IsFastObjectElementsKind(elements_kind)) { | 1360 if (!IsFastObjectElementsKind(elements_kind)) { |
1356 if (IsFastHoleyElementsKind(elements_kind)) { | 1361 if (IsFastHoleyElementsKind(elements_kind)) { |
1357 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); | 1362 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); |
1358 } else { | 1363 } else { |
1359 return TransitionElementsKind(FAST_ELEMENTS); | 1364 return TransitionElementsKind(FAST_ELEMENTS); |
1360 } | 1365 } |
1361 } | 1366 } |
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 bool Map::is_dictionary_map() { | 3590 bool Map::is_dictionary_map() { |
3586 return DictionaryMap::decode(bit_field3()); | 3591 return DictionaryMap::decode(bit_field3()); |
3587 } | 3592 } |
3588 | 3593 |
3589 | 3594 |
3590 Code::Flags Code::flags() { | 3595 Code::Flags Code::flags() { |
3591 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 3596 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); |
3592 } | 3597 } |
3593 | 3598 |
3594 | 3599 |
3595 inline bool Map::CanTrackAllocationSite() { | |
3596 return instance_type() == JS_ARRAY_TYPE; | |
3597 } | |
3598 | |
3599 | |
3600 void Map::set_owns_descriptors(bool is_shared) { | 3600 void Map::set_owns_descriptors(bool is_shared) { |
3601 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); | 3601 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); |
3602 } | 3602 } |
3603 | 3603 |
3604 | 3604 |
3605 bool Map::owns_descriptors() { | 3605 bool Map::owns_descriptors() { |
3606 return OwnsDescriptors::decode(bit_field3()); | 3606 return OwnsDescriptors::decode(bit_field3()); |
3607 } | 3607 } |
3608 | 3608 |
3609 | 3609 |
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6258 #undef WRITE_UINT32_FIELD | 6258 #undef WRITE_UINT32_FIELD |
6259 #undef READ_SHORT_FIELD | 6259 #undef READ_SHORT_FIELD |
6260 #undef WRITE_SHORT_FIELD | 6260 #undef WRITE_SHORT_FIELD |
6261 #undef READ_BYTE_FIELD | 6261 #undef READ_BYTE_FIELD |
6262 #undef WRITE_BYTE_FIELD | 6262 #undef WRITE_BYTE_FIELD |
6263 | 6263 |
6264 | 6264 |
6265 } } // namespace v8::internal | 6265 } } // namespace v8::internal |
6266 | 6266 |
6267 #endif // V8_OBJECTS_INL_H_ | 6267 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |