| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
| (...skipping 9890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9901 } | 9901 } |
| 9902 | 9902 |
| 9903 // Calculate instance size from initial map of constructor. | 9903 // Calculate instance size from initial map of constructor. |
| 9904 DCHECK(constructor->has_initial_map()); | 9904 DCHECK(constructor->has_initial_map()); |
| 9905 Handle<Map> initial_map(constructor->initial_map()); | 9905 Handle<Map> initial_map(constructor->initial_map()); |
| 9906 int instance_size = initial_map->instance_size(); | 9906 int instance_size = initial_map->instance_size(); |
| 9907 | 9907 |
| 9908 // Allocate an instance of the implicit receiver object. | 9908 // Allocate an instance of the implicit receiver object. |
| 9909 HValue* size_in_bytes = Add<HConstant>(instance_size); | 9909 HValue* size_in_bytes = Add<HConstant>(instance_size); |
| 9910 HAllocationMode allocation_mode; | 9910 HAllocationMode allocation_mode; |
| 9911 if (FLAG_pretenuring_call_new) { | |
| 9912 if (FLAG_allocation_site_pretenuring) { | |
| 9913 // Try to use pretenuring feedback. | |
| 9914 Handle<AllocationSite> allocation_site = expr->allocation_site(); | |
| 9915 allocation_mode = HAllocationMode(allocation_site); | |
| 9916 // Take a dependency on allocation site. | |
| 9917 top_info()->dependencies()->AssumeTenuringDecision(allocation_site); | |
| 9918 } | |
| 9919 } | |
| 9920 | |
| 9921 HAllocate* receiver = BuildAllocate( | 9911 HAllocate* receiver = BuildAllocate( |
| 9922 size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, allocation_mode); | 9912 size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, allocation_mode); |
| 9923 receiver->set_known_initial_map(initial_map); | 9913 receiver->set_known_initial_map(initial_map); |
| 9924 | 9914 |
| 9925 // Initialize map and fields of the newly allocated object. | 9915 // Initialize map and fields of the newly allocated object. |
| 9926 { NoObservableSideEffectsScope no_effects(this); | 9916 { NoObservableSideEffectsScope no_effects(this); |
| 9927 DCHECK(initial_map->instance_type() == JS_OBJECT_TYPE); | 9917 DCHECK(initial_map->instance_type() == JS_OBJECT_TYPE); |
| 9928 Add<HStoreNamedField>(receiver, | 9918 Add<HStoreNamedField>(receiver, |
| 9929 HObjectAccess::ForMapAndOffset(initial_map, JSObject::kMapOffset), | 9919 HObjectAccess::ForMapAndOffset(initial_map, JSObject::kMapOffset), |
| 9930 Add<HConstant>(initial_map)); | 9920 Add<HConstant>(initial_map)); |
| (...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13554 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13544 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13555 } | 13545 } |
| 13556 | 13546 |
| 13557 #ifdef DEBUG | 13547 #ifdef DEBUG |
| 13558 graph_->Verify(false); // No full verify. | 13548 graph_->Verify(false); // No full verify. |
| 13559 #endif | 13549 #endif |
| 13560 } | 13550 } |
| 13561 | 13551 |
| 13562 } // namespace internal | 13552 } // namespace internal |
| 13563 } // namespace v8 | 13553 } // namespace v8 |
| OLD | NEW |