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 8219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8230 } | 8230 } |
8231 | 8231 |
8232 // Calculate instance size from initial map of constructor. | 8232 // Calculate instance size from initial map of constructor. |
8233 ASSERT(constructor->has_initial_map()); | 8233 ASSERT(constructor->has_initial_map()); |
8234 Handle<Map> initial_map(constructor->initial_map()); | 8234 Handle<Map> initial_map(constructor->initial_map()); |
8235 int instance_size = initial_map->instance_size(); | 8235 int instance_size = initial_map->instance_size(); |
8236 ASSERT(initial_map->InitialPropertiesLength() == 0); | 8236 ASSERT(initial_map->InitialPropertiesLength() == 0); |
8237 | 8237 |
8238 // Allocate an instance of the implicit receiver object. | 8238 // Allocate an instance of the implicit receiver object. |
8239 HValue* size_in_bytes = Add<HConstant>(instance_size); | 8239 HValue* size_in_bytes = Add<HConstant>(instance_size); |
8240 PretenureFlag pretenure_flag = | 8240 HAllocationMode allocation_mode; |
8241 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? | 8241 if (!FLAG_allocation_site_pretenuring) { |
Hannes Payer (out of office)
2014/02/11 15:51:23
Can we re-order this combination of cases to:
if (
mvstanton
2014/02/17 15:53:08
very true, thx!
| |
8242 isolate()->heap()->GetPretenureMode() : NOT_TENURED; | 8242 PretenureFlag pretenure_flag = FLAG_pretenuring_call_new |
8243 ? isolate()->heap()->GetPretenureMode() | |
8244 : NOT_TENURED; | |
8245 allocation_mode = HAllocationMode(pretenure_flag); | |
8246 } else if (FLAG_pretenuring_call_new) { | |
8247 // Try to use pretenuring feedback. | |
8248 Handle<AllocationSite> allocation_site = expr->allocation_site(); | |
8249 if (!allocation_site.is_null()) { | |
8250 allocation_mode = HAllocationMode(allocation_site); | |
8251 // Take a dependency on allocation site. | |
8252 AllocationSite::AddDependentCompilationInfo(allocation_site, | |
8253 AllocationSite::TENURING, | |
8254 top_info()); | |
8255 } | |
8256 } | |
8257 | |
8243 HAllocate* receiver = | 8258 HAllocate* receiver = |
8244 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, | 8259 BuildAllocate(size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, |
8245 JS_OBJECT_TYPE); | 8260 allocation_mode); |
8246 receiver->set_known_initial_map(initial_map); | 8261 receiver->set_known_initial_map(initial_map); |
8247 | 8262 |
8248 // Load the initial map from the constructor. | 8263 // Load the initial map from the constructor. |
8249 HValue* constructor_value = Add<HConstant>(constructor); | 8264 HValue* constructor_value = Add<HConstant>(constructor); |
8250 HValue* initial_map_value = | 8265 HValue* initial_map_value = |
8251 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), | 8266 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL), |
8252 HObjectAccess::ForMapAndOffset( | 8267 HObjectAccess::ForMapAndOffset( |
8253 handle(constructor->map()), | 8268 handle(constructor->map()), |
8254 JSFunction::kPrototypeOrInitialMapOffset)); | 8269 JSFunction::kPrototypeOrInitialMapOffset)); |
8255 | 8270 |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11195 if (ShouldProduceTraceOutput()) { | 11210 if (ShouldProduceTraceOutput()) { |
11196 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11211 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11197 } | 11212 } |
11198 | 11213 |
11199 #ifdef DEBUG | 11214 #ifdef DEBUG |
11200 graph_->Verify(false); // No full verify. | 11215 graph_->Verify(false); // No full verify. |
11201 #endif | 11216 #endif |
11202 } | 11217 } |
11203 | 11218 |
11204 } } // namespace v8::internal | 11219 } } // namespace v8::internal |
OLD | NEW |