Commit 36807f8a authored by ishell's avatar ishell Committed by Commit bot

[stubs] Fix issues found by the machine graph verifier in load/store IC stubs.

BUG=

Review-Url: https://codereview.chromium.org/2560663002
Cr-Commit-Position: refs/heads/master@{#41548}
parent df2f66e0
...@@ -431,10 +431,7 @@ Node* CodeStubAssembler::SmiUntag(Node* value) { ...@@ -431,10 +431,7 @@ Node* CodeStubAssembler::SmiUntag(Node* value) {
Node* CodeStubAssembler::SmiToWord32(Node* value) { Node* CodeStubAssembler::SmiToWord32(Node* value) {
Node* result = SmiUntag(value); Node* result = SmiUntag(value);
if (Is64()) { return TruncateWordToWord32(result);
result = TruncateInt64ToInt32(result);
}
return result;
} }
Node* CodeStubAssembler::SmiToFloat64(Node* value) { Node* CodeStubAssembler::SmiToFloat64(Node* value) {
...@@ -608,6 +605,13 @@ Node* CodeStubAssembler::SmiMul(Node* a, Node* b) { ...@@ -608,6 +605,13 @@ Node* CodeStubAssembler::SmiMul(Node* a, Node* b) {
return var_result.value(); return var_result.value();
} }
Node* CodeStubAssembler::TruncateWordToWord32(Node* value) {
if (Is64()) {
return TruncateInt64ToInt32(value);
}
return value;
}
Node* CodeStubAssembler::TaggedIsSmi(Node* a) { Node* CodeStubAssembler::TaggedIsSmi(Node* a) {
return WordEqual(WordAnd(BitcastTaggedToWord(a), IntPtrConstant(kSmiTagMask)), return WordEqual(WordAnd(BitcastTaggedToWord(a), IntPtrConstant(kSmiTagMask)),
IntPtrConstant(0)); IntPtrConstant(0));
...@@ -2629,7 +2633,7 @@ Node* CodeStubAssembler::ChangeInt32ToTagged(Node* value) { ...@@ -2629,7 +2633,7 @@ Node* CodeStubAssembler::ChangeInt32ToTagged(Node* value) {
Goto(&if_join); Goto(&if_join);
Bind(&if_notoverflow); Bind(&if_notoverflow);
{ {
Node* result = Projection(0, pair); Node* result = BitcastWordToTaggedSigned(Projection(0, pair));
var_result.Bind(result); var_result.Bind(result);
} }
Goto(&if_join); Goto(&if_join);
...@@ -2656,7 +2660,7 @@ Node* CodeStubAssembler::ChangeUint32ToTagged(Node* value) { ...@@ -2656,7 +2660,7 @@ Node* CodeStubAssembler::ChangeUint32ToTagged(Node* value) {
Node* overflow = Projection(1, pair); Node* overflow = Projection(1, pair);
GotoIf(overflow, &if_overflow); GotoIf(overflow, &if_overflow);
Node* result = Projection(0, pair); Node* result = BitcastWordToTaggedSigned(Projection(0, pair));
var_result.Bind(result); var_result.Bind(result);
} }
} }
...@@ -4462,7 +4466,7 @@ template void CodeStubAssembler::NameDictionaryLookup<GlobalDictionary>( ...@@ -4462,7 +4466,7 @@ template void CodeStubAssembler::NameDictionaryLookup<GlobalDictionary>(
Node* CodeStubAssembler::ComputeIntegerHash(Node* key, Node* seed) { Node* CodeStubAssembler::ComputeIntegerHash(Node* key, Node* seed) {
// See v8::internal::ComputeIntegerHash() // See v8::internal::ComputeIntegerHash()
Node* hash = key; Node* hash = TruncateWordToWord32(key);
hash = Word32Xor(hash, seed); hash = Word32Xor(hash, seed);
hash = Int32Add(Word32Xor(hash, Int32Constant(0xffffffff)), hash = Int32Add(Word32Xor(hash, Int32Constant(0xffffffff)),
Word32Shl(hash, Int32Constant(15))); Word32Shl(hash, Int32Constant(15)));
......
...@@ -182,6 +182,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -182,6 +182,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* SelectTaggedConstant(Node* condition, Node* true_value, Node* SelectTaggedConstant(Node* condition, Node* true_value,
Node* false_value); Node* false_value);
Node* TruncateWordToWord32(Node* value);
// Check a value for smi-ness // Check a value for smi-ness
Node* TaggedIsSmi(Node* a); Node* TaggedIsSmi(Node* a);
Node* TaggedIsNotSmi(Node* a); Node* TaggedIsNotSmi(Node* a);
......
This diff is collapsed.
...@@ -1958,6 +1958,8 @@ TEST(CodeStubAssemblerGraphsCorrectness) { ...@@ -1958,6 +1958,8 @@ TEST(CodeStubAssemblerGraphsCorrectness) {
// Recompile some stubs here. // Recompile some stubs here.
Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF)); Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF));
Recompile<LoadICStub>(isolate);
Recompile<KeyedLoadICTFStub>(isolate);
} }
v8_isolate->Dispose(); v8_isolate->Dispose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment