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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 } | 1323 } |
1324 | 1324 |
1325 return AllocationSite::GetMode(GetElementsKind()) == | 1325 return AllocationSite::GetMode(GetElementsKind()) == |
1326 TRACK_ALLOCATION_SITE; | 1326 TRACK_ALLOCATION_SITE; |
1327 } | 1327 } |
1328 return false; | 1328 return false; |
1329 } | 1329 } |
1330 | 1330 |
1331 | 1331 |
1332 void AllocationSite::Initialize() { | 1332 void AllocationSite::Initialize() { |
1333 set_transition_info(Smi::FromInt(0)); | |
1333 SetElementsKind(GetInitialFastElementsKind()); | 1334 SetElementsKind(GetInitialFastElementsKind()); |
1334 set_nested_site(Smi::FromInt(0)); | 1335 set_nested_site(Smi::FromInt(0)); |
1335 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), | 1336 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
1336 SKIP_WRITE_BARRIER); | 1337 SKIP_WRITE_BARRIER); |
1337 } | 1338 } |
1338 | 1339 |
1339 | 1340 |
1340 // Heuristic: We only need to create allocation site info if the boilerplate | 1341 // Heuristic: We only need to create allocation site info if the boilerplate |
1341 // elements kind is the initial elements kind. | 1342 // elements kind is the initial elements kind. |
1342 AllocationSiteMode AllocationSite::GetMode( | 1343 AllocationSiteMode AllocationSite::GetMode( |
(...skipping 17 matching lines...) Expand all Loading... | |
1360 | 1361 |
1361 return DONT_TRACK_ALLOCATION_SITE; | 1362 return DONT_TRACK_ALLOCATION_SITE; |
1362 } | 1363 } |
1363 | 1364 |
1364 | 1365 |
1365 inline bool AllocationSite::CanTrack(InstanceType type) { | 1366 inline bool AllocationSite::CanTrack(InstanceType type) { |
1366 return type == JS_ARRAY_TYPE; | 1367 return type == JS_ARRAY_TYPE; |
1367 } | 1368 } |
1368 | 1369 |
1369 | 1370 |
1371 inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup( | |
1372 Reason reason) { | |
1373 switch (reason) { | |
1374 case TENURING: | |
1375 return DependentCode::kAllocationSiteTenuringChangedGroup; | |
1376 break; | |
1377 case TRANSITIONS: | |
1378 return DependentCode::kAllocationSiteTransitionChangedGroup; | |
1379 break; | |
1380 default: | |
Toon Verwaest
2013/11/11 13:59:28
No need to add a default case if all cases are han
mvstanton
2013/11/13 14:12:52
Done.
| |
1381 UNREACHABLE(); | |
1382 } | |
1383 return DependentCode::kAllocationSiteTransitionChangedGroup; | |
1384 } | |
1385 | |
1386 | |
1370 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { | 1387 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { |
1371 object->ValidateElements(); | 1388 object->ValidateElements(); |
1372 ElementsKind elements_kind = object->map()->elements_kind(); | 1389 ElementsKind elements_kind = object->map()->elements_kind(); |
1373 if (!IsFastObjectElementsKind(elements_kind)) { | 1390 if (!IsFastObjectElementsKind(elements_kind)) { |
1374 if (IsFastHoleyElementsKind(elements_kind)) { | 1391 if (IsFastHoleyElementsKind(elements_kind)) { |
1375 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); | 1392 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); |
1376 } else { | 1393 } else { |
1377 TransitionElementsKind(object, FAST_ELEMENTS); | 1394 TransitionElementsKind(object, FAST_ELEMENTS); |
1378 } | 1395 } |
1379 } | 1396 } |
(...skipping 5030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6410 #undef WRITE_UINT32_FIELD | 6427 #undef WRITE_UINT32_FIELD |
6411 #undef READ_SHORT_FIELD | 6428 #undef READ_SHORT_FIELD |
6412 #undef WRITE_SHORT_FIELD | 6429 #undef WRITE_SHORT_FIELD |
6413 #undef READ_BYTE_FIELD | 6430 #undef READ_BYTE_FIELD |
6414 #undef WRITE_BYTE_FIELD | 6431 #undef WRITE_BYTE_FIELD |
6415 | 6432 |
6416 | 6433 |
6417 } } // namespace v8::internal | 6434 } } // namespace v8::internal |
6418 | 6435 |
6419 #endif // V8_OBJECTS_INL_H_ | 6436 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |