Commit 875fe59b authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[turbofan] rename GraphAssembler::ToNumber

Rename ToNumber to PlainPrimitiveToNumber since it must only be used on
primitives, as we assume that it never throws and has no side effects.

Change-Id: I78880545e58e46d38712f5ab75fe0b627ad178c5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2002394
Auto-Submit: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65796}
parent 326608fe
...@@ -4540,7 +4540,7 @@ Node* EffectControlLinearizer::SmiShiftBitsConstant() { ...@@ -4540,7 +4540,7 @@ Node* EffectControlLinearizer::SmiShiftBitsConstant() {
Node* EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node) { Node* EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node) {
Node* value = node->InputAt(0); Node* value = node->InputAt(0);
return __ ToNumber(TNode<Object>::UncheckedCast(value)); return __ PlainPrimitiveToNumber(TNode<Object>::UncheckedCast(value));
} }
Node* EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node) { Node* EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node) {
...@@ -4555,7 +4555,8 @@ Node* EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node) { ...@@ -4555,7 +4555,8 @@ Node* EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node) {
__ Goto(&done, ChangeSmiToInt32(value)); __ Goto(&done, ChangeSmiToInt32(value));
__ Bind(&if_not_smi); __ Bind(&if_not_smi);
Node* to_number = __ ToNumber(TNode<Object>::UncheckedCast(value)); Node* to_number =
__ PlainPrimitiveToNumber(TNode<Object>::UncheckedCast(value));
Node* check1 = ObjectIsSmi(to_number); Node* check1 = ObjectIsSmi(to_number);
__ GotoIf(check1, &if_to_number_smi); __ GotoIf(check1, &if_to_number_smi);
...@@ -4582,7 +4583,8 @@ Node* EffectControlLinearizer::LowerPlainPrimitiveToFloat64(Node* node) { ...@@ -4582,7 +4583,8 @@ Node* EffectControlLinearizer::LowerPlainPrimitiveToFloat64(Node* node) {
__ Goto(&done, __ ChangeInt32ToFloat64(from_smi)); __ Goto(&done, __ ChangeInt32ToFloat64(from_smi));
__ Bind(&if_not_smi); __ Bind(&if_not_smi);
Node* to_number = __ ToNumber(TNode<Object>::UncheckedCast(value)); Node* to_number =
__ PlainPrimitiveToNumber(TNode<Object>::UncheckedCast(value));
Node* check1 = ObjectIsSmi(to_number); Node* check1 = ObjectIsSmi(to_number);
__ GotoIf(check1, &if_to_number_smi); __ GotoIf(check1, &if_to_number_smi);
......
...@@ -695,8 +695,8 @@ Node* GraphAssembler::UnsafePointerAdd(Node* base, Node* external) { ...@@ -695,8 +695,8 @@ Node* GraphAssembler::UnsafePointerAdd(Node* base, Node* external) {
effect(), control())); effect(), control()));
} }
TNode<Number> JSGraphAssembler::ToNumber(TNode<Object> value) { TNode<Number> JSGraphAssembler::PlainPrimitiveToNumber(TNode<Object> value) {
return AddNode<Number>(graph()->NewNode(ToNumberOperator(), return AddNode<Number>(graph()->NewNode(PlainPrimitiveToNumberOperator(),
ToNumberBuiltinConstant(), value, ToNumberBuiltinConstant(), value,
NoContextConstant(), effect())); NoContextConstant(), effect()));
} }
...@@ -874,7 +874,7 @@ void GraphAssembler::InitializeEffectControl(Node* effect, Node* control) { ...@@ -874,7 +874,7 @@ void GraphAssembler::InitializeEffectControl(Node* effect, Node* control) {
control_ = control; control_ = control;
} }
Operator const* JSGraphAssembler::ToNumberOperator() { Operator const* JSGraphAssembler::PlainPrimitiveToNumberOperator() {
if (!to_number_operator_.is_set()) { if (!to_number_operator_.is_set()) {
Callable callable = Builtins::CallableFor(isolate(), Builtins::kToNumber); Callable callable = Builtins::CallableFor(isolate(), Builtins::kToNumber);
CallDescriptor::Flags flags = CallDescriptor::kNoFlags; CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
......
...@@ -703,7 +703,7 @@ class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler { ...@@ -703,7 +703,7 @@ class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler {
TNode<Object> value); TNode<Object> value);
TNode<Number> StringLength(TNode<String> string); TNode<Number> StringLength(TNode<String> string);
TNode<Boolean> ReferenceEqual(TNode<Object> lhs, TNode<Object> rhs); TNode<Boolean> ReferenceEqual(TNode<Object> lhs, TNode<Object> rhs);
TNode<Number> ToNumber(TNode<Object> value); TNode<Number> PlainPrimitiveToNumber(TNode<Object> value);
TNode<Number> NumberMin(TNode<Number> lhs, TNode<Number> rhs); TNode<Number> NumberMin(TNode<Number> lhs, TNode<Number> rhs);
TNode<Number> NumberMax(TNode<Number> lhs, TNode<Number> rhs); TNode<Number> NumberMax(TNode<Number> lhs, TNode<Number> rhs);
TNode<Boolean> NumberLessThan(TNode<Number> lhs, TNode<Number> rhs); TNode<Boolean> NumberLessThan(TNode<Number> lhs, TNode<Number> rhs);
...@@ -731,7 +731,7 @@ class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler { ...@@ -731,7 +731,7 @@ class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler {
} }
protected: protected:
Operator const* ToNumberOperator(); Operator const* PlainPrimitiveToNumberOperator();
private: private:
JSGraph* jsgraph_; JSGraph* jsgraph_;
......
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