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