Commit 742a61fd authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Add CSA types to ToName

Change-Id: I9d418605b6fe2180f9812fb529af89fa05e7ab8b
Reviewed-on: https://chromium-review.googlesource.com/984352Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52285}
parent 347b6960
......@@ -5602,25 +5602,26 @@ TNode<String> CodeStubAssembler::NumberToString(TNode<Number> input) {
return result.value();
}
Node* CodeStubAssembler::ToName(Node* context, Node* value) {
TNode<Name> CodeStubAssembler::ToName(SloppyTNode<Context> context,
SloppyTNode<Object> value) {
Label end(this);
VARIABLE(var_result, MachineRepresentation::kTagged);
TVARIABLE(Name, var_result);
Label is_number(this);
GotoIf(TaggedIsSmi(value), &is_number);
Label not_name(this);
Node* value_instance_type = LoadInstanceType(value);
TNode<Int32T> value_instance_type = LoadInstanceType(CAST(value));
STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)),
&not_name);
var_result.Bind(value);
var_result = CAST(value);
Goto(&end);
BIND(&is_number);
{
var_result.Bind(CallBuiltin(Builtins::kNumberToString, context, value));
var_result = CAST(CallBuiltin(Builtins::kNumberToString, context, value));
Goto(&end);
}
......@@ -5633,18 +5634,17 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) {
GotoIfNot(InstanceTypeEqual(value_instance_type, ODDBALL_TYPE),
&not_oddball);
var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset));
var_result = LoadObjectField<String>(CAST(value), Oddball::kToStringOffset);
Goto(&end);
BIND(&not_oddball);
{
var_result.Bind(CallRuntime(Runtime::kToName, context, value));
var_result = CAST(CallRuntime(Runtime::kToName, context, value));
Goto(&end);
}
}
BIND(&end);
CSA_ASSERT(this, IsName(var_result.value()));
return var_result.value();
}
......@@ -10046,7 +10046,7 @@ TNode<Oddball> CodeStubAssembler::HasProperty(SloppyTNode<HeapObject> object,
BIND(&if_proxy);
{
TNode<Name> name = CAST(ToName(context, key));
TNode<Name> name = ToName(context, key);
switch (mode) {
case kHasProperty:
GotoIf(IsPrivateSymbol(name), &return_false);
......
......@@ -1283,7 +1283,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Convert a Number to a String.
TNode<String> NumberToString(TNode<Number> input);
// Convert an object to a name.
Node* ToName(Node* context, Node* input);
TNode<Name> ToName(SloppyTNode<Context> context, SloppyTNode<Object> value);
// Convert a Non-Number object to a Number.
TNode<Number> NonNumberToNumber(
SloppyTNode<Context> context, SloppyTNode<HeapObject> input,
......
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