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()->heap()->free_space_map()); | |
Michael Starzinger
2013/06/24 15:04:47
Better use isolate()->factory()->free_space_map()
Hannes Payer (out of office)
2013/06/24 16:44:22
Done.
| |
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 | 10007 // Increase the offset so that subsequent objects end up right after |
9988 // this object and its backing store. | 10008 // this object and its backing store. |
Michael Starzinger
2013/06/24 15:04:47
nit: The above comment is out-dated, let's adapt i
Hannes Payer (out of office)
2013/06/24 16:44:22
Done.
| |
9989 int object_offset = *offset; | 10009 int object_offset = *offset; |
9990 int object_size = boilerplate_object->map()->instance_size(); | 10010 int object_size = boilerplate_object->map()->instance_size(); |
9991 int elements_size = (elements->length() > 0 && | 10011 int elements_size = (elements->length() > 0 && |
9992 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? | 10012 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? |
9993 elements->Size() : 0; | 10013 elements->Size() : 0; |
9994 int elements_offset = *offset + object_size; | |
9995 | 10014 |
9996 *offset += object_size + elements_size; | 10015 int elements_offset = 0; |
9997 | 10016 |
10017 if (data_target != NULL && boilerplate_object->HasFastDoubleElements()) { | |
10018 elements_offset = *data_offset; | |
10019 *data_offset += elements_size; | |
10020 } else { | |
10021 elements_offset = *offset + object_size; | |
10022 *offset += elements_size; | |
10023 } | |
10024 *offset += object_size; | |
Michael Starzinger
2013/06/24 15:04:47
nit: Let's add an empty new-line after this block
Hannes Payer (out of office)
2013/06/24 16:44:22
Done.
| |
9998 // Copy object elements if non-COW. | 10025 // Copy object elements if non-COW. |
9999 HValue* object_elements = BuildEmitObjectHeader(boilerplate_object, target, | 10026 HValue* object_elements = BuildEmitObjectHeader(boilerplate_object, target, |
10000 object_offset, elements_offset, elements_size); | 10027 data_target, object_offset, elements_offset, elements_size); |
10001 if (object_elements != NULL) { | 10028 if (object_elements != NULL) { |
10002 BuildEmitElements(elements, original_elements, kind, object_elements, | 10029 BuildEmitElements(elements, original_elements, kind, object_elements, |
10003 target, offset); | 10030 target, offset, data_target, data_offset); |
10004 } | 10031 } |
10005 | 10032 |
10006 // Copy in-object properties. | 10033 // Copy in-object properties. |
10007 HValue* object_properties = | 10034 HValue* object_properties = |
10008 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10035 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
10009 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, | 10036 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object, |
10010 object_properties, target, offset); | 10037 object_properties, target, offset, data_target, data_offset); |
10011 | 10038 |
10012 // Create allocation site info. | 10039 // Create allocation site info. |
10013 if (mode == TRACK_ALLOCATION_SITE && | 10040 if (mode == TRACK_ALLOCATION_SITE && |
10014 boilerplate_object->map()->CanTrackAllocationSite()) { | 10041 boilerplate_object->map()->CanTrackAllocationSite()) { |
10015 elements_offset += AllocationSiteInfo::kSize; | 10042 elements_offset += AllocationSiteInfo::kSize; |
10016 *offset += AllocationSiteInfo::kSize; | 10043 *offset += AllocationSiteInfo::kSize; |
10017 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( | 10044 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( |
10018 original_boilerplate_object)); | 10045 original_boilerplate_object)); |
10019 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); | 10046 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); |
10020 } | 10047 } |
10021 } | 10048 } |
10022 | 10049 |
10023 | 10050 |
10024 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( | 10051 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader( |
10025 Handle<JSObject> boilerplate_object, | 10052 Handle<JSObject> boilerplate_object, |
10026 HInstruction* target, | 10053 HInstruction* target, |
10054 HInstruction* data_target, | |
10027 int object_offset, | 10055 int object_offset, |
10028 int elements_offset, | 10056 int elements_offset, |
10029 int elements_size) { | 10057 int elements_size) { |
10030 ASSERT(boilerplate_object->properties()->length() == 0); | 10058 ASSERT(boilerplate_object->properties()->length() == 0); |
10031 Zone* zone = this->zone(); | 10059 Zone* zone = this->zone(); |
10032 HValue* result = NULL; | 10060 HValue* result = NULL; |
10033 | 10061 |
10034 HValue* object_header = | 10062 HValue* object_header = |
10035 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10063 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
10036 Handle<Map> boilerplate_object_map(boilerplate_object->map()); | 10064 Handle<Map> boilerplate_object_map(boilerplate_object->map()); |
10037 AddStoreMapConstant(object_header, boilerplate_object_map); | 10065 AddStoreMapConstant(object_header, boilerplate_object_map); |
10038 | 10066 |
10039 HInstruction* elements; | 10067 HInstruction* elements; |
10040 if (elements_size == 0) { | 10068 if (elements_size == 0) { |
10041 Handle<Object> elements_field = | 10069 Handle<Object> elements_field = |
10042 Handle<Object>(boilerplate_object->elements(), isolate()); | 10070 Handle<Object>(boilerplate_object->elements(), isolate()); |
10043 elements = AddInstruction(new(zone) HConstant(elements_field)); | 10071 elements = AddInstruction(new(zone) HConstant(elements_field)); |
10044 } else { | 10072 } else { |
10045 elements = AddInstruction(new(zone) HInnerAllocatedObject( | 10073 if (data_target != NULL && boilerplate_object->HasFastDoubleElements()) { |
10046 target, elements_offset)); | 10074 elements = AddInstruction(new(zone) HInnerAllocatedObject( |
10075 data_target, elements_offset)); | |
10076 } else { | |
10077 elements = AddInstruction(new(zone) HInnerAllocatedObject( | |
10078 target, elements_offset)); | |
10079 } | |
10047 result = elements; | 10080 result = elements; |
10048 } | 10081 } |
10049 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements); | 10082 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements); |
10050 | 10083 |
10051 Handle<Object> properties_field = | 10084 Handle<Object> properties_field = |
10052 Handle<Object>(boilerplate_object->properties(), isolate()); | 10085 Handle<Object>(boilerplate_object->properties(), isolate()); |
10053 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array()); | 10086 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array()); |
10054 HInstruction* properties = AddInstruction(new(zone) HConstant( | 10087 HInstruction* properties = AddInstruction(new(zone) HConstant( |
10055 properties_field)); | 10088 properties_field)); |
10056 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); | 10089 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); |
(...skipping 16 matching lines...) Expand all Loading... | |
10073 | 10106 |
10074 return result; | 10107 return result; |
10075 } | 10108 } |
10076 | 10109 |
10077 | 10110 |
10078 void HOptimizedGraphBuilder::BuildEmitInObjectProperties( | 10111 void HOptimizedGraphBuilder::BuildEmitInObjectProperties( |
10079 Handle<JSObject> boilerplate_object, | 10112 Handle<JSObject> boilerplate_object, |
10080 Handle<JSObject> original_boilerplate_object, | 10113 Handle<JSObject> original_boilerplate_object, |
10081 HValue* object_properties, | 10114 HValue* object_properties, |
10082 HInstruction* target, | 10115 HInstruction* target, |
10083 int* offset) { | 10116 int* offset, |
10117 HInstruction* data_target, | |
10118 int* data_offset) { | |
10084 Zone* zone = this->zone(); | 10119 Zone* zone = this->zone(); |
10085 Handle<DescriptorArray> descriptors( | 10120 Handle<DescriptorArray> descriptors( |
10086 boilerplate_object->map()->instance_descriptors()); | 10121 boilerplate_object->map()->instance_descriptors()); |
10087 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); | 10122 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); |
10088 | 10123 |
10089 int copied_fields = 0; | 10124 int copied_fields = 0; |
10090 for (int i = 0; i < limit; i++) { | 10125 for (int i = 0; i < limit; i++) { |
10091 PropertyDetails details = descriptors->GetDetails(i); | 10126 PropertyDetails details = descriptors->GetDetails(i); |
10092 if (details.type() != FIELD) continue; | 10127 if (details.type() != FIELD) continue; |
10093 copied_fields++; | 10128 copied_fields++; |
(...skipping 13 matching lines...) Expand all Loading... | |
10107 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10142 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10108 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10143 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
10109 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), | 10144 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), |
10110 isolate())); | 10145 isolate())); |
10111 HInstruction* value_instruction = | 10146 HInstruction* value_instruction = |
10112 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10147 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
10113 | 10148 |
10114 AddStore(object_properties, access, value_instruction); | 10149 AddStore(object_properties, access, value_instruction); |
10115 | 10150 |
10116 BuildEmitDeepCopy(value_object, original_value_object, target, | 10151 BuildEmitDeepCopy(value_object, original_value_object, target, |
10117 offset, DONT_TRACK_ALLOCATION_SITE); | 10152 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); |
10118 } else { | 10153 } else { |
10119 Representation representation = details.representation(); | 10154 Representation representation = details.representation(); |
10120 HInstruction* value_instruction = | 10155 HInstruction* value_instruction = |
10121 AddInstruction(new(zone) HConstant(value)); | 10156 AddInstruction(new(zone) HConstant(value)); |
10122 | 10157 |
10123 if (representation.IsDouble()) { | 10158 if (representation.IsDouble()) { |
10124 // Allocate a HeapNumber box and store the value into it. | 10159 // Allocate a HeapNumber box and store the value into it. |
10125 HInstruction* double_box = | 10160 HInstruction* double_box; |
10126 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10161 if (data_target != NULL) { |
10162 double_box = AddInstruction(new(zone) HInnerAllocatedObject( | |
10163 data_target, *data_offset)); | |
10164 *data_offset += HeapNumber::kSize; | |
10165 } else { | |
10166 double_box = AddInstruction(new(zone) HInnerAllocatedObject( | |
10167 target, *offset)); | |
10168 *offset += HeapNumber::kSize; | |
10169 } | |
10127 AddStoreMapConstant(double_box, | 10170 AddStoreMapConstant(double_box, |
10128 isolate()->factory()->heap_number_map()); | 10171 isolate()->factory()->heap_number_map()); |
10129 AddStore(double_box, HObjectAccess::ForHeapNumberValue(), | 10172 AddStore(double_box, HObjectAccess::ForHeapNumberValue(), |
10130 value_instruction, Representation::Double()); | 10173 value_instruction, Representation::Double()); |
10131 value_instruction = double_box; | 10174 value_instruction = double_box; |
10132 *offset += HeapNumber::kSize; | |
10133 } | 10175 } |
10134 | 10176 |
10135 AddStore(object_properties, access, value_instruction); | 10177 AddStore(object_properties, access, value_instruction); |
10136 } | 10178 } |
10137 } | 10179 } |
10138 | 10180 |
10139 int inobject_properties = boilerplate_object->map()->inobject_properties(); | 10181 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
10140 HInstruction* value_instruction = AddInstruction(new(zone) | 10182 HInstruction* value_instruction = AddInstruction(new(zone) |
10141 HConstant(isolate()->factory()->one_pointer_filler_map())); | 10183 HConstant(isolate()->factory()->one_pointer_filler_map())); |
10142 for (int i = copied_fields; i < inobject_properties; i++) { | 10184 for (int i = copied_fields; i < inobject_properties; i++) { |
10143 ASSERT(boilerplate_object->IsJSObject()); | 10185 ASSERT(boilerplate_object->IsJSObject()); |
10144 int property_offset = boilerplate_object->GetInObjectPropertyOffset(i); | 10186 int property_offset = boilerplate_object->GetInObjectPropertyOffset(i); |
10145 HObjectAccess access = HObjectAccess::ForJSObjectOffset(property_offset); | 10187 HObjectAccess access = HObjectAccess::ForJSObjectOffset(property_offset); |
10146 AddStore(object_properties, access, value_instruction); | 10188 AddStore(object_properties, access, value_instruction); |
10147 } | 10189 } |
10148 } | 10190 } |
10149 | 10191 |
10150 | 10192 |
10151 void HOptimizedGraphBuilder::BuildEmitElements( | 10193 void HOptimizedGraphBuilder::BuildEmitElements( |
10152 Handle<FixedArrayBase> elements, | 10194 Handle<FixedArrayBase> elements, |
10153 Handle<FixedArrayBase> original_elements, | 10195 Handle<FixedArrayBase> original_elements, |
10154 ElementsKind kind, | 10196 ElementsKind kind, |
10155 HValue* object_elements, | 10197 HValue* object_elements, |
10156 HInstruction* target, | 10198 HInstruction* target, |
10157 int* offset) { | 10199 int* offset, |
10200 HInstruction* data_target, | |
10201 int* data_offset) { | |
10158 Zone* zone = this->zone(); | 10202 Zone* zone = this->zone(); |
10159 | 10203 |
10160 int elements_length = elements->length(); | 10204 int elements_length = elements->length(); |
10161 HValue* object_elements_length = | 10205 HValue* object_elements_length = |
10162 AddInstruction(new(zone) HConstant(elements_length)); | 10206 AddInstruction(new(zone) HConstant(elements_length)); |
10163 | 10207 |
10164 BuildInitializeElementsHeader(object_elements, kind, object_elements_length); | 10208 BuildInitializeElementsHeader(object_elements, kind, object_elements_length); |
10165 | 10209 |
10166 // Copy elements backing store content. | 10210 // Copy elements backing store content. |
10167 if (elements->IsFixedDoubleArray()) { | 10211 if (elements->IsFixedDoubleArray()) { |
10168 BuildEmitFixedDoubleArray(elements, kind, object_elements); | 10212 BuildEmitFixedDoubleArray(elements, kind, object_elements); |
10169 } else if (elements->IsFixedArray()) { | 10213 } else if (elements->IsFixedArray()) { |
10170 BuildEmitFixedArray(elements, original_elements, kind, object_elements, | 10214 BuildEmitFixedArray(elements, original_elements, kind, object_elements, |
10171 target, offset); | 10215 target, offset, data_target, data_offset); |
10172 } else { | 10216 } else { |
10173 UNREACHABLE(); | 10217 UNREACHABLE(); |
10174 } | 10218 } |
10175 } | 10219 } |
10176 | 10220 |
10177 | 10221 |
10178 void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( | 10222 void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( |
10179 Handle<FixedArrayBase> elements, | 10223 Handle<FixedArrayBase> elements, |
10180 ElementsKind kind, | 10224 ElementsKind kind, |
10181 HValue* object_elements) { | 10225 HValue* object_elements) { |
(...skipping 12 matching lines...) Expand all Loading... | |
10194 } | 10238 } |
10195 } | 10239 } |
10196 | 10240 |
10197 | 10241 |
10198 void HOptimizedGraphBuilder::BuildEmitFixedArray( | 10242 void HOptimizedGraphBuilder::BuildEmitFixedArray( |
10199 Handle<FixedArrayBase> elements, | 10243 Handle<FixedArrayBase> elements, |
10200 Handle<FixedArrayBase> original_elements, | 10244 Handle<FixedArrayBase> original_elements, |
10201 ElementsKind kind, | 10245 ElementsKind kind, |
10202 HValue* object_elements, | 10246 HValue* object_elements, |
10203 HInstruction* target, | 10247 HInstruction* target, |
10204 int* offset) { | 10248 int* offset, |
10249 HInstruction* data_target, | |
10250 int* data_offset) { | |
10205 Zone* zone = this->zone(); | 10251 Zone* zone = this->zone(); |
10206 HInstruction* boilerplate_elements = | 10252 HInstruction* boilerplate_elements = |
10207 AddInstruction(new(zone) HConstant(elements)); | 10253 AddInstruction(new(zone) HConstant(elements)); |
10208 int elements_length = elements->length(); | 10254 int elements_length = elements->length(); |
10209 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); | 10255 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); |
10210 Handle<FixedArray> original_fast_elements = | 10256 Handle<FixedArray> original_fast_elements = |
10211 Handle<FixedArray>::cast(original_elements); | 10257 Handle<FixedArray>::cast(original_elements); |
10212 for (int i = 0; i < elements_length; i++) { | 10258 for (int i = 0; i < elements_length; i++) { |
10213 Handle<Object> value(fast_elements->get(i), isolate()); | 10259 Handle<Object> value(fast_elements->get(i), isolate()); |
10214 HValue* key_constant = AddInstruction(new(zone) HConstant(i)); | 10260 HValue* key_constant = AddInstruction(new(zone) HConstant(i)); |
10215 if (value->IsJSObject()) { | 10261 if (value->IsJSObject()) { |
10216 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10262 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10217 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10263 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
10218 Handle<Object>(original_fast_elements->get(i), isolate())); | 10264 Handle<Object>(original_fast_elements->get(i), isolate())); |
10219 HInstruction* value_instruction = | 10265 HInstruction* value_instruction = |
10220 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10266 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
10221 AddInstruction(new(zone) HStoreKeyed( | 10267 AddInstruction(new(zone) HStoreKeyed( |
10222 object_elements, key_constant, value_instruction, kind)); | 10268 object_elements, key_constant, value_instruction, kind)); |
10223 BuildEmitDeepCopy(value_object, original_value_object, target, | 10269 BuildEmitDeepCopy(value_object, original_value_object, target, |
10224 offset, DONT_TRACK_ALLOCATION_SITE); | 10270 offset, data_target, data_offset, DONT_TRACK_ALLOCATION_SITE); |
10225 } else { | 10271 } else { |
10226 HInstruction* value_instruction = | 10272 HInstruction* value_instruction = |
10227 AddInstruction(new(zone) HLoadKeyed( | 10273 AddInstruction(new(zone) HLoadKeyed( |
10228 boilerplate_elements, key_constant, NULL, kind, | 10274 boilerplate_elements, key_constant, NULL, kind, |
10229 ALLOW_RETURN_HOLE)); | 10275 ALLOW_RETURN_HOLE)); |
10230 AddInstruction(new(zone) HStoreKeyed( | 10276 AddInstruction(new(zone) HStoreKeyed( |
10231 object_elements, key_constant, value_instruction, kind)); | 10277 object_elements, key_constant, value_instruction, kind)); |
10232 } | 10278 } |
10233 } | 10279 } |
10234 } | 10280 } |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11584 } | 11630 } |
11585 } | 11631 } |
11586 | 11632 |
11587 #ifdef DEBUG | 11633 #ifdef DEBUG |
11588 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11634 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11589 if (allocator_ != NULL) allocator_->Verify(); | 11635 if (allocator_ != NULL) allocator_->Verify(); |
11590 #endif | 11636 #endif |
11591 } | 11637 } |
11592 | 11638 |
11593 } } // namespace v8::internal | 11639 } } // namespace v8::internal |
OLD | NEW |