| 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 8168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8179 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( | 8179 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
| 8180 Handle<JSObject> boilerplate_object, | 8180 Handle<JSObject> boilerplate_object, |
| 8181 Handle<Object> allocation_site_object, | 8181 Handle<Object> allocation_site_object, |
| 8182 AllocationSiteMode mode) { | 8182 AllocationSiteMode mode) { |
| 8183 NoObservableSideEffectsScope no_effects(this); | 8183 NoObservableSideEffectsScope no_effects(this); |
| 8184 | 8184 |
| 8185 Handle<FixedArrayBase> elements(boilerplate_object->elements()); | 8185 Handle<FixedArrayBase> elements(boilerplate_object->elements()); |
| 8186 int object_size = boilerplate_object->map()->instance_size(); | 8186 int object_size = boilerplate_object->map()->instance_size(); |
| 8187 int object_offset = object_size; | 8187 int object_offset = object_size; |
| 8188 | 8188 |
| 8189 InstanceType instance_type = boilerplate_object->map()->instance_type(); |
| 8189 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && | 8190 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
| 8190 AllocationSite::CanTrack(boilerplate_object->map()->instance_type()); | 8191 AllocationSite::CanTrack(instance_type); |
| 8191 | 8192 |
| 8192 // If using allocation sites, then the payload on the site should already | 8193 // If using allocation sites, then the payload on the site should already |
| 8193 // be filled in as a valid (boilerplate) array. | 8194 // be filled in as a valid (boilerplate) array. |
| 8194 ASSERT(!create_allocation_site_info || | 8195 ASSERT(!create_allocation_site_info || |
| 8195 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); | 8196 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); |
| 8196 | 8197 |
| 8197 if (create_allocation_site_info) { | 8198 if (create_allocation_site_info) { |
| 8198 object_size += AllocationMemento::kSize; | 8199 object_size += AllocationMemento::kSize; |
| 8199 } | 8200 } |
| 8200 | 8201 |
| 8202 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); |
| 8203 HType type = instance_type == JS_ARRAY_TYPE |
| 8204 ? HType::JSArray() : HType::JSObject(); |
| 8201 HValue* object_size_constant = Add<HConstant>(object_size); | 8205 HValue* object_size_constant = Add<HConstant>(object_size); |
| 8202 HInstruction* object = Add<HAllocate>(object_size_constant, HType::JSObject(), | 8206 HInstruction* object = Add<HAllocate>(object_size_constant, type, |
| 8203 isolate()->heap()->GetPretenureMode(), JS_OBJECT_TYPE); | 8207 isolate()->heap()->GetPretenureMode(), instance_type); |
| 8204 | 8208 |
| 8205 | 8209 |
| 8206 BuildEmitObjectHeader(boilerplate_object, object); | 8210 BuildEmitObjectHeader(boilerplate_object, object); |
| 8207 | 8211 |
| 8208 if (create_allocation_site_info) { | 8212 if (create_allocation_site_info) { |
| 8209 HInstruction* allocation_site = Add<HConstant>(allocation_site_object); | 8213 HInstruction* allocation_site = Add<HConstant>(allocation_site_object); |
| 8210 BuildCreateAllocationMemento(object, object_offset, allocation_site); | 8214 BuildCreateAllocationMemento(object, object_offset, allocation_site); |
| 8211 } | 8215 } |
| 8212 | 8216 |
| 8213 int elements_size = (elements->length() > 0 && | 8217 int elements_size = (elements->length() > 0 && |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9690 if (ShouldProduceTraceOutput()) { | 9694 if (ShouldProduceTraceOutput()) { |
| 9691 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9695 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9692 } | 9696 } |
| 9693 | 9697 |
| 9694 #ifdef DEBUG | 9698 #ifdef DEBUG |
| 9695 graph_->Verify(false); // No full verify. | 9699 graph_->Verify(false); // No full verify. |
| 9696 #endif | 9700 #endif |
| 9697 } | 9701 } |
| 9698 | 9702 |
| 9699 } } // namespace v8::internal | 9703 } } // namespace v8::internal |
| OLD | NEW |