From d7ad5e2ac380c55fa48739440022dfcdc346ccf9 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Mon, 10 Aug 2015 05:07:11 -0700 Subject: [PATCH] [crankshaft] Properly optimize %_ToObject. R=yangguo@chromium.org BUG=chromium:516423 LOG=n Review URL: https://codereview.chromium.org/1277153003 Cr-Commit-Position: refs/heads/master@{#30088} --- src/hydrogen.cc | 9 +++++++++ src/hydrogen.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 794a38b8e4..404cfa7ee1 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -12100,6 +12100,15 @@ void HOptimizedGraphBuilder::GenerateIsObject(CallRuntime* call) { } +void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) { + DCHECK_EQ(1, call->arguments()->length()); + CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); + HValue* value = Pop(); + HValue* result = BuildToObject(value); + return ast_context()->ReturnValue(result); +} + + void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) { DCHECK(call->arguments()->length() == 1); CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); diff --git a/src/hydrogen.h b/src/hydrogen.h index 04db7148ac..0790d74a25 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -2197,6 +2197,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { F(TwoByteSeqStringSetChar) \ F(ObjectEquals) \ F(IsObject) \ + F(ToObject) \ F(IsFunction) \ F(IsUndetectableObject) \ F(IsSpecObject) \