Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 87f8ce9541495a9623642ccd0fd3e8e3eb5d8b72..d2a617f7a809a3279daaa1a82f71b6163d885e9a 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8,6 +8,7 @@ |
#include "src/allocation-site-scopes.h" |
#include "src/ast-numbering.h" |
+#include "src/code-factory.h" |
#include "src/full-codegen/full-codegen.h" |
#include "src/hydrogen-bce.h" |
#include "src/hydrogen-bch.h" |
@@ -12224,6 +12225,24 @@ 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 { |
+ 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::GenerateIsJSProxy(CallRuntime* call) { |
DCHECK(call->arguments()->length() == 1); |
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |