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 9888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9899 | 9899 |
9900 Handle<FixedArrayBase> elements(boilerplate_object->elements()); | 9900 Handle<FixedArrayBase> elements(boilerplate_object->elements()); |
9901 int elements_size = (elements->length() > 0 && | 9901 int elements_size = (elements->length() > 0 && |
9902 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? | 9902 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? |
9903 elements->Size() : 0; | 9903 elements->Size() : 0; |
9904 | 9904 |
9905 HInstruction* object_elements = NULL; | 9905 HInstruction* object_elements = NULL; |
9906 if (elements_size > 0) { | 9906 if (elements_size > 0) { |
9907 HValue* object_elements_size = Add<HConstant>(elements_size); | 9907 HValue* object_elements_size = Add<HConstant>(elements_size); |
9908 if (boilerplate_object->HasFastDoubleElements()) { | 9908 if (boilerplate_object->HasFastDoubleElements()) { |
| 9909 // Allocation folding will not be able to fold |object| and |
| 9910 // |object_elements| together in some cases, so initialize |
| 9911 // elements with the undefined to make GC happy. |
| 9912 HConstant* empty_fixed_array = Add<HConstant>( |
| 9913 isolate()->factory()->empty_fixed_array()); |
| 9914 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
| 9915 empty_fixed_array, INITIALIZING_STORE); |
9909 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9916 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
9910 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current()); | 9917 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current()); |
9911 } else { | 9918 } else { |
9912 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9919 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
9913 pretenure_flag, FIXED_ARRAY_TYPE, site_context->current()); | 9920 pretenure_flag, FIXED_ARRAY_TYPE, site_context->current()); |
9914 } | 9921 } |
9915 } | 9922 } |
9916 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); | 9923 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); |
9917 | 9924 |
9918 // Copy object elements if non-COW. | 9925 // Copy object elements if non-COW. |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11365 if (ShouldProduceTraceOutput()) { | 11372 if (ShouldProduceTraceOutput()) { |
11366 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11373 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11367 } | 11374 } |
11368 | 11375 |
11369 #ifdef DEBUG | 11376 #ifdef DEBUG |
11370 graph_->Verify(false); // No full verify. | 11377 graph_->Verify(false); // No full verify. |
11371 #endif | 11378 #endif |
11372 } | 11379 } |
11373 | 11380 |
11374 } } // namespace v8::internal | 11381 } } // namespace v8::internal |
OLD | NEW |