Reviewers: danno,

Description:
Improve constructor inlining backout.

This improves the generated hydrogen graph by also removing the obsolete
HCheckFunction instruction if we backout of inlining constructors.

[email protected]


Please review this at https://chromiumcodereview.appspot.com/9537004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/hydrogen.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 6bf082d86c9da8dc0a924ebf4270f63fc5725c32..eb5fdf72f2341c89ca3cb51699717ada520fe1f0 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5888,7 +5888,8 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) {
     HValue* function = Top();
     CHECK_ALIVE(VisitExpressions(expr->arguments()));
     Handle<JSFunction> constructor = expr->target();
-    AddInstruction(new(zone()) HCheckFunction(function, constructor));
+    HValue* check = AddInstruction(
+        new(zone()) HCheckFunction(function, constructor));

     // Replace the constructor function with a newly allocated receiver.
HInstruction* receiver = new(zone()) HAllocateObject(context, constructor);
@@ -5905,6 +5906,7 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) {
// actually should do is emit HInvokeFunction on the constructor instead
     // of using HCallNew as a fallback.
     receiver->DeleteAndReplaceWith(NULL);
+    check->DeleteAndReplaceWith(NULL);
     environment()->SetExpressionStackAt(receiver_index, function);
     HInstruction* call = PreProcessCall(
         new(zone()) HCallNew(context, function, argument_count));


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to