| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9352 | 9352 |
| 9353 // We should pull pre-tenure mode from the allocation site. | 9353 // We should pull pre-tenure mode from the allocation site. |
| 9354 // For now, just see what it says, and remark on it if it sez | 9354 // For now, just see what it says, and remark on it if it sez |
| 9355 // we should pretenure. That means the rudimentary counting in the garbage | 9355 // we should pretenure. That means the rudimentary counting in the garbage |
| 9356 // collector is having an effect. | 9356 // collector is having an effect. |
| 9357 PretenureFlag pretenure_flag = isolate()->heap()->GetPretenureMode(); | 9357 PretenureFlag pretenure_flag = isolate()->heap()->GetPretenureMode(); |
| 9358 if (FLAG_allocation_site_pretenuring) { | 9358 if (FLAG_allocation_site_pretenuring) { |
| 9359 pretenure_flag = site_context->current()->GetPretenureMode() | 9359 pretenure_flag = site_context->current()->GetPretenureMode() |
| 9360 ? TENURED | 9360 ? TENURED |
| 9361 : NOT_TENURED; | 9361 : NOT_TENURED; |
| 9362 if (FLAG_trace_track_allocation_sites) { | |
| 9363 PrintF("Hydrogen: AllocationSite %p boilerplate %p %s\n", | |
| 9364 static_cast<void*>(*(site_context->current())), | |
| 9365 static_cast<void*>(*boilerplate_object), | |
| 9366 pretenure_flag == TENURED ? "tenured" : "not tenured"); | |
| 9367 } | |
| 9368 } | 9362 } |
| 9369 | 9363 |
| 9370 HInstruction* object = Add<HAllocate>(object_size_constant, type, | 9364 HInstruction* object = Add<HAllocate>(object_size_constant, type, |
| 9371 pretenure_flag, instance_type); | 9365 pretenure_flag, instance_type, site_context->current()); |
| 9372 | 9366 |
| 9373 BuildEmitObjectHeader(boilerplate_object, object); | 9367 BuildEmitObjectHeader(boilerplate_object, object); |
| 9374 | 9368 |
| 9375 Handle<FixedArrayBase> elements(boilerplate_object->elements()); | 9369 Handle<FixedArrayBase> elements(boilerplate_object->elements()); |
| 9376 int elements_size = (elements->length() > 0 && | 9370 int elements_size = (elements->length() > 0 && |
| 9377 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? | 9371 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? |
| 9378 elements->Size() : 0; | 9372 elements->Size() : 0; |
| 9379 | 9373 |
| 9380 HInstruction* object_elements = NULL; | 9374 HInstruction* object_elements = NULL; |
| 9381 if (elements_size > 0) { | 9375 if (elements_size > 0) { |
| 9382 HValue* object_elements_size = Add<HConstant>(elements_size); | 9376 HValue* object_elements_size = Add<HConstant>(elements_size); |
| 9383 if (boilerplate_object->HasFastDoubleElements()) { | 9377 if (boilerplate_object->HasFastDoubleElements()) { |
| 9384 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9378 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
| 9385 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE); | 9379 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current()); |
| 9386 } else { | 9380 } else { |
| 9387 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9381 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
| 9388 pretenure_flag, FIXED_ARRAY_TYPE); | 9382 pretenure_flag, FIXED_ARRAY_TYPE, site_context->current()); |
| 9389 } | 9383 } |
| 9390 } | 9384 } |
| 9391 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); | 9385 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); |
| 9392 | 9386 |
| 9393 // Copy object elements if non-COW. | 9387 // Copy object elements if non-COW. |
| 9394 if (object_elements != NULL) { | 9388 if (object_elements != NULL) { |
| 9395 BuildEmitElements(boilerplate_object, elements, object_elements, | 9389 BuildEmitElements(boilerplate_object, elements, object_elements, |
| 9396 site_context); | 9390 site_context); |
| 9397 } | 9391 } |
| 9398 | 9392 |
| (...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10820 if (ShouldProduceTraceOutput()) { | 10814 if (ShouldProduceTraceOutput()) { |
| 10821 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10815 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10822 } | 10816 } |
| 10823 | 10817 |
| 10824 #ifdef DEBUG | 10818 #ifdef DEBUG |
| 10825 graph_->Verify(false); // No full verify. | 10819 graph_->Verify(false); // No full verify. |
| 10826 #endif | 10820 #endif |
| 10827 } | 10821 } |
| 10828 | 10822 |
| 10829 } } // namespace v8::internal | 10823 } } // namespace v8::internal |
| OLD | NEW |