Commit 072ea0c8 authored by cbruni's avatar cbruni Committed by Commit bot

[tests] Change CodeStubAssemblerTester code type to BUILTIN

Drive-by-fix 1: be more precise in machine representations for
AllocateNameDictionary to make --turbo_verify_machine_graph happy.

Drive-by-fix 2: Improve graph verifier output by printing input
representation.

BUG=

Review-Url: https://codereview.chromium.org/2475913002
Cr-Commit-Position: refs/heads/master@{#40797}
parent 7344f4f0
......@@ -141,7 +141,8 @@ Node* CodeStubAssembler::WordIsPowerOfTwo(Node* value) {
// value && !(value & (value - 1))
return WordEqual(
Select(WordEqual(value, IntPtrConstant(0)), IntPtrConstant(1),
WordAnd(value, IntPtrSub(value, IntPtrConstant(1)))),
WordAnd(value, IntPtrSub(value, IntPtrConstant(1))),
MachineType::PointerRepresentation()),
IntPtrConstant(0));
}
......@@ -1708,6 +1709,7 @@ Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) {
SKIP_WRITE_BARRIER);
// Initialize NameDictionary elements.
result = BitcastTaggedToWord(result);
Node* start_address = IntPtrAdd(
result, IntPtrConstant(NameDictionary::OffsetOfElementAt(
NameDictionary::kElementsStartIndex) -
......@@ -1772,13 +1774,12 @@ void CodeStubAssembler::StoreFieldsNoWriteBarrier(Node* start_address,
Comment("StoreFieldsNoWriteBarrier");
CSA_ASSERT(WordIsWordAligned(start_address));
CSA_ASSERT(WordIsWordAligned(end_address));
BuildFastLoop(MachineType::PointerRepresentation(), start_address,
end_address,
[value](CodeStubAssembler* a, Node* current) {
a->StoreNoWriteBarrier(MachineType::PointerRepresentation(),
current, value);
},
kPointerSize, IndexAdvanceMode::kPost);
BuildFastLoop(
MachineType::PointerRepresentation(), start_address, end_address,
[value](CodeStubAssembler* a, Node* current) {
a->StoreNoWriteBarrier(MachineRepresentation::kTagged, current, value);
},
kPointerSize, IndexAdvanceMode::kPost);
}
Node* CodeStubAssembler::AllocateUninitializedJSArrayWithoutElements(
......@@ -4012,7 +4013,8 @@ Node* CodeStubAssembler::HashTableComputeCapacity(Node* at_least_space_for) {
}
Node* CodeStubAssembler::IntPtrMax(Node* left, Node* right) {
return Select(IntPtrGreaterThanOrEqual(left, right), left, right);
return Select(IntPtrGreaterThanOrEqual(left, right), left, right,
MachineType::PointerRepresentation());
}
template <typename Dictionary>
......
......@@ -446,12 +446,14 @@ class MachineRepresentationChecker {
void CheckValueInputRepresentationIs(Node const* node, int index,
MachineRepresentation representation) {
Node const* input = node->InputAt(index);
if (inferrer_->GetRepresentation(input) != representation) {
MachineRepresentation input_representation =
inferrer_->GetRepresentation(input);
if (input_representation != representation) {
std::stringstream str;
str << "TypeError: node #" << node->id() << ":" << *node->op()
<< " uses node #" << input->id() << ":" << *input->op()
<< " which doesn't have a " << MachineReprToString(representation)
<< " representation.";
str << "TypeError: node #" << node->id() << ":" << *node->op() << ":"
<< MachineReprToString(input_representation) << " uses node #"
<< input->id() << ":" << *input->op() << " which doesn't have a "
<< MachineReprToString(representation) << " representation.";
FATAL(str.str().c_str());
}
}
......@@ -520,7 +522,9 @@ class MachineRepresentationChecker {
void CheckValueInputForInt64Op(Node const* node, int index) {
Node const* input = node->InputAt(index);
switch (inferrer_->GetRepresentation(input)) {
MachineRepresentation input_representation =
inferrer_->GetRepresentation(input);
switch (input_representation) {
case MachineRepresentation::kWord64:
return;
case MachineRepresentation::kNone: {
......@@ -535,9 +539,9 @@ class MachineRepresentationChecker {
break;
}
std::ostringstream str;
str << "TypeError: node #" << node->id() << ":" << *node->op()
<< " uses node #" << input->id() << ":" << *input->op()
<< " which doesn't have a kWord64 representation.";
str << "TypeError: node #" << node->id() << ":" << *node->op() << ":"
<< input_representation << " uses node #" << input->id() << ":"
<< *input->op() << " which doesn't have a kWord64 representation.";
FATAL(str.str().c_str());
}
......
......@@ -36,7 +36,7 @@ class CodeAssemblerTesterImpl : private ZoneHolder, public CodeAssemblerT {
// Test generating code for a JS function (e.g. builtins).
CodeAssemblerTesterImpl(Isolate* isolate, int parameter_count,
Code::Kind kind = Code::FUNCTION)
Code::Kind kind = Code::BUILTIN)
: ZoneHolder(isolate),
CodeAssemblerT(isolate, ZoneHolder::held_zone(), parameter_count,
Code::ComputeFlags(kind), "test"),
......
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