Chromium Code Reviews| 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 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2302 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value); | 2302 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value); |
| 2303 mul->ClearFlag(HValue::kCanOverflow); | 2303 mul->ClearFlag(HValue::kCanOverflow); |
| 2304 | 2304 |
| 2305 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); | 2305 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); |
| 2306 HValue* total_size = AddUncasted<HAdd>(mul, header_size); | 2306 HValue* total_size = AddUncasted<HAdd>(mul, header_size); |
| 2307 total_size->ClearFlag(HValue::kCanOverflow); | 2307 total_size->ClearFlag(HValue::kCanOverflow); |
| 2308 | 2308 |
| 2309 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? | 2309 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? |
| 2310 isolate()->heap()->GetPretenureMode() : NOT_TENURED; | 2310 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| 2311 | 2311 |
| 2312 return Add<HAllocate>(total_size, HType::JSArray(), pretenure_flag, | 2312 return Add<HAllocate>(total_size, HType::Tagged(), pretenure_flag, |
| 2313 instance_type); | 2313 instance_type); |
| 2314 } | 2314 } |
| 2315 | 2315 |
| 2316 | 2316 |
| 2317 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, | 2317 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, |
| 2318 ElementsKind kind, | 2318 ElementsKind kind, |
| 2319 HValue* capacity) { | 2319 HValue* capacity) { |
| 2320 Factory* factory = isolate()->factory(); | 2320 Factory* factory = isolate()->factory(); |
| 2321 Handle<Map> map = IsFastDoubleElementsKind(kind) | 2321 Handle<Map> map = IsFastDoubleElementsKind(kind) |
| 2322 ? factory->fixed_double_array_map() | 2322 ? factory->fixed_double_array_map() |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2608 if (mode == TRACK_ALLOCATION_SITE) { | 2608 if (mode == TRACK_ALLOCATION_SITE) { |
| 2609 BuildCreateAllocationMemento( | 2609 BuildCreateAllocationMemento( |
| 2610 object, Add<HConstant>(JSArray::kSize), allocation_site); | 2610 object, Add<HConstant>(JSArray::kSize), allocation_site); |
| 2611 } | 2611 } |
| 2612 | 2612 |
| 2613 if (length > 0) { | 2613 if (length > 0) { |
| 2614 HValue* boilerplate_elements = AddLoadElements(boilerplate); | 2614 HValue* boilerplate_elements = AddLoadElements(boilerplate); |
| 2615 HValue* object_elements; | 2615 HValue* object_elements; |
| 2616 if (IsFastDoubleElementsKind(kind)) { | 2616 if (IsFastDoubleElementsKind(kind)) { |
| 2617 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length)); | 2617 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length)); |
| 2618 object_elements = Add<HAllocate>(elems_size, HType::JSArray(), | 2618 object_elements = Add<HAllocate>(elems_size, HType::Tagged(), |
| 2619 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE); | 2619 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE); |
| 2620 } else { | 2620 } else { |
| 2621 HValue* elems_size = Add<HConstant>(FixedArray::SizeFor(length)); | 2621 HValue* elems_size = Add<HConstant>(FixedArray::SizeFor(length)); |
| 2622 object_elements = Add<HAllocate>(elems_size, HType::JSArray(), | 2622 object_elements = Add<HAllocate>(elems_size, HType::Tagged(), |
| 2623 NOT_TENURED, FIXED_ARRAY_TYPE); | 2623 NOT_TENURED, FIXED_ARRAY_TYPE); |
| 2624 } | 2624 } |
| 2625 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), | 2625 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
| 2626 object_elements); | 2626 object_elements); |
| 2627 | 2627 |
| 2628 // Copy the elements array header. | 2628 // Copy the elements array header. |
| 2629 for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) { | 2629 for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) { |
| 2630 HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i); | 2630 HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i); |
| 2631 Add<HStoreNamedField>( | 2631 Add<HStoreNamedField>( |
| 2632 object_elements, access, Add<HLoadNamedField>( | 2632 object_elements, access, Add<HLoadNamedField>( |
| (...skipping 5893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8526 Add<HStoreNamedField>(obj, | 8526 Add<HStoreNamedField>(obj, |
| 8527 HObjectAccess::ForJSTypedArrayLength(), | 8527 HObjectAccess::ForJSTypedArrayLength(), |
| 8528 length); | 8528 length); |
| 8529 | 8529 |
| 8530 Handle<Map> external_array_map( | 8530 Handle<Map> external_array_map( |
| 8531 isolate()->heap()->MapForExternalArrayType(array_type)); | 8531 isolate()->heap()->MapForExternalArrayType(array_type)); |
| 8532 | 8532 |
| 8533 HValue* elements = | 8533 HValue* elements = |
| 8534 Add<HAllocate>( | 8534 Add<HAllocate>( |
| 8535 Add<HConstant>(ExternalArray::kAlignedSize), | 8535 Add<HConstant>(ExternalArray::kAlignedSize), |
| 8536 HType::JSArray(), | 8536 HType::Tagged(), |
| 8537 NOT_TENURED, | 8537 NOT_TENURED, |
| 8538 external_array_map->instance_type()); | 8538 external_array_map->instance_type()); |
| 8539 | 8539 |
| 8540 AddStoreMapConstant(elements, external_array_map); | 8540 AddStoreMapConstant(elements, external_array_map); |
| 8541 | 8541 |
| 8542 HValue* backing_store = Add<HLoadNamedField>( | 8542 HValue* backing_store = Add<HLoadNamedField>( |
| 8543 buffer, static_cast<HValue*>(NULL), | 8543 buffer, static_cast<HValue*>(NULL), |
| 8544 HObjectAccess::ForJSArrayBufferBackingStore()); | 8544 HObjectAccess::ForJSArrayBufferBackingStore()); |
| 8545 | 8545 |
| 8546 HValue* typed_array_start; | 8546 HValue* typed_array_start; |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9781 HValue* object_elements_size = Add<HConstant>(elements_size); | 9781 HValue* object_elements_size = Add<HConstant>(elements_size); |
| 9782 if (boilerplate_object->HasFastDoubleElements()) { | 9782 if (boilerplate_object->HasFastDoubleElements()) { |
| 9783 // Allocation folding will not be able to fold |object| and | 9783 // Allocation folding will not be able to fold |object| and |
| 9784 // |object_elements| together if they are pre-tenured. | 9784 // |object_elements| together if they are pre-tenured. |
| 9785 if (pretenure_flag == TENURED) { | 9785 if (pretenure_flag == TENURED) { |
| 9786 HConstant* empty_fixed_array = Add<HConstant>( | 9786 HConstant* empty_fixed_array = Add<HConstant>( |
| 9787 isolate()->factory()->empty_fixed_array()); | 9787 isolate()->factory()->empty_fixed_array()); |
| 9788 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), | 9788 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), |
| 9789 empty_fixed_array); | 9789 empty_fixed_array); |
| 9790 } | 9790 } |
| 9791 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9791 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
|
Michael Starzinger
2014/03/24 14:08:54
This seems to be off as well.
| |
| 9792 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current()); | 9792 pretenure_flag, FIXED_DOUBLE_ARRAY_TYPE, site_context->current()); |
| 9793 } else { | 9793 } else { |
| 9794 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), | 9794 object_elements = Add<HAllocate>(object_elements_size, HType::JSObject(), |
|
Michael Starzinger
2014/03/24 14:08:54
This seems to be off as well.
| |
| 9795 pretenure_flag, FIXED_ARRAY_TYPE, site_context->current()); | 9795 pretenure_flag, FIXED_ARRAY_TYPE, site_context->current()); |
| 9796 } | 9796 } |
| 9797 } | 9797 } |
| 9798 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); | 9798 BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements); |
| 9799 | 9799 |
| 9800 // Copy object elements if non-COW. | 9800 // Copy object elements if non-COW. |
| 9801 if (object_elements != NULL) { | 9801 if (object_elements != NULL) { |
| 9802 BuildEmitElements(boilerplate_object, elements, object_elements, | 9802 BuildEmitElements(boilerplate_object, elements, object_elements, |
| 9803 site_context); | 9803 site_context); |
| 9804 } | 9804 } |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11304 if (ShouldProduceTraceOutput()) { | 11304 if (ShouldProduceTraceOutput()) { |
| 11305 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11305 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11306 } | 11306 } |
| 11307 | 11307 |
| 11308 #ifdef DEBUG | 11308 #ifdef DEBUG |
| 11309 graph_->Verify(false); // No full verify. | 11309 graph_->Verify(false); // No full verify. |
| 11310 #endif | 11310 #endif |
| 11311 } | 11311 } |
| 11312 | 11312 |
| 11313 } } // namespace v8::internal | 11313 } } // namespace v8::internal |
| OLD | NEW |