Commit 58672706 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[cleanup] Make better use of heap constant accessors.

E.g. use TrueConstant() instead of BooleanConstant(true) and
NullConstant() instead of HeapConstant(factory...null_value()).

R=jkummerow@chromium.org

Bug: 
Change-Id: I0588d71940d8baf289eb8f8e6c8d20aa717d57f6
Reviewed-on: https://chromium-review.googlesource.com/735681
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48911}
parent fe8eb6f0
......@@ -2134,10 +2134,10 @@ TF_BUILTIN(ArrayIsArray, CodeStubAssembler) {
&return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
BIND(&call_runtime);
Return(CallRuntime(Runtime::kArrayIsArray, context, object));
......@@ -2359,8 +2359,7 @@ void ArrayIncludesIndexofAssembler::Generate(SearchVariant variant) {
BIND(&runtime);
TNode<Object> result = CallRuntime(Runtime::kStringEqual, context,
search_element_string, element_k);
Branch(WordEqual(BooleanConstant(true), result), &return_found,
&continue_loop);
Branch(WordEqual(result, TrueConstant()), &return_found, &continue_loop);
BIND(&continue_loop);
Increment(&index_var);
......
......@@ -229,10 +229,10 @@ TF_BUILTIN(ToBoolean, CodeStubAssembler) {
BranchIfToBooleanIsTrue(value, &return_true, &return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
// ES6 section 7.1.2 ToBoolean ( argument )
......@@ -245,10 +245,10 @@ TF_BUILTIN(ToBooleanLazyDeoptContinuation, CodeStubAssembler) {
BranchIfToBooleanIsTrue(value, &return_true, &return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
TF_BUILTIN(ToLength, CodeStubAssembler) {
......
......@@ -84,10 +84,10 @@ TF_BUILTIN(NumberIsFinite, CodeStubAssembler) {
&return_true);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
TF_BUILTIN(AllocateHeapNumber, CodeStubAssembler) {
......@@ -118,10 +118,10 @@ TF_BUILTIN(NumberIsInteger, CodeStubAssembler) {
&return_true, &return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
// ES6 #sec-number.isnan
......@@ -141,10 +141,10 @@ TF_BUILTIN(NumberIsNaN, CodeStubAssembler) {
BranchIfFloat64IsNaN(number_value, &return_true, &return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
// ES6 #sec-number.issafeinteger
......@@ -176,10 +176,10 @@ TF_BUILTIN(NumberIsSafeInteger, CodeStubAssembler) {
&return_true, &return_false);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
}
// ES6 #sec-number.parsefloat
......
......@@ -157,10 +157,10 @@ TF_BUILTIN(ObjectPrototypeHasOwnProperty, ObjectBuiltinsAssembler) {
Branch(IsName(key), &return_false, &call_runtime);
BIND(&return_true);
Return(BooleanConstant(true));
Return(TrueConstant());
BIND(&return_false);
Return(BooleanConstant(false));
Return(FalseConstant());
BIND(&call_runtime);
Return(CallRuntime(Runtime::kObjectHasOwnProperty, context, object, key));
......
......@@ -910,7 +910,7 @@ void PromiseBuiltinsAssembler::BranchIfAccessCheckFailed(
{
Branch(WordEqual(CallRuntime(Runtime::kAllowDynamicFunction, context,
promise_constructor),
BooleanConstant(true)),
TrueConstant()),
&has_access, if_noaccess);
}
......
......@@ -420,12 +420,12 @@ void StringBuiltinsAssembler::GenerateStringRelationalComparison(
switch (mode) {
case RelationalComparisonMode::kLessThan:
case RelationalComparisonMode::kLessThanOrEqual:
Return(BooleanConstant(true));
Return(TrueConstant());
break;
case RelationalComparisonMode::kGreaterThan:
case RelationalComparisonMode::kGreaterThanOrEqual:
Return(BooleanConstant(false));
Return(FalseConstant());
break;
}
......@@ -433,12 +433,12 @@ void StringBuiltinsAssembler::GenerateStringRelationalComparison(
switch (mode) {
case RelationalComparisonMode::kLessThan:
case RelationalComparisonMode::kGreaterThan:
Return(BooleanConstant(false));
Return(FalseConstant());
break;
case RelationalComparisonMode::kLessThanOrEqual:
case RelationalComparisonMode::kGreaterThanOrEqual:
Return(BooleanConstant(true));
Return(TrueConstant());
break;
}
......@@ -446,12 +446,12 @@ void StringBuiltinsAssembler::GenerateStringRelationalComparison(
switch (mode) {
case RelationalComparisonMode::kLessThan:
case RelationalComparisonMode::kLessThanOrEqual:
Return(BooleanConstant(false));
Return(FalseConstant());
break;
case RelationalComparisonMode::kGreaterThan:
case RelationalComparisonMode::kGreaterThanOrEqual:
Return(BooleanConstant(true));
Return(TrueConstant());
break;
}
}
......@@ -2333,7 +2333,7 @@ TF_BUILTIN(StringIteratorPrototypeNext, StringBuiltinsAssembler) {
VARIABLE(var_done, MachineRepresentation::kTagged);
var_value.Bind(UndefinedConstant());
var_done.Bind(BooleanConstant(true));
var_done.Bind(TrueConstant());
Label throw_bad_receiver(this), next_codepoint(this), return_result(this);
......@@ -2361,7 +2361,7 @@ TF_BUILTIN(StringIteratorPrototypeNext, StringBuiltinsAssembler) {
Node* length = LoadStringLength(value);
StoreObjectFieldNoWriteBarrier(iterator, JSStringIterator::kNextIndexOffset,
SmiAdd(position, length));
var_done.Bind(BooleanConstant(false));
var_done.Bind(FalseConstant());
Goto(&return_result);
}
......
......@@ -357,7 +357,7 @@ TF_BUILTIN(TypedArrayConstructByLength, TypedArrayBuiltinsAssembler) {
CSA_ASSERT(this, IsJSTypedArray(holder));
CSA_ASSERT(this, TaggedIsPositiveSmi(element_size));
Node* initialize = BooleanConstant(true);
Node* initialize = TrueConstant();
Label invalid_length(this);
......@@ -560,7 +560,7 @@ TF_BUILTIN(TypedArrayConstructByArrayLike, TypedArrayBuiltinsAssembler) {
CSA_ASSERT(this, TaggedIsSmi(element_size));
Node* context = Parameter(Descriptor::kContext);
Node* initialize = BooleanConstant(false);
Node* initialize = FalseConstant();
Label invalid_length(this), fill(this), fast_copy(this);
......
......@@ -1046,7 +1046,7 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(Node* value, Label* if_true,
Label if_smi(this), if_notsmi(this), if_heapnumber(this, Label::kDeferred),
if_bigint(this, Label::kDeferred);
// Rule out false {value}.
GotoIf(WordEqual(value, BooleanConstant(false)), if_false);
GotoIf(WordEqual(value, FalseConstant()), if_false);
// Check if {value} is a Smi or a HeapObject.
Branch(TaggedIsSmi(value), &if_smi, &if_notsmi);
......@@ -1090,7 +1090,7 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(Node* value, Label* if_true,
Node* result =
CallRuntime(Runtime::kBigIntToBoolean, NoContextConstant(), value);
CSA_ASSERT(this, IsBoolean(result));
Branch(WordEqual(result, BooleanConstant(true)), if_true, if_false);
Branch(WordEqual(result, TrueConstant()), if_true, if_false);
}
}
}
......@@ -8669,13 +8669,13 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
BIND(&return_true);
{
result.Bind(BooleanConstant(true));
result.Bind(TrueConstant());
Goto(&end);
}
BIND(&return_false);
{
result.Bind(BooleanConstant(false));
result.Bind(FalseConstant());
Goto(&end);
}
......@@ -9600,13 +9600,13 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context,
BIND(&return_true);
{
result.Bind(BooleanConstant(true));
result.Bind(TrueConstant());
Goto(&end);
}
BIND(&return_false);
{
result.Bind(BooleanConstant(false));
result.Bind(FalseConstant());
Goto(&end);
}
......
This diff is collapsed.
......@@ -142,13 +142,13 @@ Node* IntrinsicsGenerator::IsInstanceType(Node* input, int type) {
__ BIND(&return_true);
{
return_value.Bind(__ BooleanConstant(true));
return_value.Bind(__ TrueConstant());
__ Goto(&end);
}
__ BIND(&return_false);
{
return_value.Bind(__ BooleanConstant(false));
return_value.Bind(__ FalseConstant());
__ Goto(&end);
}
......@@ -175,13 +175,13 @@ Node* IntrinsicsGenerator::IsJSReceiver(Node* input, Node* arg_count,
__ BIND(&return_true);
{
return_value.Bind(__ BooleanConstant(true));
return_value.Bind(__ TrueConstant());
__ Goto(&end);
}
__ BIND(&return_false);
{
return_value.Bind(__ BooleanConstant(false));
return_value.Bind(__ FalseConstant());
__ Goto(&end);
}
......@@ -236,13 +236,13 @@ Node* IntrinsicsGenerator::IsSmi(Node* input, Node* arg_count, Node* context) {
__ Branch(__ TaggedIsSmi(arg), &if_smi, &if_not_smi);
__ BIND(&if_smi);
{
return_value.Bind(__ BooleanConstant(true));
return_value.Bind(__ TrueConstant());
__ Goto(&end);
}
__ BIND(&if_not_smi);
{
return_value.Bind(__ BooleanConstant(false));
return_value.Bind(__ FalseConstant());
__ Goto(&end);
}
......
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