Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: src/code-stub-assembler.cc

Issue 2302923002: [stubs] Port ToName stub to TurboFan. (Closed)
Patch Set: Addressed nits. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 0f2e528eb6bebe3a80a75866f7fb414300e2d49a..a9394f6b7f2ea8c43ee4e923750084184219e3cc 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -2381,6 +2381,55 @@ Node* CodeStubAssembler::StringToNumber(Node* context, Node* input) {
return var_result.value();
}
+Node* CodeStubAssembler::ToName(Node* context, Node* value) {
+ typedef CodeStubAssembler::Label Label;
+ typedef CodeStubAssembler::Variable Variable;
+
+ Label end(this);
+ Variable var_result(this, MachineRepresentation::kTagged);
+
+ Label is_number(this);
+ GotoIf(WordIsSmi(value), &is_number);
+
+ Label not_name(this);
+ Node* value_instance_type = LoadInstanceType(value);
+ STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
+ GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)),
+ &not_name);
+
+ var_result.Bind(value);
+ Goto(&end);
+
+ Bind(&is_number);
+ {
+ Callable callable = CodeFactory::NumberToString(isolate());
+ var_result.Bind(CallStub(callable, context, value));
+ Goto(&end);
+ }
+
+ Bind(&not_name);
+ {
+ GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)),
+ &is_number);
+
+ Label not_oddball(this);
+ GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)),
+ &not_oddball);
+
+ var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset));
+ Goto(&end);
+
+ Bind(&not_oddball);
+ {
+ var_result.Bind(CallRuntime(Runtime::kToName, context, value));
+ Goto(&end);
+ }
+ }
+
+ Bind(&end);
+ return var_result.value();
+}
+
Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
uint32_t mask) {
return Word32Shr(Word32And(word32, Int32Constant(mask)),
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698