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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 void JSObject::ValidateElements() { | 1291 void JSObject::ValidateElements() { |
1292 #if DEBUG | 1292 #if DEBUG |
1293 if (FLAG_enable_slow_asserts) { | 1293 if (FLAG_enable_slow_asserts) { |
1294 ElementsAccessor* accessor = GetElementsAccessor(); | 1294 ElementsAccessor* accessor = GetElementsAccessor(); |
1295 accessor->Validate(this); | 1295 accessor->Validate(this); |
1296 } | 1296 } |
1297 #endif | 1297 #endif |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
| 1301 bool JSObject::ShouldTrackAllocationInfo() { |
| 1302 if (map()->CanTrackAllocationSite()) { |
| 1303 if (!IsJSArray()) { |
| 1304 return true; |
| 1305 } |
| 1306 |
| 1307 return AllocationSiteInfo::GetMode(GetElementsKind()) == |
| 1308 TRACK_ALLOCATION_SITE; |
| 1309 } |
| 1310 return false; |
| 1311 } |
| 1312 |
| 1313 |
| 1314 // Heuristic: We only need to create allocation site info if the boilerplate |
| 1315 // elements kind is the initial elements kind. |
| 1316 AllocationSiteMode AllocationSiteInfo::GetMode( |
| 1317 ElementsKind boilerplate_elements_kind) { |
| 1318 if (FLAG_track_allocation_sites && |
| 1319 IsFastSmiElementsKind(boilerplate_elements_kind)) { |
| 1320 return TRACK_ALLOCATION_SITE; |
| 1321 } |
| 1322 |
| 1323 return DONT_TRACK_ALLOCATION_SITE; |
| 1324 } |
| 1325 |
| 1326 |
| 1327 AllocationSiteMode AllocationSiteInfo::GetMode(ElementsKind from, |
| 1328 ElementsKind to) { |
| 1329 if (FLAG_track_allocation_sites && |
| 1330 IsFastSmiElementsKind(from) && |
| 1331 (IsFastObjectElementsKind(to) || IsFastDoubleElementsKind(to))) { |
| 1332 return TRACK_ALLOCATION_SITE; |
| 1333 } |
| 1334 |
| 1335 return DONT_TRACK_ALLOCATION_SITE; |
| 1336 } |
| 1337 |
| 1338 |
1301 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { | 1339 MaybeObject* JSObject::EnsureCanContainHeapObjectElements() { |
1302 ValidateElements(); | 1340 ValidateElements(); |
1303 ElementsKind elements_kind = map()->elements_kind(); | 1341 ElementsKind elements_kind = map()->elements_kind(); |
1304 if (!IsFastObjectElementsKind(elements_kind)) { | 1342 if (!IsFastObjectElementsKind(elements_kind)) { |
1305 if (IsFastHoleyElementsKind(elements_kind)) { | 1343 if (IsFastHoleyElementsKind(elements_kind)) { |
1306 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); | 1344 return TransitionElementsKind(FAST_HOLEY_ELEMENTS); |
1307 } else { | 1345 } else { |
1308 return TransitionElementsKind(FAST_ELEMENTS); | 1346 return TransitionElementsKind(FAST_ELEMENTS); |
1309 } | 1347 } |
1310 } | 1348 } |
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3667 kind() == KEYED_STORE_IC || | 3705 kind() == KEYED_STORE_IC || |
3668 kind() == TO_BOOLEAN_IC); | 3706 kind() == TO_BOOLEAN_IC); |
3669 ASSERT(0 <= major && major < 256); | 3707 ASSERT(0 <= major && major < 256); |
3670 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3708 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
3671 int updated = StubMajorKeyField::update(previous, major); | 3709 int updated = StubMajorKeyField::update(previous, major); |
3672 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 3710 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
3673 } | 3711 } |
3674 | 3712 |
3675 | 3713 |
3676 bool Code::is_pregenerated() { | 3714 bool Code::is_pregenerated() { |
3677 return kind() == STUB && IsPregeneratedField::decode(flags()); | 3715 return (kind() == STUB || kind() == COMPILED_STUB) |
| 3716 && IsPregeneratedField::decode(flags()); |
3678 } | 3717 } |
3679 | 3718 |
3680 | 3719 |
3681 void Code::set_is_pregenerated(bool value) { | 3720 void Code::set_is_pregenerated(bool value) { |
3682 ASSERT(kind() == STUB); | 3721 ASSERT(kind() == STUB || kind() == COMPILED_STUB); |
3683 Flags f = flags(); | 3722 Flags f = flags(); |
3684 f = static_cast<Flags>(IsPregeneratedField::update(f, value)); | 3723 f = static_cast<Flags>(IsPregeneratedField::update(f, value)); |
3685 set_flags(f); | 3724 set_flags(f); |
3686 } | 3725 } |
3687 | 3726 |
3688 | 3727 |
3689 bool Code::optimizable() { | 3728 bool Code::optimizable() { |
3690 ASSERT_EQ(FUNCTION, kind()); | 3729 ASSERT_EQ(FUNCTION, kind()); |
3691 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; | 3730 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; |
3692 } | 3731 } |
(...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6098 #undef WRITE_UINT32_FIELD | 6137 #undef WRITE_UINT32_FIELD |
6099 #undef READ_SHORT_FIELD | 6138 #undef READ_SHORT_FIELD |
6100 #undef WRITE_SHORT_FIELD | 6139 #undef WRITE_SHORT_FIELD |
6101 #undef READ_BYTE_FIELD | 6140 #undef READ_BYTE_FIELD |
6102 #undef WRITE_BYTE_FIELD | 6141 #undef WRITE_BYTE_FIELD |
6103 | 6142 |
6104 | 6143 |
6105 } } // namespace v8::internal | 6144 } } // namespace v8::internal |
6106 | 6145 |
6107 #endif // V8_OBJECTS_INL_H_ | 6146 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |