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

Side by Side Diff: src/hydrogen.cc

Issue 19759003: Replace BuildFastElementAccess() with AddFastElementAccess(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 external_elements, checked_key, dependency, elements_kind); 1097 external_elements, checked_key, dependency, elements_kind);
1098 if (FLAG_opt_safe_uint32_operations && 1098 if (FLAG_opt_safe_uint32_operations &&
1099 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { 1099 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) {
1100 graph()->RecordUint32Instruction(load); 1100 graph()->RecordUint32Instruction(load);
1101 } 1101 }
1102 return load; 1102 return load;
1103 } 1103 }
1104 } 1104 }
1105 1105
1106 1106
1107 HInstruction* HGraphBuilder::BuildFastElementAccess(
1108 HValue* elements,
1109 HValue* checked_key,
1110 HValue* val,
1111 HValue* load_dependency,
1112 ElementsKind elements_kind,
1113 bool is_store,
1114 LoadKeyedHoleMode load_mode,
1115 KeyedAccessStoreMode store_mode) {
1116 Zone* zone = this->zone();
1117 if (is_store) {
1118 ASSERT(val != NULL);
1119 switch (elements_kind) {
1120 case FAST_SMI_ELEMENTS:
1121 case FAST_HOLEY_SMI_ELEMENTS:
1122 case FAST_ELEMENTS:
1123 case FAST_HOLEY_ELEMENTS:
1124 case FAST_DOUBLE_ELEMENTS:
1125 case FAST_HOLEY_DOUBLE_ELEMENTS:
1126 return new(zone) HStoreKeyed(elements, checked_key, val, elements_kind);
1127 default:
1128 UNREACHABLE();
1129 return NULL;
1130 }
1131 }
1132 // It's an element load (!is_store).
1133 return new(zone) HLoadKeyed(elements,
1134 checked_key,
1135 load_dependency,
1136 elements_kind,
1137 load_mode);
1138 }
1139
1140
1141 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, 1107 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
1142 HValue* elements, 1108 HValue* elements,
1143 ElementsKind kind, 1109 ElementsKind kind,
1144 HValue* length, 1110 HValue* length,
1145 HValue* key, 1111 HValue* key,
1146 bool is_js_array) { 1112 bool is_js_array) {
1147 Zone* zone = this->zone(); 1113 Zone* zone = this->zone();
1148 IfBuilder length_checker(this); 1114 IfBuilder length_checker(this);
1149 1115
1150 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; 1116 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 elements = BuildCopyElementsOnWrite(object, elements, elements_kind, 1330 elements = BuildCopyElementsOnWrite(object, elements, elements_kind,
1365 length); 1331 length);
1366 } else { 1332 } else {
1367 HCheckMaps* check_cow_map = HCheckMaps::New( 1333 HCheckMaps* check_cow_map = HCheckMaps::New(
1368 elements, isolate()->factory()->fixed_array_map(), zone); 1334 elements, isolate()->factory()->fixed_array_map(), zone);
1369 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 1335 check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
1370 AddInstruction(check_cow_map); 1336 AddInstruction(check_cow_map);
1371 } 1337 }
1372 } 1338 }
1373 } 1339 }
1374 return AddInstruction( 1340 return AddFastElementAccess(elements, checked_key, val, mapcheck,
1375 BuildFastElementAccess(elements, checked_key, val, mapcheck, 1341 elements_kind, is_store, load_mode, store_mode);
1376 elements_kind, is_store, load_mode, store_mode));
1377 } 1342 }
1378 1343
1379 1344
1380 HValue* HGraphBuilder::BuildAllocateElements(HValue* context, 1345 HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
1381 ElementsKind kind, 1346 ElementsKind kind,
1382 HValue* capacity) { 1347 HValue* capacity) {
1383 Zone* zone = this->zone(); 1348 Zone* zone = this->zone();
1384 1349
1385 int elements_size = IsFastDoubleElementsKind(kind) 1350 int elements_size = IsFastDoubleElementsKind(kind)
1386 ? kDoubleSize : kPointerSize; 1351 ? kDoubleSize : kPointerSize;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 elements_location += AllocationSiteInfo::kSize; 1428 elements_location += AllocationSiteInfo::kSize;
1464 } 1429 }
1465 1430
1466 HInnerAllocatedObject* elements = 1431 HInnerAllocatedObject* elements =
1467 Add<HInnerAllocatedObject>(array, elements_location); 1432 Add<HInnerAllocatedObject>(array, elements_location);
1468 AddStore(array, HObjectAccess::ForElementsPointer(), elements); 1433 AddStore(array, HObjectAccess::ForElementsPointer(), elements);
1469 return elements; 1434 return elements;
1470 } 1435 }
1471 1436
1472 1437
1438 HInstruction* HGraphBuilder::AddFastElementAccess(
1439 HValue* elements,
1440 HValue* checked_key,
1441 HValue* val,
1442 HValue* load_dependency,
1443 ElementsKind elements_kind,
1444 bool is_store,
1445 LoadKeyedHoleMode load_mode,
1446 KeyedAccessStoreMode store_mode) {
1447 if (is_store) {
1448 ASSERT(val != NULL);
1449 switch (elements_kind) {
1450 case FAST_SMI_ELEMENTS:
1451 case FAST_HOLEY_SMI_ELEMENTS:
1452 case FAST_ELEMENTS:
1453 case FAST_HOLEY_ELEMENTS:
1454 case FAST_DOUBLE_ELEMENTS:
1455 case FAST_HOLEY_DOUBLE_ELEMENTS:
1456 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind);
1457 default:
1458 UNREACHABLE();
1459 return NULL;
1460 }
1461 }
1462 // It's an element load (!is_store).
1463 return Add<HLoadKeyed>(
1464 elements, checked_key, load_dependency, elements_kind, load_mode);
1465 }
1466
1467
1473 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object, 1468 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object,
1474 HValue* typecheck) { 1469 HValue* typecheck) {
1475 return AddLoad(object, HObjectAccess::ForElementsPointer(), typecheck); 1470 return AddLoad(object, HObjectAccess::ForElementsPointer(), typecheck);
1476 } 1471 }
1477 1472
1478 1473
1479 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) { 1474 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) {
1480 HLoadNamedField* instr = AddLoad(object, HObjectAccess::ForFixedArrayLength(), 1475 HLoadNamedField* instr = AddLoad(object, HObjectAccess::ForFixedArrayLength(),
1481 NULL, Representation::Smi()); 1476 NULL, Representation::Smi());
1482 instr->set_type(HType::Smi()); 1477 instr->set_type(HType::Smi());
(...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5702 } 5697 }
5703 if (map->IsJSArray()) { 5698 if (map->IsJSArray()) {
5704 HInstruction* length = AddLoad(object, HObjectAccess::ForArrayLength(), 5699 HInstruction* length = AddLoad(object, HObjectAccess::ForArrayLength(),
5705 mapcompare, Representation::Smi()); 5700 mapcompare, Representation::Smi());
5706 length->set_type(HType::Smi()); 5701 length->set_type(HType::Smi());
5707 checked_key = Add<HBoundsCheck>(key, length); 5702 checked_key = Add<HBoundsCheck>(key, length);
5708 } else { 5703 } else {
5709 HInstruction* length = AddLoadFixedArrayLength(elements); 5704 HInstruction* length = AddLoadFixedArrayLength(elements);
5710 checked_key = Add<HBoundsCheck>(key, length); 5705 checked_key = Add<HBoundsCheck>(key, length);
5711 } 5706 }
5712 access = AddInstruction(BuildFastElementAccess( 5707 access = AddFastElementAccess(
5713 elements, checked_key, val, mapcompare, 5708 elements, checked_key, val, mapcompare,
5714 elements_kind, is_store, NEVER_RETURN_HOLE, STANDARD_STORE)); 5709 elements_kind, is_store, NEVER_RETURN_HOLE, STANDARD_STORE);
5715 } else if (IsDictionaryElementsKind(elements_kind)) { 5710 } else if (IsDictionaryElementsKind(elements_kind)) {
5716 if (is_store) { 5711 if (is_store) {
5717 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); 5712 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val));
5718 } else { 5713 } else {
5719 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); 5714 access = AddInstruction(BuildLoadKeyedGeneric(object, key));
5720 } 5715 }
5721 } else { 5716 } else {
5722 ASSERT(IsExternalArrayElementsKind(elements_kind)); 5717 ASSERT(IsExternalArrayElementsKind(elements_kind));
5723 HInstruction* length = AddLoadFixedArrayLength(elements); 5718 HInstruction* length = AddLoadFixedArrayLength(elements);
5724 checked_key = Add<HBoundsCheck>(key, length); 5719 checked_key = Add<HBoundsCheck>(key, length);
(...skipping 4187 matching lines...) Expand 10 before | Expand all | Expand 10 after
9912 if (ShouldProduceTraceOutput()) { 9907 if (ShouldProduceTraceOutput()) {
9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9908 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9914 } 9909 }
9915 9910
9916 #ifdef DEBUG 9911 #ifdef DEBUG
9917 graph_->Verify(false); // No full verify. 9912 graph_->Verify(false); // No full verify.
9918 #endif 9913 #endif
9919 } 9914 }
9920 9915
9921 } } // namespace v8::internal 9916 } } // 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