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