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 5314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 ElementsKind boilerplate_elements_kind = | 5325 ElementsKind boilerplate_elements_kind = |
5326 Handle<JSObject>::cast(boilerplate)->GetElementsKind(); | 5326 Handle<JSObject>::cast(boilerplate)->GetElementsKind(); |
5327 | 5327 |
5328 // Check whether to use fast or slow deep-copying for boilerplate. | 5328 // Check whether to use fast or slow deep-copying for boilerplate. |
5329 int total_size = 0; | 5329 int total_size = 0; |
5330 int max_properties = HFastLiteral::kMaxLiteralProperties; | 5330 int max_properties = HFastLiteral::kMaxLiteralProperties; |
5331 if (IsFastLiteral(boilerplate, | 5331 if (IsFastLiteral(boilerplate, |
5332 HFastLiteral::kMaxLiteralDepth, | 5332 HFastLiteral::kMaxLiteralDepth, |
5333 &max_properties, | 5333 &max_properties, |
5334 &total_size)) { | 5334 &total_size)) { |
| 5335 // Heuristic: We only need to create allocation site info if the boilerplate |
| 5336 // elements kind is the initial elements kind. |
| 5337 // |
| 5338 // TODO(mvstanton): This heuristic is only a temporary solution. In the |
| 5339 // end, we want to quit creating allocation site info after a certain number |
| 5340 // of GCs for a call site. |
| 5341 bool create_allocation_site_info = FLAG_track_allocation_sites && |
| 5342 IsFastSmiElementsKind(boilerplate_elements_kind); |
| 5343 if (create_allocation_site_info) { |
| 5344 total_size += AllocationSiteInfo::kSize; |
| 5345 } |
5335 literal = new(zone()) HFastLiteral(context, | 5346 literal = new(zone()) HFastLiteral(context, |
5336 boilerplate, | 5347 boilerplate, |
5337 total_size, | 5348 total_size, |
5338 expr->literal_index(), | 5349 expr->literal_index(), |
5339 expr->depth()); | 5350 expr->depth(), |
| 5351 create_allocation_site_info); |
5340 } else { | 5352 } else { |
5341 literal = new(zone()) HArrayLiteral(context, | 5353 literal = new(zone()) HArrayLiteral(context, |
5342 boilerplate, | 5354 boilerplate, |
5343 length, | 5355 length, |
5344 expr->literal_index(), | 5356 expr->literal_index(), |
5345 expr->depth()); | 5357 expr->depth()); |
5346 } | 5358 } |
5347 | 5359 |
5348 // The array is expected in the bailout environment during computation | 5360 // The array is expected in the bailout environment during computation |
5349 // of the property values and is the value of the entire expression. | 5361 // of the property values and is the value of the entire expression. |
(...skipping 4848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10198 } | 10210 } |
10199 } | 10211 } |
10200 | 10212 |
10201 #ifdef DEBUG | 10213 #ifdef DEBUG |
10202 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10214 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10203 if (allocator_ != NULL) allocator_->Verify(); | 10215 if (allocator_ != NULL) allocator_->Verify(); |
10204 #endif | 10216 #endif |
10205 } | 10217 } |
10206 | 10218 |
10207 } } // namespace v8::internal | 10219 } } // namespace v8::internal |
OLD | NEW |