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 8198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8209 } | 8209 } |
8210 | 8210 |
8211 // Calculate instance size from initial map of constructor. | 8211 // Calculate instance size from initial map of constructor. |
8212 ASSERT(constructor->has_initial_map()); | 8212 ASSERT(constructor->has_initial_map()); |
8213 Handle<Map> initial_map(constructor->initial_map()); | 8213 Handle<Map> initial_map(constructor->initial_map()); |
8214 int instance_size = initial_map->instance_size(); | 8214 int instance_size = initial_map->instance_size(); |
8215 ASSERT(initial_map->InitialPropertiesLength() == 0); | 8215 ASSERT(initial_map->InitialPropertiesLength() == 0); |
8216 | 8216 |
8217 // Allocate an instance of the implicit receiver object. | 8217 // Allocate an instance of the implicit receiver object. |
8218 HValue* size_in_bytes = Add<HConstant>(instance_size); | 8218 HValue* size_in_bytes = Add<HConstant>(instance_size); |
8219 PretenureFlag pretenure_flag = | 8219 HAllocationMode allocation_mode; |
8220 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? | 8220 if (FLAG_pretenuring_call_new) { |
8221 isolate()->heap()->GetPretenureMode() : NOT_TENURED; | 8221 if (FLAG_allocation_site_pretenuring) { |
8222 // Try to use pretenuring feedback. | |
8223 Handle<AllocationSite> allocation_site = expr->allocation_site(); | |
8224 if (!allocation_site.is_null()) { | |
Hannes Payer (out of office)
2014/02/18 16:24:26
When is the allocation_site null?
mvstanton
2014/02/19 08:40:26
Wow. Never. Simplifying this. In the past it was m
| |
8225 allocation_mode = HAllocationMode(allocation_site); | |
8226 // Take a dependency on allocation site. | |
8227 AllocationSite::AddDependentCompilationInfo(allocation_site, | |
8228 AllocationSite::TENURING, | |
8229 top_info()); | |
8230 } | |
8231 } else { | |
8232 allocation_mode = HAllocationMode( | |
8233 isolate()->heap()->GetPretenureMode()); | |
8234 } | |
8235 } | |
8236 | |
8222 HAllocate* receiver = | 8237 HAllocate* receiver = |
8223 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, | 8238 BuildAllocate(size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, |
8224 JS_OBJECT_TYPE); | 8239 allocation_mode); |
8225 receiver->set_known_initial_map(initial_map); | 8240 receiver->set_known_initial_map(initial_map); |
8226 | 8241 |
8227 // Load the initial map from the constructor. | 8242 // Load the initial map from the constructor. |
8228 HValue* constructor_value = Add<HConstant>(constructor); | 8243 HValue* constructor_value = Add<HConstant>(constructor); |
8229 HValue* initial_map_value = | 8244 HValue* initial_map_value = |
8230 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), | 8245 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), |
8231 HObjectAccess::ForMapAndOffset( | 8246 HObjectAccess::ForMapAndOffset( |
8232 handle(constructor->map()), | 8247 handle(constructor->map()), |
8233 JSFunction::kPrototypeOrInitialMapOffset)); | 8248 JSFunction::kPrototypeOrInitialMapOffset)); |
8234 | 8249 |
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11187 if (ShouldProduceTraceOutput()) { | 11202 if (ShouldProduceTraceOutput()) { |
11188 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11203 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11189 } | 11204 } |
11190 | 11205 |
11191 #ifdef DEBUG | 11206 #ifdef DEBUG |
11192 graph_->Verify(false); // No full verify. | 11207 graph_->Verify(false); // No full verify. |
11193 #endif | 11208 #endif |
11194 } | 11209 } |
11195 | 11210 |
11196 } } // namespace v8::internal | 11211 } } // namespace v8::internal |
OLD | NEW |