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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1622493002: [stubs] Introduce ToNameStub to implement %_ToName. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix BuildNumberToString type in Crankshaft. Created 4 years, 11 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/crankshaft/hydrogen.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 0fa2df566d556ec94ca0a49e1b13b5dc1b0cc4be..36107aca06056d03b201e4cfb7da4355be319692 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -12291,6 +12291,30 @@ void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) {
}
+void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) {
+ DCHECK_EQ(1, call->arguments()->length());
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
+ HValue* input = Pop();
+ if (input->type().IsSmi()) {
+ HValue* result = BuildNumberToString(input, Type::SignedSmall(zone()));
+ return ast_context()->ReturnValue(result);
+ } else if (input->type().IsTaggedNumber()) {
+ HValue* result = BuildNumberToString(input, Type::Number(zone()));
+ return ast_context()->ReturnValue(result);
+ } else if (input->type().IsString()) {
+ return ast_context()->ReturnValue(input);
+ } else {
+ Callable callable = CodeFactory::ToName(isolate());
+ HValue* stub = Add<HConstant>(callable.code());
+ HValue* values[] = {context(), input};
+ HInstruction* result =
+ New<HCallWithDescriptor>(stub, 0, callable.descriptor(),
+ Vector<HValue*>(values, arraysize(values)));
+ return ast_context()->ReturnInstruction(result, call->id());
+ }
+}
+
+
void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) {
DCHECK_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
@@ -12303,11 +12327,11 @@ void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) {
DCHECK_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
- Callable callable = CodeFactory::ToString(isolate());
HValue* input = Pop();
if (input->type().IsString()) {
return ast_context()->ReturnValue(input);
} else {
+ Callable callable = CodeFactory::ToString(isolate());
HValue* stub = Add<HConstant>(callable.code());
HValue* values[] = {context(), input};
HInstruction* result =
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698