Chromium Code Reviews| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5316 } | 5317 } |
| 5317 literals->set(expr->literal_index(), *raw_boilerplate); | 5318 literals->set(expr->literal_index(), *raw_boilerplate); |
| 5318 if (JSObject::cast(*raw_boilerplate)->elements()->map() == | 5319 if (JSObject::cast(*raw_boilerplate)->elements()->map() == |
| 5319 isolate()->heap()->fixed_cow_array_map()) { | 5320 isolate()->heap()->fixed_cow_array_map()) { |
| 5320 isolate()->counters()->cow_arrays_created_runtime()->Increment(); | 5321 isolate()->counters()->cow_arrays_created_runtime()->Increment(); |
| 5321 } | 5322 } |
| 5322 } | 5323 } |
| 5323 | 5324 |
| 5324 Handle<JSObject> boilerplate = Handle<JSObject>::cast(raw_boilerplate); | 5325 Handle<JSObject> boilerplate = Handle<JSObject>::cast(raw_boilerplate); |
| 5325 ElementsKind boilerplate_elements_kind = | 5326 ElementsKind boilerplate_elements_kind = |
| 5326 Handle<JSObject>::cast(boilerplate)->GetElementsKind(); | 5327 Handle<JSObject>::cast(boilerplate)->GetElementsKind(); |
| 5328 | |
| 5329 // Heuristic: We only need to create allocation site info if the boilerplate | |
| 5330 // elements kind is the initial elements kind. | |
|
Toon Verwaest
2013/01/16 10:53:42
This comment seems to belong above ::GetMode(Eleme
mvstanton
2013/01/16 13:01:56
Yep, indeed!
| |
| 5331 // | |
| 5332 // TODO(mvstanton): This heuristic is only a temporary solution. In the | |
| 5333 // end, we want to quit creating allocation site info after a certain number | |
| 5334 // of GCs for a call site. | |
| 5335 AllocationSiteInfoMode mode = AllocationSiteInfo::GetMode( | |
| 5336 boilerplate_elements_kind); | |
| 5327 | 5337 |
| 5328 // Check whether to use fast or slow deep-copying for boilerplate. | 5338 // Check whether to use fast or slow deep-copying for boilerplate. |
| 5329 int total_size = 0; | 5339 int total_size = 0; |
| 5330 int max_properties = HFastLiteral::kMaxLiteralProperties; | 5340 int max_properties = HFastLiteral::kMaxLiteralProperties; |
| 5331 if (IsFastLiteral(boilerplate, | 5341 if (IsFastLiteral(boilerplate, |
| 5332 HFastLiteral::kMaxLiteralDepth, | 5342 HFastLiteral::kMaxLiteralDepth, |
| 5333 &max_properties, | 5343 &max_properties, |
| 5334 &total_size)) { | 5344 &total_size)) { |
| 5345 if (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(), |
| 5360 mode); | |
| 5346 } | 5361 } |
| 5347 | 5362 |
| 5348 // The array is expected in the bailout environment during computation | 5363 // The array is expected in the bailout environment during computation |
| 5349 // of the property values and is the value of the entire expression. | 5364 // of the property values and is the value of the entire expression. |
| 5350 PushAndAdd(literal); | 5365 PushAndAdd(literal); |
| 5351 | 5366 |
| 5352 HLoadElements* elements = NULL; | 5367 HLoadElements* elements = NULL; |
| 5353 | 5368 |
| 5354 for (int i = 0; i < length; i++) { | 5369 for (int i = 0; i < length; i++) { |
| 5355 Expression* subexpr = subexprs->at(i); | 5370 Expression* subexpr = subexprs->at(i); |
| (...skipping 4844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10200 } | 10215 } |
| 10201 } | 10216 } |
| 10202 | 10217 |
| 10203 #ifdef DEBUG | 10218 #ifdef DEBUG |
| 10204 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10219 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10205 if (allocator_ != NULL) allocator_->Verify(); | 10220 if (allocator_ != NULL) allocator_->Verify(); |
| 10206 #endif | 10221 #endif |
| 10207 } | 10222 } |
| 10208 | 10223 |
| 10209 } } // namespace v8::internal | 10224 } } // namespace v8::internal |
| OLD | NEW |