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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 AddInstruction(new(zone) HAllocate(context, total_size, | 1278 AddInstruction(new(zone) HAllocate(context, total_size, |
1279 HType::JSArray(), flags)); | 1279 HType::JSArray(), flags)); |
1280 return elements; | 1280 return elements; |
1281 } | 1281 } |
1282 | 1282 |
1283 | 1283 |
1284 void HGraphBuilder::BuildInitializeElements(HValue* elements, | 1284 void HGraphBuilder::BuildInitializeElements(HValue* elements, |
1285 ElementsKind kind, | 1285 ElementsKind kind, |
1286 HValue* capacity) { | 1286 HValue* capacity) { |
1287 Zone* zone = this->zone(); | 1287 Zone* zone = this->zone(); |
1288 BailoutId ast_id = current_block()->last_environment()->previous_ast_id(); | |
1289 Factory* factory = isolate()->factory(); | 1288 Factory* factory = isolate()->factory(); |
1290 Handle<Map> map = IsFastDoubleElementsKind(kind) | 1289 Handle<Map> map = IsFastDoubleElementsKind(kind) |
1291 ? factory->fixed_double_array_map() | 1290 ? factory->fixed_double_array_map() |
1292 : factory->fixed_array_map(); | 1291 : factory->fixed_array_map(); |
1293 BuildStoreMap(elements, map, ast_id); | 1292 BuildStoreMap(elements, map); |
1294 | 1293 |
1295 Handle<String> fixed_array_length_field_name = factory->length_field_string(); | 1294 Handle<String> fixed_array_length_field_name = factory->length_field_string(); |
1296 HInstruction* store_length = | 1295 HInstruction* store_length = |
1297 new(zone) HStoreNamedField(elements, fixed_array_length_field_name, | 1296 new(zone) HStoreNamedField(elements, fixed_array_length_field_name, |
1298 capacity, true, FixedArray::kLengthOffset); | 1297 capacity, true, FixedArray::kLengthOffset); |
1299 AddInstruction(store_length); | 1298 AddInstruction(store_length); |
1300 } | 1299 } |
1301 | 1300 |
1302 | 1301 |
1303 HValue* HGraphBuilder::BuildAllocateAndInitializeElements(HValue* context, | 1302 HValue* HGraphBuilder::BuildAllocateAndInitializeElements(HValue* context, |
1304 ElementsKind kind, | 1303 ElementsKind kind, |
1305 HValue* capacity) { | 1304 HValue* capacity) { |
1306 HValue* new_elements = | 1305 HValue* new_elements = |
1307 BuildAllocateElements(context, kind, capacity); | 1306 BuildAllocateElements(context, kind, capacity); |
1308 BuildInitializeElements(new_elements, kind, capacity); | 1307 BuildInitializeElements(new_elements, kind, capacity); |
1309 return new_elements; | 1308 return new_elements; |
1310 } | 1309 } |
1311 | 1310 |
1312 | 1311 |
1313 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, | 1312 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, |
1314 HValue* map, | 1313 HValue* map) { |
1315 BailoutId id) { | |
1316 Zone* zone = this->zone(); | 1314 Zone* zone = this->zone(); |
1317 Factory* factory = isolate()->factory(); | 1315 Factory* factory = isolate()->factory(); |
1318 Handle<String> map_field_name = factory->map_field_string(); | 1316 Handle<String> map_field_name = factory->map_field_string(); |
1319 HInstruction* store_map = | 1317 HInstruction* store_map = |
1320 new(zone) HStoreNamedField(object, map_field_name, map, | 1318 new(zone) HStoreNamedField(object, map_field_name, map, |
1321 true, JSObject::kMapOffset); | 1319 true, JSObject::kMapOffset); |
1322 store_map->SetGVNFlag(kChangesMaps); | 1320 store_map->SetGVNFlag(kChangesMaps); |
1323 AddInstruction(store_map); | 1321 AddInstruction(store_map); |
1324 return store_map; | 1322 return store_map; |
1325 } | 1323 } |
1326 | 1324 |
1327 | 1325 |
1328 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, | 1326 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, |
1329 Handle<Map> map, | 1327 Handle<Map> map) { |
1330 BailoutId id) { | |
1331 Zone* zone = this->zone(); | 1328 Zone* zone = this->zone(); |
1332 HValue* map_constant = | 1329 HValue* map_constant = |
1333 AddInstruction(new(zone) HConstant(map, Representation::Tagged())); | 1330 AddInstruction(new(zone) HConstant(map, Representation::Tagged())); |
1334 return BuildStoreMap(object, map_constant, id); | 1331 return BuildStoreMap(object, map_constant); |
1335 } | 1332 } |
1336 | 1333 |
1337 | 1334 |
1338 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context, | 1335 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context, |
1339 HValue* old_capacity) { | 1336 HValue* old_capacity) { |
1340 Zone* zone = this->zone(); | 1337 Zone* zone = this->zone(); |
1341 HValue* half_old_capacity = | 1338 HValue* half_old_capacity = |
1342 AddInstruction(HShr::New(zone, context, old_capacity, | 1339 AddInstruction(HShr::New(zone, context, old_capacity, |
1343 graph_->GetConstant1())); | 1340 graph_->GetConstant1())); |
1344 half_old_capacity->ChangeRepresentation(Representation::Integer32()); | 1341 half_old_capacity->ChangeRepresentation(Representation::Integer32()); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 BuildFillElementsWithHole(context, to_elements, to_elements_kind, | 1470 BuildFillElementsWithHole(context, to_elements, to_elements_kind, |
1474 key, capacity); | 1471 key, capacity); |
1475 } | 1472 } |
1476 } | 1473 } |
1477 | 1474 |
1478 | 1475 |
1479 HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context, | 1476 HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context, |
1480 HValue* boilerplate, | 1477 HValue* boilerplate, |
1481 AllocationSiteMode mode, | 1478 AllocationSiteMode mode, |
1482 ElementsKind kind, | 1479 ElementsKind kind, |
1483 BailoutId id, | |
1484 int length) { | 1480 int length) { |
1485 Zone* zone = this->zone(); | 1481 Zone* zone = this->zone(); |
1486 Factory* factory = isolate()->factory(); | 1482 Factory* factory = isolate()->factory(); |
1487 | 1483 |
1488 NoObservableSideEffectsScope no_effects(this); | 1484 NoObservableSideEffectsScope no_effects(this); |
1489 | 1485 |
1490 // All sizes here are multiples of kPointerSize. | 1486 // All sizes here are multiples of kPointerSize. |
1491 int size = JSArray::kSize; | 1487 int size = JSArray::kSize; |
1492 if (mode == TRACK_ALLOCATION_SITE) { | 1488 if (mode == TRACK_ALLOCATION_SITE) { |
1493 size += AllocationSiteInfo::kSize; | 1489 size += AllocationSiteInfo::kSize; |
(...skipping 25 matching lines...) Expand all Loading... |
1519 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 1515 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
1520 if ((i != JSArray::kElementsOffset) || (length == 0)) { | 1516 if ((i != JSArray::kElementsOffset) || (length == 0)) { |
1521 HInstruction* value = | 1517 HInstruction* value = |
1522 AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); | 1518 AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); |
1523 if (i != JSArray::kMapOffset) { | 1519 if (i != JSArray::kMapOffset) { |
1524 AddInstruction(new(zone) HStoreNamedField(object, | 1520 AddInstruction(new(zone) HStoreNamedField(object, |
1525 factory->empty_string(), | 1521 factory->empty_string(), |
1526 value, | 1522 value, |
1527 true, i)); | 1523 true, i)); |
1528 } else { | 1524 } else { |
1529 BuildStoreMap(object, value, id); | 1525 BuildStoreMap(object, value); |
1530 } | 1526 } |
1531 } | 1527 } |
1532 } | 1528 } |
1533 | 1529 |
1534 // Create an allocation site info if requested. | 1530 // Create an allocation site info if requested. |
1535 if (mode == TRACK_ALLOCATION_SITE) { | 1531 if (mode == TRACK_ALLOCATION_SITE) { |
1536 HValue* alloc_site = | 1532 HValue* alloc_site = |
1537 AddInstruction(new(zone) HInnerAllocatedObject(object, JSArray::kSize)); | 1533 AddInstruction(new(zone) HInnerAllocatedObject(object, JSArray::kSize)); |
1538 Handle<Map> alloc_site_map(isolate()->heap()->allocation_site_info_map()); | 1534 Handle<Map> alloc_site_map(isolate()->heap()->allocation_site_info_map()); |
1539 BuildStoreMap(alloc_site, alloc_site_map, id); | 1535 BuildStoreMap(alloc_site, alloc_site_map); |
1540 int alloc_payload_offset = AllocationSiteInfo::kPayloadOffset; | 1536 int alloc_payload_offset = AllocationSiteInfo::kPayloadOffset; |
1541 AddInstruction(new(zone) HStoreNamedField(alloc_site, | 1537 AddInstruction(new(zone) HStoreNamedField(alloc_site, |
1542 factory->empty_string(), | 1538 factory->empty_string(), |
1543 boilerplate, | 1539 boilerplate, |
1544 true, alloc_payload_offset)); | 1540 true, alloc_payload_offset)); |
1545 } | 1541 } |
1546 | 1542 |
1547 if (length > 0) { | 1543 if (length > 0) { |
1548 // Get hold of the elements array of the boilerplate and setup the | 1544 // Get hold of the elements array of the boilerplate and setup the |
1549 // elements pointer in the resulting object. | 1545 // elements pointer in the resulting object. |
(...skipping 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6188 &total_size)) { | 6184 &total_size)) { |
6189 Handle<JSObject> original_boilerplate_object = | 6185 Handle<JSObject> original_boilerplate_object = |
6190 Handle<JSObject>::cast(original_boilerplate); | 6186 Handle<JSObject>::cast(original_boilerplate); |
6191 Handle<JSObject> boilerplate_object = | 6187 Handle<JSObject> boilerplate_object = |
6192 DeepCopy(original_boilerplate_object); | 6188 DeepCopy(original_boilerplate_object); |
6193 | 6189 |
6194 literal = BuildFastLiteral(context, | 6190 literal = BuildFastLiteral(context, |
6195 boilerplate_object, | 6191 boilerplate_object, |
6196 original_boilerplate_object, | 6192 original_boilerplate_object, |
6197 total_size, | 6193 total_size, |
6198 DONT_TRACK_ALLOCATION_SITE, | 6194 DONT_TRACK_ALLOCATION_SITE); |
6199 environment()->previous_ast_id()); | |
6200 } else { | 6195 } else { |
6201 literal = AddInstruction( | 6196 literal = AddInstruction( |
6202 new(zone()) HObjectLiteral(context, | 6197 new(zone()) HObjectLiteral(context, |
6203 expr->constant_properties(), | 6198 expr->constant_properties(), |
6204 expr->fast_elements(), | 6199 expr->fast_elements(), |
6205 expr->literal_index(), | 6200 expr->literal_index(), |
6206 expr->depth(), | 6201 expr->depth(), |
6207 expr->has_function())); | 6202 expr->has_function())); |
6208 } | 6203 } |
6209 | 6204 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6326 &total_size)) { | 6321 &total_size)) { |
6327 if (mode == TRACK_ALLOCATION_SITE) { | 6322 if (mode == TRACK_ALLOCATION_SITE) { |
6328 total_size += AllocationSiteInfo::kSize; | 6323 total_size += AllocationSiteInfo::kSize; |
6329 } | 6324 } |
6330 | 6325 |
6331 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); | 6326 Handle<JSObject> boilerplate_object = DeepCopy(original_boilerplate_object); |
6332 literal = BuildFastLiteral(context, | 6327 literal = BuildFastLiteral(context, |
6333 boilerplate_object, | 6328 boilerplate_object, |
6334 original_boilerplate_object, | 6329 original_boilerplate_object, |
6335 total_size, | 6330 total_size, |
6336 mode, | 6331 mode); |
6337 environment()->previous_ast_id()); | |
6338 } else { | 6332 } else { |
6339 literal = AddInstruction( | 6333 literal = AddInstruction( |
6340 new(zone()) HArrayLiteral(context, | 6334 new(zone()) HArrayLiteral(context, |
6341 original_boilerplate_object, | 6335 original_boilerplate_object, |
6342 length, | 6336 length, |
6343 expr->literal_index(), | 6337 expr->literal_index(), |
6344 expr->depth(), | 6338 expr->depth(), |
6345 mode)); | 6339 mode)); |
6346 } | 6340 } |
6347 | 6341 |
(...skipping 3736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10084 return new(zone()) HThisFunction; | 10078 return new(zone()) HThisFunction; |
10085 } | 10079 } |
10086 } | 10080 } |
10087 | 10081 |
10088 | 10082 |
10089 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( | 10083 HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( |
10090 HValue* context, | 10084 HValue* context, |
10091 Handle<JSObject> boilerplate_object, | 10085 Handle<JSObject> boilerplate_object, |
10092 Handle<JSObject> original_boilerplate_object, | 10086 Handle<JSObject> original_boilerplate_object, |
10093 int size, | 10087 int size, |
10094 AllocationSiteMode mode, | 10088 AllocationSiteMode mode) { |
10095 BailoutId id) { | |
10096 Zone* zone = this->zone(); | 10089 Zone* zone = this->zone(); |
10097 | 10090 |
10098 NoObservableSideEffectsScope no_effects(this); | 10091 NoObservableSideEffectsScope no_effects(this); |
10099 | 10092 |
10100 HValue* size_in_bytes = | 10093 HValue* size_in_bytes = |
10101 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); | 10094 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); |
10102 HInstruction* result = | 10095 HInstruction* result = |
10103 AddInstruction(new(zone) HAllocate(context, | 10096 AddInstruction(new(zone) HAllocate(context, |
10104 size_in_bytes, | 10097 size_in_bytes, |
10105 HType::JSObject(), | 10098 HType::JSObject(), |
10106 HAllocate::CAN_ALLOCATE_IN_NEW_SPACE)); | 10099 HAllocate::CAN_ALLOCATE_IN_NEW_SPACE)); |
10107 int offset = 0; | 10100 int offset = 0; |
10108 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, result, | 10101 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, result, |
10109 &offset, mode, id); | 10102 &offset, mode); |
10110 ASSERT_EQ(size, offset); | 10103 ASSERT_EQ(size, offset); |
10111 return result; | 10104 return result; |
10112 } | 10105 } |
10113 | 10106 |
10114 | 10107 |
10115 void HOptimizedGraphBuilder::BuildEmitDeepCopy( | 10108 void HOptimizedGraphBuilder::BuildEmitDeepCopy( |
10116 Handle<JSObject> boilerplate_object, | 10109 Handle<JSObject> boilerplate_object, |
10117 Handle<JSObject> original_boilerplate_object, | 10110 Handle<JSObject> original_boilerplate_object, |
10118 HInstruction* target, | 10111 HInstruction* target, |
10119 int* offset, | 10112 int* offset, |
10120 AllocationSiteMode mode, | 10113 AllocationSiteMode mode) { |
10121 BailoutId id) { | |
10122 Zone* zone = this->zone(); | 10114 Zone* zone = this->zone(); |
10123 Factory* factory = isolate()->factory(); | 10115 Factory* factory = isolate()->factory(); |
10124 | 10116 |
10125 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( | 10117 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant( |
10126 original_boilerplate_object, Representation::Tagged())); | 10118 original_boilerplate_object, Representation::Tagged())); |
10127 | 10119 |
10128 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && | 10120 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
10129 boilerplate_object->map()->CanTrackAllocationSite(); | 10121 boilerplate_object->map()->CanTrackAllocationSite(); |
10130 | 10122 |
10131 // Only elements backing stores for non-COW arrays need to be copied. | 10123 // Only elements backing stores for non-COW arrays need to be copied. |
(...skipping 12 matching lines...) Expand all Loading... |
10144 int elements_offset = *offset + object_size; | 10136 int elements_offset = *offset + object_size; |
10145 int inobject_properties = boilerplate_object->map()->inobject_properties(); | 10137 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
10146 if (create_allocation_site_info) { | 10138 if (create_allocation_site_info) { |
10147 elements_offset += AllocationSiteInfo::kSize; | 10139 elements_offset += AllocationSiteInfo::kSize; |
10148 *offset += AllocationSiteInfo::kSize; | 10140 *offset += AllocationSiteInfo::kSize; |
10149 } | 10141 } |
10150 | 10142 |
10151 *offset += object_size + elements_size; | 10143 *offset += object_size + elements_size; |
10152 | 10144 |
10153 HValue* object_elements = BuildCopyObjectHeader(boilerplate_object, target, | 10145 HValue* object_elements = BuildCopyObjectHeader(boilerplate_object, target, |
10154 object_offset, elements_offset, elements_size, id); | 10146 object_offset, elements_offset, elements_size); |
10155 | 10147 |
10156 // Copy in-object properties. | 10148 // Copy in-object properties. |
10157 HValue* object_properties = | 10149 HValue* object_properties = |
10158 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10150 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
10159 for (int i = 0; i < inobject_properties; i++) { | 10151 for (int i = 0; i < inobject_properties; i++) { |
10160 Handle<Object> value = | 10152 Handle<Object> value = |
10161 Handle<Object>(boilerplate_object->InObjectPropertyAt(i), | 10153 Handle<Object>(boilerplate_object->InObjectPropertyAt(i), |
10162 isolate()); | 10154 isolate()); |
10163 if (value->IsJSObject()) { | 10155 if (value->IsJSObject()) { |
10164 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10156 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10165 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10157 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
10166 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(i), | 10158 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(i), |
10167 isolate())); | 10159 isolate())); |
10168 HInstruction* value_instruction = | 10160 HInstruction* value_instruction = |
10169 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10161 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
10170 AddInstruction(new(zone) HStoreNamedField( | 10162 AddInstruction(new(zone) HStoreNamedField( |
10171 object_properties, factory->unknown_field_string(), value_instruction, | 10163 object_properties, factory->unknown_field_string(), value_instruction, |
10172 true, boilerplate_object->GetInObjectPropertyOffset(i))); | 10164 true, boilerplate_object->GetInObjectPropertyOffset(i))); |
10173 BuildEmitDeepCopy(value_object, original_value_object, target, | 10165 BuildEmitDeepCopy(value_object, original_value_object, target, |
10174 offset, DONT_TRACK_ALLOCATION_SITE, id); | 10166 offset, DONT_TRACK_ALLOCATION_SITE); |
10175 } else { | 10167 } else { |
10176 HInstruction* value_instruction = AddInstruction(new(zone) HConstant( | 10168 HInstruction* value_instruction = AddInstruction(new(zone) HConstant( |
10177 value, Representation::Tagged())); | 10169 value, Representation::Tagged())); |
10178 AddInstruction(new(zone) HStoreNamedField( | 10170 AddInstruction(new(zone) HStoreNamedField( |
10179 object_properties, factory->unknown_field_string(), value_instruction, | 10171 object_properties, factory->unknown_field_string(), value_instruction, |
10180 true, boilerplate_object->GetInObjectPropertyOffset(i))); | 10172 true, boilerplate_object->GetInObjectPropertyOffset(i))); |
10181 } | 10173 } |
10182 } | 10174 } |
10183 | 10175 |
10184 // Build Allocation Site Info if desired | 10176 // Build Allocation Site Info if desired |
10185 if (create_allocation_site_info) { | 10177 if (create_allocation_site_info) { |
10186 HValue* alloc_site = | 10178 HValue* alloc_site = |
10187 AddInstruction(new(zone) HInnerAllocatedObject(target, JSArray::kSize)); | 10179 AddInstruction(new(zone) HInnerAllocatedObject(target, JSArray::kSize)); |
10188 Handle<Map> alloc_site_map(isolate()->heap()->allocation_site_info_map()); | 10180 Handle<Map> alloc_site_map(isolate()->heap()->allocation_site_info_map()); |
10189 BuildStoreMap(alloc_site, alloc_site_map, id); | 10181 BuildStoreMap(alloc_site, alloc_site_map); |
10190 int alloc_payload_offset = AllocationSiteInfo::kPayloadOffset; | 10182 int alloc_payload_offset = AllocationSiteInfo::kPayloadOffset; |
10191 AddInstruction(new(zone) HStoreNamedField(alloc_site, | 10183 AddInstruction(new(zone) HStoreNamedField(alloc_site, |
10192 factory->payload_string(), | 10184 factory->payload_string(), |
10193 original_boilerplate, | 10185 original_boilerplate, |
10194 true, alloc_payload_offset)); | 10186 true, alloc_payload_offset)); |
10195 } | 10187 } |
10196 | 10188 |
10197 if (object_elements != NULL) { | 10189 if (object_elements != NULL) { |
10198 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant( | 10190 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant( |
10199 elements, Representation::Tagged())); | 10191 elements, Representation::Tagged())); |
(...skipping 26 matching lines...) Expand all Loading... |
10226 AddInstruction(new(zone) HConstant(i, Representation::Integer32())); | 10218 AddInstruction(new(zone) HConstant(i, Representation::Integer32())); |
10227 if (value->IsJSObject()) { | 10219 if (value->IsJSObject()) { |
10228 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10220 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10229 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10221 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
10230 Handle<Object>(original_fast_elements->get(i), isolate())); | 10222 Handle<Object>(original_fast_elements->get(i), isolate())); |
10231 HInstruction* value_instruction = | 10223 HInstruction* value_instruction = |
10232 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); | 10224 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); |
10233 AddInstruction(new(zone) HStoreKeyed( | 10225 AddInstruction(new(zone) HStoreKeyed( |
10234 object_elements, key_constant, value_instruction, kind)); | 10226 object_elements, key_constant, value_instruction, kind)); |
10235 BuildEmitDeepCopy(value_object, original_value_object, target, | 10227 BuildEmitDeepCopy(value_object, original_value_object, target, |
10236 offset, DONT_TRACK_ALLOCATION_SITE, id); | 10228 offset, DONT_TRACK_ALLOCATION_SITE); |
10237 } else { | 10229 } else { |
10238 HInstruction* value_instruction = | 10230 HInstruction* value_instruction = |
10239 AddInstruction(new(zone) HLoadKeyed( | 10231 AddInstruction(new(zone) HLoadKeyed( |
10240 boilerplate_elements, key_constant, NULL, kind)); | 10232 boilerplate_elements, key_constant, NULL, kind)); |
10241 AddInstruction(new(zone) HStoreKeyed( | 10233 AddInstruction(new(zone) HStoreKeyed( |
10242 object_elements, key_constant, value_instruction, kind)); | 10234 object_elements, key_constant, value_instruction, kind)); |
10243 } | 10235 } |
10244 } | 10236 } |
10245 } else { | 10237 } else { |
10246 UNREACHABLE(); | 10238 UNREACHABLE(); |
10247 } | 10239 } |
10248 } | 10240 } |
10249 } | 10241 } |
10250 | 10242 |
10251 | 10243 |
10252 HValue* HOptimizedGraphBuilder::BuildCopyObjectHeader( | 10244 HValue* HOptimizedGraphBuilder::BuildCopyObjectHeader( |
10253 Handle<JSObject> boilerplate_object, | 10245 Handle<JSObject> boilerplate_object, |
10254 HInstruction* target, | 10246 HInstruction* target, |
10255 int object_offset, | 10247 int object_offset, |
10256 int elements_offset, | 10248 int elements_offset, |
10257 int elements_size, | 10249 int elements_size) { |
10258 BailoutId id) { | |
10259 ASSERT(boilerplate_object->properties()->length() == 0); | 10250 ASSERT(boilerplate_object->properties()->length() == 0); |
10260 Zone* zone = this->zone(); | 10251 Zone* zone = this->zone(); |
10261 Factory* factory = isolate()->factory(); | 10252 Factory* factory = isolate()->factory(); |
10262 HValue* result = NULL; | 10253 HValue* result = NULL; |
10263 | 10254 |
10264 HValue* object_header = | 10255 HValue* object_header = |
10265 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10256 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
10266 Handle<Map> boilerplate_object_map(boilerplate_object->map()); | 10257 Handle<Map> boilerplate_object_map(boilerplate_object->map()); |
10267 BuildStoreMap(object_header, boilerplate_object_map, id); | 10258 BuildStoreMap(object_header, boilerplate_object_map); |
10268 | 10259 |
10269 HInstruction* elements; | 10260 HInstruction* elements; |
10270 if (elements_size == 0) { | 10261 if (elements_size == 0) { |
10271 Handle<Object> elements_field = | 10262 Handle<Object> elements_field = |
10272 Handle<Object>(boilerplate_object->elements(), isolate()); | 10263 Handle<Object>(boilerplate_object->elements(), isolate()); |
10273 elements = AddInstruction(new(zone) HConstant( | 10264 elements = AddInstruction(new(zone) HConstant( |
10274 elements_field, Representation::Tagged())); | 10265 elements_field, Representation::Tagged())); |
10275 } else { | 10266 } else { |
10276 elements = AddInstruction(new(zone) HInnerAllocatedObject( | 10267 elements = AddInstruction(new(zone) HInnerAllocatedObject( |
10277 target, elements_offset)); | 10268 target, elements_offset)); |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11655 } | 11646 } |
11656 } | 11647 } |
11657 | 11648 |
11658 #ifdef DEBUG | 11649 #ifdef DEBUG |
11659 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11650 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11660 if (allocator_ != NULL) allocator_->Verify(); | 11651 if (allocator_ != NULL) allocator_->Verify(); |
11661 #endif | 11652 #endif |
11662 } | 11653 } |
11663 | 11654 |
11664 } } // namespace v8::internal | 11655 } } // namespace v8::internal |
OLD | NEW |