Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: src/hydrogen.cc

Issue 15700007: Refacturing BuildEmitDeepCopy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 HValue* elements = 1363 HValue* elements =
1364 AddInstruction(new(zone) HAllocate(context, total_size, 1364 AddInstruction(new(zone) HAllocate(context, total_size,
1365 HType::JSArray(), flags)); 1365 HType::JSArray(), flags));
1366 return elements; 1366 return elements;
1367 } 1367 }
1368 1368
1369 1369
1370 void HGraphBuilder::BuildInitializeElements(HValue* elements, 1370 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements,
1371 ElementsKind kind, 1371 ElementsKind kind,
1372 HValue* capacity) { 1372 HValue* capacity) {
1373 Factory* factory = isolate()->factory(); 1373 Factory* factory = isolate()->factory();
1374 Handle<Map> map = IsFastDoubleElementsKind(kind) 1374 Handle<Map> map = IsFastDoubleElementsKind(kind)
1375 ? factory->fixed_double_array_map() 1375 ? factory->fixed_double_array_map()
1376 : factory->fixed_array_map(); 1376 : factory->fixed_array_map();
1377 1377
1378 AddStoreMapConstant(elements, map); 1378 AddStoreMapConstant(elements, map);
1379 Representation representation = IsFastElementsKind(kind) 1379 Representation representation = IsFastElementsKind(kind)
1380 ? Representation::Smi() : Representation::Tagged(); 1380 ? Representation::Smi() : Representation::Tagged();
1381 AddStore(elements, HObjectAccess::ForFixedArrayLength(), capacity, 1381 AddStore(elements, HObjectAccess::ForFixedArrayLength(), capacity,
1382 representation); 1382 representation);
1383 } 1383 }
1384 1384
1385 1385
1386 HValue* HGraphBuilder::BuildAllocateAndInitializeElements(HValue* context, 1386 HValue* HGraphBuilder::BuildAllocateElementsAndInitializeElementsHeader(
1387 ElementsKind kind, 1387 HValue* context,
1388 HValue* capacity) { 1388 ElementsKind kind,
1389 HValue* capacity) {
1389 HValue* new_elements = BuildAllocateElements(context, kind, capacity); 1390 HValue* new_elements = BuildAllocateElements(context, kind, capacity);
1390 BuildInitializeElements(new_elements, kind, capacity); 1391 BuildInitializeElementsHeader(new_elements, kind, capacity);
1391 return new_elements; 1392 return new_elements;
1392 } 1393 }
1393 1394
1394 1395
1395 HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array, 1396 HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array,
1396 HValue* array_map, 1397 HValue* array_map,
1397 AllocationSiteMode mode, 1398 AllocationSiteMode mode,
1398 HValue* allocation_site_payload, 1399 HValue* allocation_site_payload,
1399 HValue* length_field) { 1400 HValue* length_field) {
1400 1401
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1482
1482 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object, 1483 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
1483 HValue* elements, 1484 HValue* elements,
1484 ElementsKind kind, 1485 ElementsKind kind,
1485 HValue* length, 1486 HValue* length,
1486 HValue* new_capacity) { 1487 HValue* new_capacity) {
1487 HValue* context = environment()->LookupContext(); 1488 HValue* context = environment()->LookupContext();
1488 1489
1489 BuildNewSpaceArrayCheck(new_capacity, kind); 1490 BuildNewSpaceArrayCheck(new_capacity, kind);
1490 1491
1491 HValue* new_elements = 1492 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
1492 BuildAllocateAndInitializeElements(context, kind, new_capacity); 1493 context, kind, new_capacity);
1493 1494
1494 BuildCopyElements(context, elements, kind, 1495 BuildCopyElements(context, elements, kind,
1495 new_elements, kind, 1496 new_elements, kind,
1496 length, new_capacity); 1497 length, new_capacity);
1497 1498
1498 AddStore(object, HObjectAccess::ForElementsPointer(), new_elements); 1499 AddStore(object, HObjectAccess::ForElementsPointer(), new_elements);
1499 1500
1500 return new_elements; 1501 return new_elements;
1501 } 1502 }
1502 1503
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 1886
1886 // Fill in the fields: map, properties, length 1887 // Fill in the fields: map, properties, length
1887 HValue* map = EmitMapCode(context); 1888 HValue* map = EmitMapCode(context);
1888 elements_location_ = builder()->BuildJSArrayHeader(new_object, 1889 elements_location_ = builder()->BuildJSArrayHeader(new_object,
1889 map, 1890 map,
1890 mode_, 1891 mode_,
1891 allocation_site_payload_, 1892 allocation_site_payload_,
1892 length_field); 1893 length_field);
1893 1894
1894 // Initialize the elements 1895 // Initialize the elements
1895 builder()->BuildInitializeElements(elements_location_, kind_, capacity); 1896 builder()->BuildInitializeElementsHeader(elements_location_, kind_, capacity);
1896 1897
1897 if (fill_with_hole) { 1898 if (fill_with_hole) {
1898 builder()->BuildFillElementsWithHole(context, elements_location_, kind_, 1899 builder()->BuildFillElementsWithHole(context, elements_location_, kind_,
1899 graph()->GetConstant0(), capacity); 1900 graph()->GetConstant0(), capacity);
1900 } 1901 }
1901 1902
1902 return new_object; 1903 return new_object;
1903 } 1904 }
1904 1905
1905 1906
(...skipping 7997 matching lines...) Expand 10 before | Expand all | Expand 10 after
9903 9904
9904 9905
9905 void HOptimizedGraphBuilder::BuildEmitDeepCopy( 9906 void HOptimizedGraphBuilder::BuildEmitDeepCopy(
9906 Handle<JSObject> boilerplate_object, 9907 Handle<JSObject> boilerplate_object,
9907 Handle<JSObject> original_boilerplate_object, 9908 Handle<JSObject> original_boilerplate_object,
9908 HInstruction* target, 9909 HInstruction* target,
9909 int* offset, 9910 int* offset,
9910 AllocationSiteMode mode) { 9911 AllocationSiteMode mode) {
9911 Zone* zone = this->zone(); 9912 Zone* zone = this->zone();
9912 9913
9913 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant(
9914 original_boilerplate_object, Representation::Tagged()));
9915
9916 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE &&
9917 boilerplate_object->map()->CanTrackAllocationSite();
9918
9919 // Only elements backing stores for non-COW arrays need to be copied.
9920 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 9914 Handle<FixedArrayBase> elements(boilerplate_object->elements());
9921 Handle<FixedArrayBase> original_elements( 9915 Handle<FixedArrayBase> original_elements(
9922 original_boilerplate_object->elements()); 9916 original_boilerplate_object->elements());
9923 ElementsKind kind = boilerplate_object->map()->elements_kind(); 9917 ElementsKind kind = boilerplate_object->map()->elements_kind();
9924 9918
9925 // Increase the offset so that subsequent objects end up right after 9919 // Increase the offset so that subsequent objects end up right after
9926 // this object and its backing store. 9920 // this object and its backing store.
9927 int object_offset = *offset; 9921 int object_offset = *offset;
9928 int object_size = boilerplate_object->map()->instance_size(); 9922 int object_size = boilerplate_object->map()->instance_size();
9929 int elements_size = (elements->length() > 0 && 9923 int elements_size = (elements->length() > 0 &&
9930 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? 9924 elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
9931 elements->Size() : 0; 9925 elements->Size() : 0;
9932 int elements_offset = *offset + object_size; 9926 int elements_offset = *offset + object_size;
9933 if (create_allocation_site_info) {
9934 elements_offset += AllocationSiteInfo::kSize;
9935 *offset += AllocationSiteInfo::kSize;
9936 }
9937 9927
9938 *offset += object_size + elements_size; 9928 *offset += object_size + elements_size;
9939 9929
9940 HValue* object_elements = BuildCopyObjectHeader(boilerplate_object, target, 9930 // Copy object elements if non-COW.
9931 HValue* object_elements = BuildEmitObjectHeader(boilerplate_object, target,
9941 object_offset, elements_offset, elements_size); 9932 object_offset, elements_offset, elements_size);
9933 if (object_elements != NULL) {
9934 BuildEmitElements(elements, original_elements, kind, object_elements,
9935 target, offset);
9936 }
9942 9937
9943 // Copy in-object properties. 9938 // Copy in-object properties.
9944 HValue* object_properties = 9939 HValue* object_properties =
9945 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); 9940 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset));
9941 BuildEmitInObjectProperties(boilerplate_object, original_boilerplate_object,
9942 object_properties, target, offset);
9946 9943
9944 // Create allocation site info.
9945 if (mode == TRACK_ALLOCATION_SITE &&
9946 boilerplate_object->map()->CanTrackAllocationSite()) {
9947 elements_offset += AllocationSiteInfo::kSize;
9948 *offset += AllocationSiteInfo::kSize;
9949 HInstruction* original_boilerplate = AddInstruction(new(zone) HConstant(
9950 original_boilerplate_object, Representation::Tagged()));
9951 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate);
9952 }
9953 }
9954
9955
9956 HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader(
9957 Handle<JSObject> boilerplate_object,
9958 HInstruction* target,
9959 int object_offset,
9960 int elements_offset,
9961 int elements_size) {
9962 ASSERT(boilerplate_object->properties()->length() == 0);
9963 Zone* zone = this->zone();
9964 HValue* result = NULL;
9965
9966 HValue* object_header =
9967 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset));
9968 Handle<Map> boilerplate_object_map(boilerplate_object->map());
9969 AddStoreMapConstant(object_header, boilerplate_object_map);
9970
9971 HInstruction* elements;
9972 if (elements_size == 0) {
9973 Handle<Object> elements_field =
9974 Handle<Object>(boilerplate_object->elements(), isolate());
9975 elements = AddInstruction(new(zone) HConstant(
9976 elements_field, Representation::Tagged()));
9977 } else {
9978 elements = AddInstruction(new(zone) HInnerAllocatedObject(
9979 target, elements_offset));
9980 result = elements;
9981 }
9982 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements);
9983
9984 Handle<Object> properties_field =
9985 Handle<Object>(boilerplate_object->properties(), isolate());
9986 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array());
9987 HInstruction* properties = AddInstruction(new(zone) HConstant(
9988 properties_field, Representation::None()));
9989 HObjectAccess access = HObjectAccess::ForPropertiesPointer();
9990 AddStore(object_header, access, properties);
9991
9992 if (boilerplate_object->IsJSArray()) {
9993 Handle<JSArray> boilerplate_array =
9994 Handle<JSArray>::cast(boilerplate_object);
9995 Handle<Object> length_field =
9996 Handle<Object>(boilerplate_array->length(), isolate());
9997 HInstruction* length = AddInstruction(new(zone) HConstant(
9998 length_field, Representation::None()));
9999
10000 ASSERT(boilerplate_array->length()->IsSmi());
10001 Representation representation =
10002 IsFastElementsKind(boilerplate_array->GetElementsKind())
10003 ? Representation::Smi() : Representation::Tagged();
10004 AddStore(object_header, HObjectAccess::ForArrayLength(),
10005 length, representation);
10006 }
10007
10008 return result;
10009 }
10010
10011
10012 void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
10013 Handle<JSObject> boilerplate_object,
10014 Handle<JSObject> original_boilerplate_object,
10015 HValue* object_properties,
10016 HInstruction* target,
10017 int* offset) {
10018 Zone* zone = this->zone();
9947 Handle<DescriptorArray> descriptors( 10019 Handle<DescriptorArray> descriptors(
9948 boilerplate_object->map()->instance_descriptors()); 10020 boilerplate_object->map()->instance_descriptors());
9949 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); 10021 int limit = boilerplate_object->map()->NumberOfOwnDescriptors();
9950 10022
9951 int copied_fields = 0; 10023 int copied_fields = 0;
9952 for (int i = 0; i < limit; i++) { 10024 for (int i = 0; i < limit; i++) {
9953 PropertyDetails details = descriptors->GetDetails(i); 10025 PropertyDetails details = descriptors->GetDetails(i);
9954 if (details.type() != FIELD) continue; 10026 if (details.type() != FIELD) continue;
9955 copied_fields++; 10027 copied_fields++;
9956 int index = descriptors->GetFieldIndex(i); 10028 int index = descriptors->GetFieldIndex(i);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
9999 } 10071 }
10000 10072
10001 int inobject_properties = boilerplate_object->map()->inobject_properties(); 10073 int inobject_properties = boilerplate_object->map()->inobject_properties();
10002 HInstruction* value_instruction = AddInstruction(new(zone) 10074 HInstruction* value_instruction = AddInstruction(new(zone)
10003 HConstant(isolate()->factory()->one_pointer_filler_map(), 10075 HConstant(isolate()->factory()->one_pointer_filler_map(),
10004 Representation::Tagged())); 10076 Representation::Tagged()));
10005 for (int i = copied_fields; i < inobject_properties; i++) { 10077 for (int i = copied_fields; i < inobject_properties; i++) {
10006 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); 10078 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i);
10007 AddStore(object_properties, access, value_instruction); 10079 AddStore(object_properties, access, value_instruction);
10008 } 10080 }
10081 }
10009 10082
10010 // Build Allocation Site Info if desired 10083
10011 if (create_allocation_site_info) { 10084 void HOptimizedGraphBuilder::BuildEmitElements(
10012 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); 10085 Handle<FixedArrayBase> elements,
10086 Handle<FixedArrayBase> original_elements,
10087 ElementsKind kind,
10088 HValue* object_elements,
10089 HInstruction* target,
10090 int* offset) {
10091 Zone* zone = this->zone();
10092
10093 int elements_length = elements->length();
10094 HValue* object_elements_length =
10095 AddInstruction(new(zone) HConstant(
10096 elements_length, Representation::Integer32()));
10097
10098 BuildInitializeElementsHeader(object_elements, kind, object_elements_length);
10099
10100 // Copy elements backing store content.
10101 if (elements->IsFixedDoubleArray()) {
10102 BuildEmitFixedDoubleArray(elements, kind, object_elements);
10103 } else if (elements->IsFixedArray()) {
10104 BuildEmitFixedArray(elements, original_elements, kind, object_elements,
10105 target, offset);
10106 } else {
10107 UNREACHABLE();
10013 } 10108 }
10109 }
10014 10110
10015 if (object_elements != NULL) {
10016 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant(
10017 elements, Representation::Tagged()));
10018 10111
10019 int elements_length = elements->length(); 10112 void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray(
10020 HValue* object_elements_length = 10113 Handle<FixedArrayBase> elements,
10021 AddInstruction(new(zone) HConstant( 10114 ElementsKind kind,
10022 elements_length, Representation::Integer32())); 10115 HValue* object_elements) {
10116 Zone* zone = this->zone();
10117 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant(
10118 elements, Representation::Tagged()));
10119 int elements_length = elements->length();
10120 for (int i = 0; i < elements_length; i++) {
10121 HValue* key_constant =
10122 AddInstruction(new(zone) HConstant(i, Representation::Integer32()));
10123 HInstruction* value_instruction =
10124 AddInstruction(new(zone) HLoadKeyed(
10125 boilerplate_elements, key_constant, NULL, kind, ALLOW_RETURN_HOLE));
10126 HInstruction* store = AddInstruction(new(zone) HStoreKeyed(
10127 object_elements, key_constant, value_instruction, kind));
10128 store->ClearFlag(HValue::kDeoptimizeOnUndefined);
10129 }
10130 }
10023 10131
10024 BuildInitializeElements(object_elements, kind, object_elements_length);
10025 10132
10026 // Copy elements backing store content. 10133 void HOptimizedGraphBuilder::BuildEmitFixedArray(
10027 if (elements->IsFixedDoubleArray()) { 10134 Handle<FixedArrayBase> elements,
10028 for (int i = 0; i < elements_length; i++) { 10135 Handle<FixedArrayBase> original_elements,
10029 HValue* key_constant = 10136 ElementsKind kind,
10030 AddInstruction(new(zone) HConstant(i, Representation::Integer32())); 10137 HValue* object_elements,
10031 HInstruction* value_instruction = 10138 HInstruction* target,
10032 AddInstruction(new(zone) HLoadKeyed( 10139 int* offset) {
10033 boilerplate_elements, key_constant, NULL, kind, 10140 Zone* zone = this->zone();
10034 ALLOW_RETURN_HOLE)); 10141 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant(
10035 HInstruction* store = AddInstruction(new(zone) HStoreKeyed( 10142 elements, Representation::Tagged()));
10036 object_elements, key_constant, value_instruction, kind)); 10143 int elements_length = elements->length();
10037 store->ClearFlag(HValue::kDeoptimizeOnUndefined); 10144 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements);
10038 } 10145 Handle<FixedArray> original_fast_elements =
10039 } else if (elements->IsFixedArray()) { 10146 Handle<FixedArray>::cast(original_elements);
10040 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); 10147 for (int i = 0; i < elements_length; i++) {
10041 Handle<FixedArray> original_fast_elements = 10148 Handle<Object> value(fast_elements->get(i), isolate());
10042 Handle<FixedArray>::cast(original_elements); 10149 HValue* key_constant =
10043 for (int i = 0; i < elements_length; i++) { 10150 AddInstruction(new(zone) HConstant(i, Representation::Integer32()));
10044 Handle<Object> value(fast_elements->get(i), isolate()); 10151 if (value->IsJSObject()) {
10045 HValue* key_constant = 10152 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
10046 AddInstruction(new(zone) HConstant(i, Representation::Integer32())); 10153 Handle<JSObject> original_value_object = Handle<JSObject>::cast(
10047 if (value->IsJSObject()) { 10154 Handle<Object>(original_fast_elements->get(i), isolate()));
10048 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 10155 HInstruction* value_instruction =
10049 Handle<JSObject> original_value_object = Handle<JSObject>::cast( 10156 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset));
10050 Handle<Object>(original_fast_elements->get(i), isolate())); 10157 AddInstruction(new(zone) HStoreKeyed(
10051 HInstruction* value_instruction = 10158 object_elements, key_constant, value_instruction, kind));
10052 AddInstruction(new(zone) HInnerAllocatedObject(target, *offset)); 10159 BuildEmitDeepCopy(value_object, original_value_object, target,
10053 AddInstruction(new(zone) HStoreKeyed( 10160 offset, DONT_TRACK_ALLOCATION_SITE);
10054 object_elements, key_constant, value_instruction, kind));
10055 BuildEmitDeepCopy(value_object, original_value_object, target,
10056 offset, DONT_TRACK_ALLOCATION_SITE);
10057 } else {
10058 HInstruction* value_instruction =
10059 AddInstruction(new(zone) HLoadKeyed(
10060 boilerplate_elements, key_constant, NULL, kind,
10061 ALLOW_RETURN_HOLE));
10062 AddInstruction(new(zone) HStoreKeyed(
10063 object_elements, key_constant, value_instruction, kind));
10064 }
10065 }
10066 } else { 10161 } else {
10067 UNREACHABLE(); 10162 HInstruction* value_instruction =
10163 AddInstruction(new(zone) HLoadKeyed(
10164 boilerplate_elements, key_constant, NULL, kind,
10165 ALLOW_RETURN_HOLE));
10166 AddInstruction(new(zone) HStoreKeyed(
10167 object_elements, key_constant, value_instruction, kind));
10068 } 10168 }
10069 } 10169 }
10070 } 10170 }
10071 10171
10072
10073 HValue* HOptimizedGraphBuilder::BuildCopyObjectHeader(
10074 Handle<JSObject> boilerplate_object,
10075 HInstruction* target,
10076 int object_offset,
10077 int elements_offset,
10078 int elements_size) {
10079 ASSERT(boilerplate_object->properties()->length() == 0);
10080 Zone* zone = this->zone();
10081 HValue* result = NULL;
10082
10083 HValue* object_header =
10084 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset));
10085 Handle<Map> boilerplate_object_map(boilerplate_object->map());
10086 AddStoreMapConstant(object_header, boilerplate_object_map);
10087
10088 HInstruction* elements;
10089 if (elements_size == 0) {
10090 Handle<Object> elements_field =
10091 Handle<Object>(boilerplate_object->elements(), isolate());
10092 elements = AddInstruction(new(zone) HConstant(
10093 elements_field, Representation::Tagged()));
10094 } else {
10095 elements = AddInstruction(new(zone) HInnerAllocatedObject(
10096 target, elements_offset));
10097 result = elements;
10098 }
10099 AddStore(object_header, HObjectAccess::ForElementsPointer(), elements);
10100
10101 Handle<Object> properties_field =
10102 Handle<Object>(boilerplate_object->properties(), isolate());
10103 ASSERT(*properties_field == isolate()->heap()->empty_fixed_array());
10104 HInstruction* properties = AddInstruction(new(zone) HConstant(
10105 properties_field, Representation::None()));
10106 HObjectAccess access = HObjectAccess::ForPropertiesPointer();
10107 AddStore(object_header, access, properties);
10108
10109 if (boilerplate_object->IsJSArray()) {
10110 Handle<JSArray> boilerplate_array =
10111 Handle<JSArray>::cast(boilerplate_object);
10112 Handle<Object> length_field =
10113 Handle<Object>(boilerplate_array->length(), isolate());
10114 HInstruction* length = AddInstruction(new(zone) HConstant(
10115 length_field, Representation::None()));
10116
10117 ASSERT(boilerplate_array->length()->IsSmi());
10118 Representation representation =
10119 IsFastElementsKind(boilerplate_array->GetElementsKind())
10120 ? Representation::Smi() : Representation::Tagged();
10121 AddStore(object_header, HObjectAccess::ForArrayLength(),
10122 length, representation);
10123 }
10124
10125 return result;
10126 }
10127
10128
10129 void HOptimizedGraphBuilder::VisitThisFunction(ThisFunction* expr) { 10172 void HOptimizedGraphBuilder::VisitThisFunction(ThisFunction* expr) {
10130 ASSERT(!HasStackOverflow()); 10173 ASSERT(!HasStackOverflow());
10131 ASSERT(current_block() != NULL); 10174 ASSERT(current_block() != NULL);
10132 ASSERT(current_block()->HasPredecessor()); 10175 ASSERT(current_block()->HasPredecessor());
10133 HInstruction* instr = BuildThisFunction(); 10176 HInstruction* instr = BuildThisFunction();
10134 return ast_context()->ReturnInstruction(instr, expr->id()); 10177 return ast_context()->ReturnInstruction(instr, expr->id());
10135 } 10178 }
10136 10179
10137 10180
10138 void HOptimizedGraphBuilder::VisitDeclarations( 10181 void HOptimizedGraphBuilder::VisitDeclarations(
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
11472 } 11515 }
11473 } 11516 }
11474 11517
11475 #ifdef DEBUG 11518 #ifdef DEBUG
11476 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11519 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11477 if (allocator_ != NULL) allocator_->Verify(); 11520 if (allocator_ != NULL) allocator_->Verify();
11478 #endif 11521 #endif
11479 } 11522 }
11480 11523
11481 } } // namespace v8::internal 11524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698