Improve constructor inlining backout.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 1 Mar 2012 11:50:11 +0000 (11:50 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 1 Mar 2012 11:50:11 +0000 (11:50 +0000)
This improves the generated hydrogen graph by also removing the obsolete
HCheckFunction instruction if we backout of inlining constructors.

R=danno@chromium.org

Review URL: https://chromiumcodereview.appspot.com/9537004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10884 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen.cc

index e593857f6fecbbdb05966babd8909e0ccd16258d..33fa0f4806a556e5f33c8f8735d7b56eb2f2c556 100644 (file)
@@ -5886,7 +5886,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));
 
     // Force completion of inobject slack tracking before generating
     // allocation code to finalize instance size.
@@ -5909,6 +5910,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));