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

Side by Side Diff: src/hydrogen.cc

Issue 108503004: HStoreKeyed for Smis optimized for x64 + related redundant moves of elements removed (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 7 years 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') | src/hydrogen-instructions.h » ('j') | 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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 if (object->type().IsJSObject()) return object; 1289 if (object->type().IsJSObject()) return object;
1290 return Add<HWrapReceiver>(object, function); 1290 return Add<HWrapReceiver>(object, function);
1291 } 1291 }
1292 1292
1293 1293
1294 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, 1294 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
1295 HValue* elements, 1295 HValue* elements,
1296 ElementsKind kind, 1296 ElementsKind kind,
1297 HValue* length, 1297 HValue* length,
1298 HValue* key, 1298 HValue* key,
1299 bool is_js_array) { 1299 bool is_js_array,
1300 bool is_store) {
1300 IfBuilder length_checker(this); 1301 IfBuilder length_checker(this);
1301 1302
1302 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; 1303 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
1303 length_checker.If<HCompareNumericAndBranch>(key, length, token); 1304 length_checker.If<HCompareNumericAndBranch>(key, length, token);
1304 1305
1305 length_checker.Then(); 1306 length_checker.Then();
1306 1307
1307 HValue* current_capacity = AddLoadFixedArrayLength(elements); 1308 HValue* current_capacity = AddLoadFixedArrayLength(elements);
1308 1309
1309 IfBuilder capacity_checker(this); 1310 IfBuilder capacity_checker(this);
(...skipping 22 matching lines...) Expand all
1332 capacity_checker.End(); 1333 capacity_checker.End();
1333 1334
1334 if (is_js_array) { 1335 if (is_js_array) {
1335 HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1()); 1336 HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1());
1336 new_length->ClearFlag(HValue::kCanOverflow); 1337 new_length->ClearFlag(HValue::kCanOverflow);
1337 1338
1338 Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind), 1339 Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind),
1339 new_length); 1340 new_length);
1340 } 1341 }
1341 1342
1343 if (is_store && kind == FAST_SMI_ELEMENTS) {
1344 HValue* checked_elements = environment()->Top();
1345
1346 // Write zero to ensure that the new element is initialized with some smi.
1347 Add<HStoreKeyed>(checked_elements, key, graph()->GetConstant0(), kind);
1348 }
1349
1342 length_checker.Else(); 1350 length_checker.Else();
1343 Add<HBoundsCheck>(key, length); 1351 Add<HBoundsCheck>(key, length);
1344 1352
1345 environment()->Push(elements); 1353 environment()->Push(elements);
1346 length_checker.End(); 1354 length_checker.End();
1347 1355
1348 return environment()->Pop(); 1356 return environment()->Pop();
1349 } 1357 }
1350 1358
1351 1359
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 // deopt, leaving the backing store in an invalid state. 2103 // deopt, leaving the backing store in an invalid state.
2096 if (is_store && IsFastSmiElementsKind(elements_kind) && 2104 if (is_store && IsFastSmiElementsKind(elements_kind) &&
2097 !val->type().IsSmi()) { 2105 !val->type().IsSmi()) {
2098 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); 2106 val = AddUncasted<HForceRepresentation>(val, Representation::Smi());
2099 } 2107 }
2100 2108
2101 if (IsGrowStoreMode(store_mode)) { 2109 if (IsGrowStoreMode(store_mode)) {
2102 NoObservableSideEffectsScope no_effects(this); 2110 NoObservableSideEffectsScope no_effects(this);
2103 elements = BuildCheckForCapacityGrow(checked_object, elements, 2111 elements = BuildCheckForCapacityGrow(checked_object, elements,
2104 elements_kind, length, key, 2112 elements_kind, length, key,
2105 is_js_array); 2113 is_js_array, is_store);
2106 checked_key = key; 2114 checked_key = key;
2107 } else { 2115 } else {
2108 checked_key = Add<HBoundsCheck>(key, length); 2116 checked_key = Add<HBoundsCheck>(key, length);
2109 2117
2110 if (is_store && (fast_elements || fast_smi_only_elements)) { 2118 if (is_store && (fast_elements || fast_smi_only_elements)) {
2111 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { 2119 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) {
2112 NoObservableSideEffectsScope no_effects(this); 2120 NoObservableSideEffectsScope no_effects(this);
2113 elements = BuildCopyElementsOnWrite(checked_object, elements, 2121 elements = BuildCopyElementsOnWrite(checked_object, elements,
2114 elements_kind, length); 2122 elements_kind, length);
2115 } else { 2123 } else {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 HValue* val, 2267 HValue* val,
2260 HValue* dependency, 2268 HValue* dependency,
2261 ElementsKind elements_kind, 2269 ElementsKind elements_kind,
2262 bool is_store, 2270 bool is_store,
2263 LoadKeyedHoleMode load_mode) { 2271 LoadKeyedHoleMode load_mode) {
2264 if (is_store) { 2272 if (is_store) {
2265 ASSERT(val != NULL); 2273 ASSERT(val != NULL);
2266 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) { 2274 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) {
2267 val = Add<HClampToUint8>(val); 2275 val = Add<HClampToUint8>(val);
2268 } 2276 }
2269 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind); 2277 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind,
2278 elements_kind == FAST_SMI_ELEMENTS
2279 ? STORE_TO_INITIALIZED_ENTRY
2280 : INITIALIZING_STORE);
2270 } 2281 }
2271 2282
2272 ASSERT(!is_store); 2283 ASSERT(!is_store);
2273 ASSERT(val == NULL); 2284 ASSERT(val == NULL);
2274 HLoadKeyed* load = Add<HLoadKeyed>( 2285 HLoadKeyed* load = Add<HLoadKeyed>(
2275 elements, checked_key, dependency, elements_kind, load_mode); 2286 elements, checked_key, dependency, elements_kind, load_mode);
2276 if (FLAG_opt_safe_uint32_operations && 2287 if (FLAG_opt_safe_uint32_operations &&
2277 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { 2288 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) {
2278 graph()->RecordUint32Instruction(load); 2289 graph()->RecordUint32Instruction(load);
2279 } 2290 }
(...skipping 8501 matching lines...) Expand 10 before | Expand all | Expand 10 after
10781 if (ShouldProduceTraceOutput()) { 10792 if (ShouldProduceTraceOutput()) {
10782 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10793 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10783 } 10794 }
10784 10795
10785 #ifdef DEBUG 10796 #ifdef DEBUG
10786 graph_->Verify(false); // No full verify. 10797 graph_->Verify(false); // No full verify.
10787 #endif 10798 #endif
10788 } 10799 }
10789 10800
10790 } } // namespace v8::internal 10801 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698