| 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 =
|
|
|