OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 cow_checker.Else(); | 1216 cow_checker.Else(); |
1217 | 1217 |
1218 environment()->Push(elements); | 1218 environment()->Push(elements); |
1219 | 1219 |
1220 cow_checker.End(); | 1220 cow_checker.End(); |
1221 | 1221 |
1222 return environment()->Pop(); | 1222 return environment()->Pop(); |
1223 } | 1223 } |
1224 | 1224 |
1225 | 1225 |
| 1226 void HGraphBuilder::BuildTransitionElementsKind(HValue* object, |
| 1227 HValue* map, |
| 1228 ElementsKind from_kind, |
| 1229 ElementsKind to_kind, |
| 1230 bool is_jsarray) { |
| 1231 ASSERT(!IsFastHoleyElementsKind(from_kind) || |
| 1232 IsFastHoleyElementsKind(to_kind)); |
| 1233 |
| 1234 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { |
| 1235 Add<HTrapAllocationMemento>(object); |
| 1236 } |
| 1237 |
| 1238 if (!IsSimpleMapChangeTransition(from_kind, to_kind)) { |
| 1239 HInstruction* elements = AddLoadElements(object); |
| 1240 |
| 1241 HInstruction* empty_fixed_array = Add<HConstant>( |
| 1242 isolate()->factory()->empty_fixed_array(), Representation::Tagged()); |
| 1243 |
| 1244 IfBuilder if_builder(this); |
| 1245 |
| 1246 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array); |
| 1247 |
| 1248 if_builder.Then(); |
| 1249 |
| 1250 HInstruction* elements_length = AddLoadFixedArrayLength(elements); |
| 1251 |
| 1252 HInstruction* array_length = is_jsarray |
| 1253 ? AddLoad(object, HObjectAccess::ForArrayLength(), |
| 1254 NULL, Representation::Smi()) |
| 1255 : elements_length; |
| 1256 array_length->set_type(HType::Smi()); |
| 1257 |
| 1258 BuildGrowElementsCapacity(object, elements, from_kind, to_kind, |
| 1259 array_length, elements_length); |
| 1260 |
| 1261 if_builder.End(); |
| 1262 } |
| 1263 |
| 1264 AddStore(object, HObjectAccess::ForMap(), map); |
| 1265 } |
| 1266 |
| 1267 |
1226 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( | 1268 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
1227 HValue* object, | 1269 HValue* object, |
1228 HValue* key, | 1270 HValue* key, |
1229 HValue* val, | 1271 HValue* val, |
1230 HCheckMaps* mapcheck, | 1272 HCheckMaps* mapcheck, |
1231 bool is_js_array, | 1273 bool is_js_array, |
1232 ElementsKind elements_kind, | 1274 ElementsKind elements_kind, |
1233 bool is_store, | 1275 bool is_store, |
1234 LoadKeyedHoleMode load_mode, | 1276 LoadKeyedHoleMode load_mode, |
1235 KeyedAccessStoreMode store_mode) { | 1277 KeyedAccessStoreMode store_mode) { |
(...skipping 8758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9994 if (ShouldProduceTraceOutput()) { | 10036 if (ShouldProduceTraceOutput()) { |
9995 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10037 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9996 } | 10038 } |
9997 | 10039 |
9998 #ifdef DEBUG | 10040 #ifdef DEBUG |
9999 graph_->Verify(false); // No full verify. | 10041 graph_->Verify(false); // No full verify. |
10000 #endif | 10042 #endif |
10001 } | 10043 } |
10002 | 10044 |
10003 } } // namespace v8::internal | 10045 } } // namespace v8::internal |
OLD | NEW |