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

Side by Side Diff: src/hydrogen.cc

Issue 166653005: Fix dictionary element load to pass correct elements kind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Enable tests Created 6 years, 10 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 | « no previous file | src/x64/lithium-codegen-x64.cc » ('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 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 int32_t entry_size = SeededNumberDictionary::kEntrySize; 1444 int32_t entry_size = SeededNumberDictionary::kEntrySize;
1445 raw_index = AddUncasted<HMul>(raw_index, Add<HConstant>(entry_size)); 1445 raw_index = AddUncasted<HMul>(raw_index, Add<HConstant>(entry_size));
1446 raw_index->ClearFlag(HValue::kCanOverflow); 1446 raw_index->ClearFlag(HValue::kCanOverflow);
1447 1447
1448 int32_t base_offset = SeededNumberDictionary::kElementsStartIndex; 1448 int32_t base_offset = SeededNumberDictionary::kElementsStartIndex;
1449 HValue* key_index = AddUncasted<HAdd>(raw_index, Add<HConstant>(base_offset)); 1449 HValue* key_index = AddUncasted<HAdd>(raw_index, Add<HConstant>(base_offset));
1450 key_index->ClearFlag(HValue::kCanOverflow); 1450 key_index->ClearFlag(HValue::kCanOverflow);
1451 1451
1452 HValue* candidate_key = Add<HLoadKeyed>(elements, key_index, 1452 HValue* candidate_key = Add<HLoadKeyed>(elements, key_index,
1453 static_cast<HValue*>(NULL), 1453 static_cast<HValue*>(NULL),
1454 FAST_SMI_ELEMENTS); 1454 FAST_ELEMENTS);
1455 1455
1456 IfBuilder key_compare(this); 1456 IfBuilder key_compare(this);
1457 key_compare.IfNot<HCompareObjectEqAndBranch>(key, candidate_key); 1457 key_compare.IfNot<HCompareObjectEqAndBranch>(key, candidate_key);
1458 key_compare.Then(); 1458 key_compare.Then();
1459 { 1459 {
1460 // Key at the current probe doesn't match, try at the next probe. 1460 // Key at the current probe doesn't match, try at the next probe.
1461 HValue* result = BuildUncheckedDictionaryElementLoadHelper( 1461 HValue* result = BuildUncheckedDictionaryElementLoadHelper(
1462 elements, key, hash, mask, current_probe + 1); 1462 elements, key, hash, mask, current_probe + 1);
1463 if (result == NULL) { 1463 if (result == NULL) {
1464 key_compare.Deopt("probes exhausted in keyed load dictionary lookup"); 1464 key_compare.Deopt("probes exhausted in keyed load dictionary lookup");
1465 result = graph()->GetConstantUndefined(); 1465 result = graph()->GetConstantUndefined();
1466 } else { 1466 } else {
1467 Push(result); 1467 Push(result);
1468 } 1468 }
1469 } 1469 }
1470 key_compare.Else(); 1470 key_compare.Else();
1471 { 1471 {
1472 // Key at current probe matches. Details must be zero, otherwise the 1472 // Key at current probe matches. Details must be zero, otherwise the
1473 // dictionary element requires special handling. 1473 // dictionary element requires special handling.
1474 HValue* details_index = AddUncasted<HAdd>( 1474 HValue* details_index = AddUncasted<HAdd>(
1475 raw_index, Add<HConstant>(base_offset + 2)); 1475 raw_index, Add<HConstant>(base_offset + 2));
1476 details_index->ClearFlag(HValue::kCanOverflow); 1476 details_index->ClearFlag(HValue::kCanOverflow);
1477 1477
1478 HValue* details = Add<HLoadKeyed>(elements, details_index, 1478 HValue* details = Add<HLoadKeyed>(elements, details_index,
1479 static_cast<HValue*>(NULL), 1479 static_cast<HValue*>(NULL),
1480 FAST_SMI_ELEMENTS); 1480 FAST_ELEMENTS);
1481 IfBuilder details_compare(this); 1481 IfBuilder details_compare(this);
1482 details_compare.If<HCompareNumericAndBranch>(details, 1482 details_compare.If<HCompareNumericAndBranch>(details,
1483 graph()->GetConstant0(), 1483 graph()->GetConstant0(),
1484 Token::NE); 1484 Token::NE);
1485 details_compare.ThenDeopt("keyed load dictionary element not fast case"); 1485 details_compare.ThenDeopt("keyed load dictionary element not fast case");
1486 1486
1487 details_compare.Else(); 1487 details_compare.Else();
1488 { 1488 {
1489 // Key matches and details are zero --> fast case. Load and return the 1489 // Key matches and details are zero --> fast case. Load and return the
1490 // value. 1490 // value.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, 1540 HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
1541 HValue* key) { 1541 HValue* key) {
1542 HValue* elements = AddLoadElements(receiver); 1542 HValue* elements = AddLoadElements(receiver);
1543 1543
1544 HValue* hash = BuildElementIndexHash(key); 1544 HValue* hash = BuildElementIndexHash(key);
1545 1545
1546 HValue* capacity = Add<HLoadKeyed>( 1546 HValue* capacity = Add<HLoadKeyed>(
1547 elements, 1547 elements,
1548 Add<HConstant>(NameDictionary::kCapacityIndex), 1548 Add<HConstant>(NameDictionary::kCapacityIndex),
1549 static_cast<HValue*>(NULL), 1549 static_cast<HValue*>(NULL),
1550 FAST_SMI_ELEMENTS); 1550 FAST_ELEMENTS);
1551 1551
1552 HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1()); 1552 HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
1553 mask->ChangeRepresentation(Representation::Integer32()); 1553 mask->ChangeRepresentation(Representation::Integer32());
1554 mask->ClearFlag(HValue::kCanOverflow); 1554 mask->ClearFlag(HValue::kCanOverflow);
1555 1555
1556 return BuildUncheckedDictionaryElementLoadHelper(elements, key, 1556 return BuildUncheckedDictionaryElementLoadHelper(elements, key,
1557 hash, mask, 0); 1557 hash, mask, 0);
1558 } 1558 }
1559 1559
1560 1560
(...skipping 9721 matching lines...) Expand 10 before | Expand all | Expand 10 after
11282 if (ShouldProduceTraceOutput()) { 11282 if (ShouldProduceTraceOutput()) {
11283 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11283 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11284 } 11284 }
11285 11285
11286 #ifdef DEBUG 11286 #ifdef DEBUG
11287 graph_->Verify(false); // No full verify. 11287 graph_->Verify(false); // No full verify.
11288 #endif 11288 #endif
11289 } 11289 }
11290 11290
11291 } } // namespace v8::internal 11291 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698