| 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 8223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8234 | 8234 |
| 8235 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( | 8235 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
| 8236 HValue* context, | 8236 HValue* context, |
| 8237 Handle<JSObject> boilerplate_object, | 8237 Handle<JSObject> boilerplate_object, |
| 8238 Handle<JSObject> original_boilerplate_object, | 8238 Handle<JSObject> original_boilerplate_object, |
| 8239 Handle<Object> allocation_site, | 8239 Handle<Object> allocation_site, |
| 8240 int data_size, | 8240 int data_size, |
| 8241 int pointer_size, | 8241 int pointer_size, |
| 8242 AllocationSiteMode mode) { | 8242 AllocationSiteMode mode) { |
| 8243 NoObservableSideEffectsScope no_effects(this); | 8243 NoObservableSideEffectsScope no_effects(this); |
| 8244 | 8244 InstanceType instance_type = boilerplate_object->map()->instance_type(); |
| 8245 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); |
| 8246 HType type = instance_type == JS_ARRAY_TYPE |
| 8247 ? HType::JSArray() : HType::JSObject(); |
| 8245 HInstruction* target = NULL; | 8248 HInstruction* target = NULL; |
| 8246 HInstruction* data_target = NULL; | 8249 HInstruction* data_target = NULL; |
| 8247 | 8250 |
| 8248 if (isolate()->heap()->GetPretenureMode() == TENURED) { | 8251 if (isolate()->heap()->GetPretenureMode() == TENURED) { |
| 8249 if (data_size != 0) { | 8252 if (data_size != 0) { |
| 8250 HValue* size_in_bytes = Add<HConstant>(data_size); | 8253 HValue* size_in_bytes = Add<HConstant>(data_size); |
| 8251 data_target = Add<HAllocate>(size_in_bytes, HType::JSObject(), TENURED, | 8254 data_target = Add<HAllocate>(size_in_bytes, HType::JSObject(), TENURED, |
| 8252 FIXED_DOUBLE_ARRAY_TYPE); | 8255 FIXED_DOUBLE_ARRAY_TYPE); |
| 8253 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); | 8256 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); |
| 8254 AddStoreMapConstant(data_target, free_space_map); | 8257 AddStoreMapConstant(data_target, free_space_map); |
| 8255 HObjectAccess access = | 8258 HObjectAccess access = |
| 8256 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | 8259 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); |
| 8257 Add<HStoreNamedField>(data_target, access, size_in_bytes); | 8260 Add<HStoreNamedField>(data_target, access, size_in_bytes); |
| 8258 } | 8261 } |
| 8259 if (pointer_size != 0) { | 8262 if (pointer_size != 0) { |
| 8260 HValue* size_in_bytes = Add<HConstant>(pointer_size); | 8263 HValue* size_in_bytes = Add<HConstant>(pointer_size); |
| 8261 target = Add<HAllocate>(size_in_bytes, HType::JSObject(), TENURED, | 8264 target = Add<HAllocate>(size_in_bytes, type, TENURED, instance_type); |
| 8262 JS_OBJECT_TYPE); | |
| 8263 } | 8265 } |
| 8264 } else { | 8266 } else { |
| 8265 InstanceType instance_type = boilerplate_object->map()->instance_type(); | |
| 8266 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); | 8267 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); |
| 8267 target = Add<HAllocate>(size_in_bytes, HType::JSObject(), NOT_TENURED, | 8268 target = Add<HAllocate>(size_in_bytes, type, NOT_TENURED, instance_type); |
| 8268 instance_type); | |
| 8269 } | 8269 } |
| 8270 | 8270 |
| 8271 int offset = 0; | 8271 int offset = 0; |
| 8272 int data_offset = 0; | 8272 int data_offset = 0; |
| 8273 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, | 8273 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, |
| 8274 allocation_site, target, &offset, data_target, | 8274 allocation_site, target, &offset, data_target, |
| 8275 &data_offset, mode); | 8275 &data_offset, mode); |
| 8276 return target; | 8276 return target; |
| 8277 } | 8277 } |
| 8278 | 8278 |
| 8279 | 8279 |
| 8280 void HOptimizedGraphBuilder::BuildEmitDeepCopy( | 8280 void HOptimizedGraphBuilder::BuildEmitDeepCopy( |
| 8281 Handle<JSObject> boilerplate_object, | 8281 Handle<JSObject> boilerplate_object, |
| 8282 Handle<JSObject> original_boilerplate_object, | 8282 Handle<JSObject> original_boilerplate_object, |
| 8283 Handle<Object> allocation_site_object, | 8283 Handle<Object> allocation_site_object, |
| 8284 HInstruction* target, | 8284 HInstruction* target, |
| 8285 int* offset, | 8285 int* offset, |
| 8286 HInstruction* data_target, | 8286 HInstruction* data_target, |
| 8287 int* data_offset, | 8287 int* data_offset, |
| 8288 AllocationSiteMode mode) { | 8288 AllocationSiteMode mode) { |
| 8289 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && | 8289 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
| 8290 boilerplate_object->map()->CanTrackAllocationSite(); | 8290 AllocationSite::CanTrack(boilerplate_object->map()->instance_type()); |
| 8291 | 8291 |
| 8292 // If using allocation sites, then the payload on the site should already | 8292 // If using allocation sites, then the payload on the site should already |
| 8293 // be filled in as a valid (boilerplate) array. | 8293 // be filled in as a valid (boilerplate) array. |
| 8294 ASSERT(!create_allocation_site_info || | 8294 ASSERT(!create_allocation_site_info || |
| 8295 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); | 8295 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); |
| 8296 | 8296 |
| 8297 HInstruction* allocation_site = NULL; | 8297 HInstruction* allocation_site = NULL; |
| 8298 | 8298 |
| 8299 if (create_allocation_site_info) { | 8299 if (create_allocation_site_info) { |
| 8300 allocation_site = Add<HConstant>(allocation_site_object); | 8300 allocation_site = Add<HConstant>(allocation_site_object); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8336 // Copy in-object properties. | 8336 // Copy in-object properties. |
| 8337 if (boilerplate_object->map()->NumberOfFields() != 0) { | 8337 if (boilerplate_object->map()->NumberOfFields() != 0) { |
| 8338 HValue* object_properties = | 8338 HValue* object_properties = |
| 8339 Add<HInnerAllocatedObject>(target, object_offset); | 8339 Add<HInnerAllocatedObject>(target, object_offset); |
| 8340 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, | 8340 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, |
| 8341 object_properties, target, offset, data_target, data_offset); | 8341 object_properties, target, offset, data_target, data_offset); |
| 8342 } | 8342 } |
| 8343 | 8343 |
| 8344 // Create allocation site info. | 8344 // Create allocation site info. |
| 8345 if (mode == TRACK_ALLOCATION_SITE && | 8345 if (mode == TRACK_ALLOCATION_SITE && |
| 8346 boilerplate_object->map()->CanTrackAllocationSite()) { | 8346 AllocationSite::CanTrack(boilerplate_object->map()->instance_type())) { |
| 8347 elements_offset += AllocationMemento::kSize; | 8347 elements_offset += AllocationMemento::kSize; |
| 8348 *offset += AllocationMemento::kSize; | 8348 *offset += AllocationMemento::kSize; |
| 8349 BuildCreateAllocationMemento(target, JSArray::kSize, allocation_site); | 8349 BuildCreateAllocationMemento(target, JSArray::kSize, allocation_site); |
| 8350 } | 8350 } |
| 8351 } | 8351 } |
| 8352 | 8352 |
| 8353 | 8353 |
| 8354 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( | 8354 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( |
| 8355 Handle<JSObject> boilerplate_object, | 8355 Handle<JSObject> boilerplate_object, |
| 8356 HInstruction* target, | 8356 HInstruction* target, |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9843 if (ShouldProduceTraceOutput()) { | 9843 if (ShouldProduceTraceOutput()) { |
| 9844 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9844 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9845 } | 9845 } |
| 9846 | 9846 |
| 9847 #ifdef DEBUG | 9847 #ifdef DEBUG |
| 9848 graph_->Verify(false); // No full verify. | 9848 graph_->Verify(false); // No full verify. |
| 9849 #endif | 9849 #endif |
| 9850 } | 9850 } |
| 9851 | 9851 |
| 9852 } } // namespace v8::internal | 9852 } } // namespace v8::internal |
| OLD | NEW |