| 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); |
| 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 // TODO(mvstanton): This heuristic is only a temporary solution. In the |
| 5330 // end, we want to quit creating allocation site info after a certain number |
| 5331 // of GCs for a call site. |
| 5332 AllocationSiteMode mode = AllocationSiteInfo::GetMode( |
| 5333 boilerplate_elements_kind); |
| 5327 | 5334 |
| 5328 // Check whether to use fast or slow deep-copying for boilerplate. | 5335 // Check whether to use fast or slow deep-copying for boilerplate. |
| 5329 int total_size = 0; | 5336 int total_size = 0; |
| 5330 int max_properties = HFastLiteral::kMaxLiteralProperties; | 5337 int max_properties = HFastLiteral::kMaxLiteralProperties; |
| 5331 if (IsFastLiteral(boilerplate, | 5338 if (IsFastLiteral(boilerplate, |
| 5332 HFastLiteral::kMaxLiteralDepth, | 5339 HFastLiteral::kMaxLiteralDepth, |
| 5333 &max_properties, | 5340 &max_properties, |
| 5334 &total_size)) { | 5341 &total_size)) { |
| 5342 if (mode == TRACK_ALLOCATION_SITE) { |
| 5343 total_size += AllocationSiteInfo::kSize; |
| 5344 } |
| 5335 literal = new(zone()) HFastLiteral(context, | 5345 literal = new(zone()) HFastLiteral(context, |
| 5336 boilerplate, | 5346 boilerplate, |
| 5337 total_size, | 5347 total_size, |
| 5338 expr->literal_index(), | 5348 expr->literal_index(), |
| 5339 expr->depth()); | 5349 expr->depth(), |
| 5350 mode); |
| 5340 } else { | 5351 } else { |
| 5341 literal = new(zone()) HArrayLiteral(context, | 5352 literal = new(zone()) HArrayLiteral(context, |
| 5342 boilerplate, | 5353 boilerplate, |
| 5343 length, | 5354 length, |
| 5344 expr->literal_index(), | 5355 expr->literal_index(), |
| 5345 expr->depth()); | 5356 expr->depth(), |
| 5357 mode); |
| 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. |
| 5350 PushAndAdd(literal); | 5362 PushAndAdd(literal); |
| 5351 | 5363 |
| 5352 HLoadElements* elements = NULL; | 5364 HLoadElements* elements = NULL; |
| 5353 | 5365 |
| 5354 for (int i = 0; i < length; i++) { | 5366 for (int i = 0; i < length; i++) { |
| 5355 Expression* subexpr = subexprs->at(i); | 5367 Expression* subexpr = subexprs->at(i); |
| (...skipping 4844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10200 } | 10212 } |
| 10201 } | 10213 } |
| 10202 | 10214 |
| 10203 #ifdef DEBUG | 10215 #ifdef DEBUG |
| 10204 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10216 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10205 if (allocator_ != NULL) allocator_->Verify(); | 10217 if (allocator_ != NULL) allocator_->Verify(); |
| 10206 #endif | 10218 #endif |
| 10207 } | 10219 } |
| 10208 | 10220 |
| 10209 } } // namespace v8::internal | 10221 } } // namespace v8::internal |
| OLD | NEW |