| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 9928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9939 | 9939 |
| 9940 | 9940 |
| 9941 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( | 9941 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
| 9942 HValue* context, | 9942 HValue* context, |
| 9943 Handle<JSObject> boilerplate_object, | 9943 Handle<JSObject> boilerplate_object, |
| 9944 Handle<JSObject> original_boilerplate_object, | 9944 Handle<JSObject> original_boilerplate_object, |
| 9945 int data_size, | 9945 int data_size, |
| 9946 int pointer_size, | 9946 int pointer_size, |
| 9947 AllocationSiteMode mode) { | 9947 AllocationSiteMode mode) { |
| 9948 Zone* zone = this->zone(); | 9948 Zone* zone = this->zone(); |
| 9949 int total_size = data_size + pointer_size; | |
| 9950 | |
| 9951 NoObservableSideEffectsScope no_effects(this); | 9949 NoObservableSideEffectsScope no_effects(this); |
| 9952 | 9950 |
| 9953 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; | 9951 HInstruction* target = NULL; |
| 9954 // TODO(hpayer): add support for old data space | 9952 HInstruction* data_target = NULL; |
| 9955 if (isolate()->heap()->ShouldGloballyPretenure() && | 9953 |
| 9956 data_size == 0) { | 9954 HAllocate::Flags flags = HAllocate::DefaultFlags(); |
| 9957 flags = static_cast<HAllocate::Flags>( | 9955 |
| 9958 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 9956 if (isolate()->heap()->ShouldGloballyPretenure()) { |
| 9957 if (data_size != 0) { |
| 9958 HAllocate::Flags data_flags = |
| 9959 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags() | |
| 9960 HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); |
| 9961 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(data_size)); |
| 9962 data_target = AddInstruction(new(zone) HAllocate( |
| 9963 context, size_in_bytes, HType::JSObject(), data_flags)); |
| 9964 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); |
| 9965 AddStoreMapConstant(data_target, free_space_map); |
| 9966 HObjectAccess access = |
| 9967 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); |
| 9968 AddStore(data_target, access, size_in_bytes); |
| 9969 } |
| 9970 if (pointer_size != 0) { |
| 9971 flags = static_cast<HAllocate::Flags>( |
| 9972 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
| 9973 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(pointer_size)); |
| 9974 target = AddInstruction(new(zone) HAllocate(context, |
| 9975 size_in_bytes, HType::JSObject(), flags)); |
| 9976 } |
| 9977 } else { |
| 9978 HValue* size_in_bytes = |
| 9979 AddInstruction(new(zone) HConstant(data_size + pointer_size)); |
| 9980 target = AddInstruction(new(zone) HAllocate(context, size_in_bytes, |
| 9981 HType::JSObject(), flags)); |
| 9959 } | 9982 } |
| 9960 | 9983 |
| 9961 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(total_size)); | |
| 9962 HInstruction* result = | |
| 9963 AddInstruction(new(zone) HAllocate(context, | |
| 9964 size_in_bytes, | |
| 9965 HType::JSObject(), | |
| 9966 flags)); | |
| 9967 int offset = 0; | 9984 int offset = 0; |
| 9968 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, result, | 9985 int data_offset = 0; |
| 9969 &offset, mode); | 9986 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, target, |
| 9970 return result; | 9987 &offset, data_target, &data_offset, mode); |
| 9988 return target; |
| 9971 } | 9989 } |
| 9972 | 9990 |
| 9973 | 9991 |
| 9974 void HOptimizedGraphBuilder::BuildEmitDeepCopy( | 9992 void HOptimizedGraphBuilder::BuildEmitDeepCopy( |
| 9975 Handle<JSObject> boilerplate_object, | 9993 Handle<JSObject> boilerplate_object, |
| 9976 Handle<JSObject> original_boilerplate_object, | 9994 Handle<JSObject> original_boilerplate_object, |
| 9977 HInstruction* target, | 9995 HInstruction* target, |
| 9978 int* offset, | 9996 int* offset, |
| 9997 HInstruction* data_target, |
| 9998 int* data_offset, |
| 9979 AllocationSiteMode mode) { | 9999 AllocationSiteMode mode) { |
| 9980 Zone* zone = this->zone(); | 10000 Zone* zone = this->zone(); |
| 9981 | 10001 |
| 9982 Handle<FixedArrayBase> elements(boilerplate_object->elements()); | 10002 Handle<FixedArrayBase> elements(boilerplate_object->elements()); |
| 9983 Handle<FixedArrayBase> original_elements( | 10003 Handle<FixedArrayBase> original_elements( |
| 9984 original_boilerplate_object->elements()); | 10004 original_boilerplate_object->elements()); |
| 9985 ElementsKind kind = boilerplate_object->map()->elements_kind(); | 10005 ElementsKind kind = boilerplate_object->map()->elements_kind(); |
| 9986 | 10006 |
| 9987 // Increase the offset so that subsequent objects end up right after | |
| 9988 // this object and its backing store. | |
| 9989 int object_offset = *offset; | 10007 int object_offset = *offset; |
| 9990 int object_size = boilerplate_object->map()->instance_size(); | 10008 int object_size = boilerplate_object->map()->instance_size(); |
| 9991 int elements_size = (elements->length() > 0 && | 10009 int elements_size = (elements->length() > 0 && |
| 9992 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? | 10010 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? |
| 9993 elements->Size() : 0; | 10011 elements->Size() : 0; |
| 9994 int elements_offset = *offset + object_size; | 10012 int elements_offset = 0; |
| 9995 | 10013 |
| 9996 *offset += object_size + elements_size; | 10014 if (data_target != NULL && boilerplate_object->HasFastDoubleElements()) { |
| 10015 elements_offset = *data_offset; |
| 10016 *data_offset += elements_size; |
| 10017 } else { |
| 10018 // Place elements right after this object. |
| 10019 elements_offset = *offset + object_size; |
| 10020 *offset += elements_size; |
| 10021 } |
| 10022 // Increase the offset so that subsequent objects end up right after this |
| 10023 // object (and it's elements if they are allocated in the same space). |
| 10024 *offset += object_size; |
| 9997 | 10025 |
| 9998 // Copy object elements if non-COW. | 10026 // Copy object elements if non-COW. |
| 9999 HValue* object_elements = BuildEmitObjectHeader(boilerplate_object, target, | 10027 HValue* object_elements = BuildEmitObjectHeader(boilerplate_object, target, |
| 10000 object_offset, elements_offset, elements_size); | 10028 data_target, object_offset, elements_offset, elements_size); |
| 10001 if (object_elements != NULL) { | 10029 if (object_elements != NULL) { |
| 10002 BuildEmitElements(elements, original_elements, kind, object_elements, | 10030 BuildEmitElements(elements, original_elements, kind, object_elements, |
| 10003 target, offset); | 10031 target, offset, data_target, data_offset); |
| 10004 } | 10032 } |
| 10005 | 10033 |
| 10006 // Copy in-object properties. | 10034 // Copy in-object properties. |
| 10007 HValue* object_properties = | 10035 HValue* object_properties = |
| 10008 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10036 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
| 10009 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, | 10037 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, |
| 10010 object_properties, target, offset); | 10038 object_properties, target, offset, data_target, data_offset); |
| 10011 | 10039 |
| 10012 // Create allocation site info. | 10040 // Create allocation site info. |
| 10013 if (mode == TRACK_ALLOCATION_SITE && | 10041 if (mode == TRACK_ALLOCATION_SITE && |
| 10014 boilerplate_object->map()->CanTrackAllocationSite()) { | 10042 boilerplate_object->map()->CanTrackAllocationSite()) { |
| 10015 elements_offset += AllocationSiteInfo::kSize; | 10043 elements_offset += AllocationSiteInfo::kSize; |
| 10016 *offset += AllocationSiteInfo::kSize; | 10044 *offset += AllocationSiteInfo::kSize; |
| 10017 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( | 10045 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( |
| 10018 original_boilerplate_object)); | 10046 original_boilerplate_object)); |
| 10019 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); | 10047 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); |
| 10020 } | 10048 } |
| 10021 } | 10049 } |
| 10022 | 10050 |
| 10023 | 10051 |
| 10024 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( | 10052 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( |
| 10025 Handle<JSObject> boilerplate_object, | 10053 Handle<JSObject> boilerplate_object, |
| 10026 HInstruction* target, | 10054 HInstruction* target, |
| 10055 HInstruction* data_target, |
| 10027 int object_offset, | 10056 int object_offset, |
| 10028 int elements_offset, | 10057 int elements_offset, |
| 10029 int elements_size) { | 10058 int elements_size) { |
| 10030 ASSERT(boilerplate_object->properties()->length() == 0); | 10059 ASSERT(boilerplate_object->properties()->length() == 0); |
| 10031 Zone* zone = this->zone(); | 10060 Zone* zone = this->zone(); |
| 10032 HValue* result = NULL; | 10061 HValue* result = NULL; |
| 10033 | 10062 |
| 10034 HValue* object_header = | 10063 HValue* object_header = |
| 10035 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10064 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
| 10036 Handle<Map> boilerplate_object_map(boilerplate_object->map()); | 10065 Handle<Map> boilerplate_object_map(boilerplate_object->map()); |
| 10037 AddStoreMapConstant(object_header, boilerplate_object_map); | 10066 AddStoreMapConstant(object_header, boilerplate_object_map); |
| 10038 | 10067 |
| 10039 HInstruction* elements; | 10068 HInstruction* elements; |
| 10040 if (elements_size == 0) { | 10069 if (elements_size == 0) { |
| 10041 Handle<Object> elements_field = | 10070 Handle<Object> elements_field = |
| 10042 Handle<Object>(boilerplate_object->elements(), isolate()); | 10071 Handle<Object>(boilerplate_object->elements(), isolate()); |
| 10043 elements = AddInstruction(new(zone) HConstant(elements_field)); | 10072 elements = AddInstruction(new(zone) HConstant(elements_field)); |
| 10044 } else { | 10073 } else { |
| 10045 elements = AddInstruction(new(zone) HInnerAllocatedObject( | 10074 if (data_target != NULL && boilerplate_object->HasFastDoubleElements()) { |
| 10046 target, elements_offset)); | 10075 elements = AddInstruction(new(zone) HInnerAllocatedObject( |
| 10076 data_target, elements_offset)); |
| 10077 } else { |
| 10078 elements = AddInstruction(new(zone) HInnerAllocatedObject( |
| 10079 target, elements_offset)); |
| 10080 } |
| 10047 result = elements; | 10081 result = elements; |
| 10048 } | 10082 } |
| 10049 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements); | 10083 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements); |
| 10050 | 10084 |
| 10051 Handle<Object> properties_field = | 10085 Handle<Object> properties_field = |
| 10052 Handle<Object>(boilerplate_object->properties(), isolate()); | 10086 Handle<Object>(boilerplate_object->properties(), isolate()); |
| 10053 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array()); | 10087 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array()); |
| 10054 HInstruction* properties = AddInstruction(new(zone) HConstant( | 10088 HInstruction* properties = AddInstruction(new(zone) HConstant( |
| 10055 properties_field)); | 10089 properties_field)); |
| 10056 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); | 10090 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10073 | 10107 |
| 10074 return result; | 10108 return result; |
| 10075 } | 10109 } |
| 10076 | 10110 |
| 10077 | 10111 |
| 10078 void HOptimizedGraphBuilder::BuildEmitInObjectProperties( | 10112 void HOptimizedGraphBuilder::BuildEmitInObjectProperties( |
| 10079 Handle<JSObject> boilerplate_object, | 10113 Handle<JSObject> boilerplate_object, |
| 10080 Handle<JSObject> original_boilerplate_object, | 10114 Handle<JSObject> original_boilerplate_object, |
| 10081 HValue* object_properties, | 10115 HValue* object_properties, |
| 10082 HInstruction* target, | 10116 HInstruction* target, |
| 10083 int* offset) { | 10117 int* offset, |
| 10118 HInstruction* data_target, |
| 10119 int* data_offset) { |
| 10084 Zone* zone = this->zone(); | 10120 Zone* zone = this->zone(); |
| 10085 Handle<DescriptorArray> descriptors( | 10121 Handle<DescriptorArray> descriptors( |
| 10086 boilerplate_object->map()->instance_descriptors()); | 10122 boilerplate_object->map()->instance_descriptors()); |
| 10087 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); | 10123 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); |
| 10088 | 10124 |
| 10089 int copied_fields = 0; | 10125 int copied_fields = 0; |
| 10090 for (int i = 0; i < limit; i++) { | 10126 for (int i = 0; i < limit; i++) { |
| 10091 PropertyDetails details = descriptors->GetDetails(i); | 10127 PropertyDetails details = descriptors->GetDetails(i); |
| 10092 if (details.type() != FIELD) continue; | 10128 if (details.type() != FIELD) continue; |
| 10093 copied_fields++; | 10129 copied_fields++; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 10107 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10143 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 10108 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10144 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
| 10109 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), | 10145 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), |
| 10110 isolate())); | 10146 isolate())); |
| 10111 HInstruction* value_instruction = | 10147 HInstruction* value_instruction = |
| 10112 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10148 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
| 10113 | 10149 |
| 10114 AddStore(object_properties, access, value_instruction); | 10150 AddStore(object_properties, access, value_instruction); |
| 10115 | 10151 |
| 10116 BuildEmitDeepCopy(value_object, original_value_object, target, | 10152 BuildEmitDeepCopy(value_object, original_value_object, target, |
| 10117 offset, DONT_TRACK_ALLOCATION_SITE); | 10153 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); |
| 10118 } else { | 10154 } else { |
| 10119 Representation representation = details.representation(); | 10155 Representation representation = details.representation(); |
| 10120 HInstruction* value_instruction = | 10156 HInstruction* value_instruction = |
| 10121 AddInstruction(new(zone) HConstant(value)); | 10157 AddInstruction(new(zone) HConstant(value)); |
| 10122 | 10158 |
| 10123 if (representation.IsDouble()) { | 10159 if (representation.IsDouble()) { |
| 10124 // Allocate a HeapNumber box and store the value into it. | 10160 // Allocate a HeapNumber box and store the value into it. |
| 10125 HInstruction* double_box = | 10161 HInstruction* double_box; |
| 10126 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10162 if (data_target != NULL) { |
| 10163 double_box = AddInstruction(new(zone) HInnerAllocatedObject( |
| 10164 data_target, *data_offset)); |
| 10165 *data_offset += HeapNumber::kSize; |
| 10166 } else { |
| 10167 double_box = AddInstruction(new(zone) HInnerAllocatedObject( |
| 10168 target, *offset)); |
| 10169 *offset += HeapNumber::kSize; |
| 10170 } |
| 10127 AddStoreMapConstant(double_box, | 10171 AddStoreMapConstant(double_box, |
| 10128 isolate()->factory()->heap_number_map()); | 10172 isolate()->factory()->heap_number_map()); |
| 10129 AddStore(double_box, HObjectAccess::ForHeapNumberValue(), | 10173 AddStore(double_box, HObjectAccess::ForHeapNumberValue(), |
| 10130 value_instruction, Representation::Double()); | 10174 value_instruction, Representation::Double()); |
| 10131 value_instruction = double_box; | 10175 value_instruction = double_box; |
| 10132 *offset += HeapNumber::kSize; | |
| 10133 } | 10176 } |
| 10134 | 10177 |
| 10135 AddStore(object_properties, access, value_instruction); | 10178 AddStore(object_properties, access, value_instruction); |
| 10136 } | 10179 } |
| 10137 } | 10180 } |
| 10138 | 10181 |
| 10139 int inobject_properties = boilerplate_object->map()->inobject_properties(); | 10182 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
| 10140 HInstruction* value_instruction = AddInstruction(new(zone) | 10183 HInstruction* value_instruction = AddInstruction(new(zone) |
| 10141 HConstant(isolate()->factory()->one_pointer_filler_map())); | 10184 HConstant(isolate()->factory()->one_pointer_filler_map())); |
| 10142 for (int i = copied_fields; i < inobject_properties; i++) { | 10185 for (int i = copied_fields; i < inobject_properties; i++) { |
| 10143 ASSERT(boilerplate_object->IsJSObject()); | 10186 ASSERT(boilerplate_object->IsJSObject()); |
| 10144 int property_offset = boilerplate_object->GetInObjectPropertyOffset(i); | 10187 int property_offset = boilerplate_object->GetInObjectPropertyOffset(i); |
| 10145 HObjectAccess access = HObjectAccess::ForJSObjectOffset(property_offset); | 10188 HObjectAccess access = HObjectAccess::ForJSObjectOffset(property_offset); |
| 10146 AddStore(object_properties, access, value_instruction); | 10189 AddStore(object_properties, access, value_instruction); |
| 10147 } | 10190 } |
| 10148 } | 10191 } |
| 10149 | 10192 |
| 10150 | 10193 |
| 10151 void HOptimizedGraphBuilder::BuildEmitElements( | 10194 void HOptimizedGraphBuilder::BuildEmitElements( |
| 10152 Handle<FixedArrayBase> elements, | 10195 Handle<FixedArrayBase> elements, |
| 10153 Handle<FixedArrayBase> original_elements, | 10196 Handle<FixedArrayBase> original_elements, |
| 10154 ElementsKind kind, | 10197 ElementsKind kind, |
| 10155 HValue* object_elements, | 10198 HValue* object_elements, |
| 10156 HInstruction* target, | 10199 HInstruction* target, |
| 10157 int* offset) { | 10200 int* offset, |
| 10201 HInstruction* data_target, |
| 10202 int* data_offset) { |
| 10158 Zone* zone = this->zone(); | 10203 Zone* zone = this->zone(); |
| 10159 | 10204 |
| 10160 int elements_length = elements->length(); | 10205 int elements_length = elements->length(); |
| 10161 HValue* object_elements_length = | 10206 HValue* object_elements_length = |
| 10162 AddInstruction(new(zone) HConstant(elements_length)); | 10207 AddInstruction(new(zone) HConstant(elements_length)); |
| 10163 | 10208 |
| 10164 BuildInitializeElementsHeader(object_elements, kind, object_elements_length); | 10209 BuildInitializeElementsHeader(object_elements, kind, object_elements_length); |
| 10165 | 10210 |
| 10166 // Copy elements backing store content. | 10211 // Copy elements backing store content. |
| 10167 if (elements->IsFixedDoubleArray()) { | 10212 if (elements->IsFixedDoubleArray()) { |
| 10168 BuildEmitFixedDoubleArray(elements, kind, object_elements); | 10213 BuildEmitFixedDoubleArray(elements, kind, object_elements); |
| 10169 } else if (elements->IsFixedArray()) { | 10214 } else if (elements->IsFixedArray()) { |
| 10170 BuildEmitFixedArray(elements, original_elements, kind, object_elements, | 10215 BuildEmitFixedArray(elements, original_elements, kind, object_elements, |
| 10171 target, offset); | 10216 target, offset, data_target, data_offset); |
| 10172 } else { | 10217 } else { |
| 10173 UNREACHABLE(); | 10218 UNREACHABLE(); |
| 10174 } | 10219 } |
| 10175 } | 10220 } |
| 10176 | 10221 |
| 10177 | 10222 |
| 10178 void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( | 10223 void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( |
| 10179 Handle<FixedArrayBase> elements, | 10224 Handle<FixedArrayBase> elements, |
| 10180 ElementsKind kind, | 10225 ElementsKind kind, |
| 10181 HValue* object_elements) { | 10226 HValue* object_elements) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 10194 } | 10239 } |
| 10195 } | 10240 } |
| 10196 | 10241 |
| 10197 | 10242 |
| 10198 void HOptimizedGraphBuilder::BuildEmitFixedArray( | 10243 void HOptimizedGraphBuilder::BuildEmitFixedArray( |
| 10199 Handle<FixedArrayBase> elements, | 10244 Handle<FixedArrayBase> elements, |
| 10200 Handle<FixedArrayBase> original_elements, | 10245 Handle<FixedArrayBase> original_elements, |
| 10201 ElementsKind kind, | 10246 ElementsKind kind, |
| 10202 HValue* object_elements, | 10247 HValue* object_elements, |
| 10203 HInstruction* target, | 10248 HInstruction* target, |
| 10204 int* offset) { | 10249 int* offset, |
| 10250 HInstruction* data_target, |
| 10251 int* data_offset) { |
| 10205 Zone* zone = this->zone(); | 10252 Zone* zone = this->zone(); |
| 10206 HInstruction* boilerplate_elements = | 10253 HInstruction* boilerplate_elements = |
| 10207 AddInstruction(new(zone) HConstant(elements)); | 10254 AddInstruction(new(zone) HConstant(elements)); |
| 10208 int elements_length = elements->length(); | 10255 int elements_length = elements->length(); |
| 10209 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); | 10256 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); |
| 10210 Handle<FixedArray> original_fast_elements = | 10257 Handle<FixedArray> original_fast_elements = |
| 10211 Handle<FixedArray>::cast(original_elements); | 10258 Handle<FixedArray>::cast(original_elements); |
| 10212 for (int i = 0; i < elements_length; i++) { | 10259 for (int i = 0; i < elements_length; i++) { |
| 10213 Handle<Object> value(fast_elements->get(i), isolate()); | 10260 Handle<Object> value(fast_elements->get(i), isolate()); |
| 10214 HValue* key_constant = AddInstruction(new(zone) HConstant(i)); | 10261 HValue* key_constant = AddInstruction(new(zone) HConstant(i)); |
| 10215 if (value->IsJSObject()) { | 10262 if (value->IsJSObject()) { |
| 10216 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10263 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 10217 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10264 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
| 10218 Handle<Object>(original_fast_elements->get(i), isolate())); | 10265 Handle<Object>(original_fast_elements->get(i), isolate())); |
| 10219 HInstruction* value_instruction = | 10266 HInstruction* value_instruction = |
| 10220 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10267 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
| 10221 AddInstruction(new(zone) HStoreKeyed( | 10268 AddInstruction(new(zone) HStoreKeyed( |
| 10222 object_elements, key_constant, value_instruction, kind)); | 10269 object_elements, key_constant, value_instruction, kind)); |
| 10223 BuildEmitDeepCopy(value_object, original_value_object, target, | 10270 BuildEmitDeepCopy(value_object, original_value_object, target, |
| 10224 offset, DONT_TRACK_ALLOCATION_SITE); | 10271 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); |
| 10225 } else { | 10272 } else { |
| 10226 HInstruction* value_instruction = | 10273 HInstruction* value_instruction = |
| 10227 AddInstruction(new(zone) HLoadKeyed( | 10274 AddInstruction(new(zone) HLoadKeyed( |
| 10228 boilerplate_elements, key_constant, NULL, kind, | 10275 boilerplate_elements, key_constant, NULL, kind, |
| 10229 ALLOW_RETURN_HOLE)); | 10276 ALLOW_RETURN_HOLE)); |
| 10230 AddInstruction(new(zone) HStoreKeyed( | 10277 AddInstruction(new(zone) HStoreKeyed( |
| 10231 object_elements, key_constant, value_instruction, kind)); | 10278 object_elements, key_constant, value_instruction, kind)); |
| 10232 } | 10279 } |
| 10233 } | 10280 } |
| 10234 } | 10281 } |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11584 } | 11631 } |
| 11585 } | 11632 } |
| 11586 | 11633 |
| 11587 #ifdef DEBUG | 11634 #ifdef DEBUG |
| 11588 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11635 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11589 if (allocator_ != NULL) allocator_->Verify(); | 11636 if (allocator_ != NULL) allocator_->Verify(); |
| 11590 #endif | 11637 #endif |
| 11591 } | 11638 } |
| 11592 | 11639 |
| 11593 } } // namespace v8::internal | 11640 } } // namespace v8::internal |
| OLD | NEW |