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 8260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8271 } | 8271 } |
8272 | 8272 |
8273 // Calculate instance size from initial map of constructor. | 8273 // Calculate instance size from initial map of constructor. |
8274 ASSERT(constructor->has_initial_map()); | 8274 ASSERT(constructor->has_initial_map()); |
8275 Handle<Map> initial_map(constructor->initial_map()); | 8275 Handle<Map> initial_map(constructor->initial_map()); |
8276 int instance_size = initial_map->instance_size(); | 8276 int instance_size = initial_map->instance_size(); |
8277 ASSERT(initial_map->InitialPropertiesLength() == 0); | 8277 ASSERT(initial_map->InitialPropertiesLength() == 0); |
8278 | 8278 |
8279 // Allocate an instance of the implicit receiver object. | 8279 // Allocate an instance of the implicit receiver object. |
8280 HValue* size_in_bytes = Add<HConstant>(instance_size); | 8280 HValue* size_in_bytes = Add<HConstant>(instance_size); |
8281 PretenureFlag pretenure_flag = | 8281 HAllocationMode allocation_mode; |
8282 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? | 8282 if (FLAG_pretenuring_call_new) { |
8283 isolate()->heap()->GetPretenureMode() : NOT_TENURED; | 8283 if (FLAG_allocation_site_pretenuring) { |
| 8284 // Try to use pretenuring feedback. |
| 8285 Handle<AllocationSite> allocation_site = expr->allocation_site(); |
| 8286 allocation_mode = HAllocationMode(allocation_site); |
| 8287 // Take a dependency on allocation site. |
| 8288 AllocationSite::AddDependentCompilationInfo(allocation_site, |
| 8289 AllocationSite::TENURING, |
| 8290 top_info()); |
| 8291 } else { |
| 8292 allocation_mode = HAllocationMode( |
| 8293 isolate()->heap()->GetPretenureMode()); |
| 8294 } |
| 8295 } |
| 8296 |
8284 HAllocate* receiver = | 8297 HAllocate* receiver = |
8285 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, | 8298 BuildAllocate(size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, |
8286 JS_OBJECT_TYPE); | 8299 allocation_mode); |
8287 receiver->set_known_initial_map(initial_map); | 8300 receiver->set_known_initial_map(initial_map); |
8288 | 8301 |
8289 // Load the initial map from the constructor. | 8302 // Load the initial map from the constructor. |
8290 HValue* constructor_value = Add<HConstant>(constructor); | 8303 HValue* constructor_value = Add<HConstant>(constructor); |
8291 HValue* initial_map_value = | 8304 HValue* initial_map_value = |
8292 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), | 8305 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), |
8293 HObjectAccess::ForMapAndOffset( | 8306 HObjectAccess::ForMapAndOffset( |
8294 handle(constructor->map()), | 8307 handle(constructor->map()), |
8295 JSFunction::kPrototypeOrInitialMapOffset)); | 8308 JSFunction::kPrototypeOrInitialMapOffset)); |
8296 | 8309 |
(...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11297 if (ShouldProduceTraceOutput()) { | 11310 if (ShouldProduceTraceOutput()) { |
11298 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11311 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11299 } | 11312 } |
11300 | 11313 |
11301 #ifdef DEBUG | 11314 #ifdef DEBUG |
11302 graph_->Verify(false); // No full verify. | 11315 graph_->Verify(false); // No full verify. |
11303 #endif | 11316 #endif |
11304 } | 11317 } |
11305 | 11318 |
11306 } } // namespace v8::internal | 11319 } } // namespace v8::internal |
OLD | NEW |