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

Unified Diff: src/hydrogen.cc

Issue 1373743002: [crankshaft] Add support for %_ToString. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/hydrogen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)));
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698