Reviewers: mvstanton,

Message:
PTAL

Description:
If CallNew targets a constant global, set its state to monomorphic

BUG=

Please review this at https://codereview.chromium.org/1023103003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -4 lines):
  M src/hydrogen.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 6f349b79c4a1eac2e3b9ec332f49d63bd93071e7..7eec80e11049b14c7d89b2ed465c890630978cb8 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9105,10 +9105,10 @@ bool HOptimizedGraphBuilder::TryHandleArrayCallNew(CallNew* expr,
     return false;
   }

-  BuildArrayCall(expr,
-                 expr->arguments()->length(),
-                 function,
-                 expr->allocation_site());
+  Handle<AllocationSite> site = expr->allocation_site();
+  if (site.is_null()) return false;
+
+  BuildArrayCall(expr, expr->arguments()->length(), function, site);
   return true;
 }

@@ -9442,6 +9442,13 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
   HValue* function = Top();
   CHECK_ALIVE(VisitExpressions(expr->arguments()));

+  if (function->IsConstant() &&
+      HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
+    Handle<Object> constant = HConstant::cast(function)->handle(isolate());
+    expr->set_target(Handle<JSFunction>::cast(constant));
+    expr->set_is_monomorphic(true);
+  }
+
   if (FLAG_inline_construct &&
       expr->IsMonomorphic() &&
       IsAllocationInlineable(expr->target())) {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to