Revision: 24859
Author:   [email protected]
Date:     Fri Oct 24 07:34:20 2014 UTC
Log:      X87: Classes: implement 'new super'.

port r24825.

original commit message:

  Classes: implement 'new super'.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/663233003

Patch from Chunyang Dai <[email protected]>.
https://code.google.com/p/v8/source/detail?r=24859

Modified:
 /branches/bleeding_edge/src/x87/full-codegen-x87.cc

=======================================
--- /branches/bleeding_edge/src/x87/full-codegen-x87.cc Wed Oct 22 18:16:35 2014 UTC +++ /branches/bleeding_edge/src/x87/full-codegen-x87.cc Fri Oct 24 07:34:20 2014 UTC
@@ -2852,6 +2852,13 @@
   // Do the runtime call.
   __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
 }
+
+
+void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) {
+  DCHECK(super_ref != NULL);
+  __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
+  __ CallRuntime(Runtime::kGetPrototype, 1);
+}


 void FullCodeGenerator::VisitCall(Call* expr) {
@@ -2964,9 +2971,7 @@
     }
   } else if (call_type == Call::SUPER_CALL) {
     SuperReference* super_ref = callee->AsSuperReference();
-    DCHECK(super_ref != NULL);
-    __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
-    __ CallRuntime(Runtime::kGetPrototype, 1);
+    EmitLoadSuperConstructor(super_ref);
     __ push(result_register());
     VisitForStackValue(super_ref->this_var());
     EmitCall(expr, CallICState::METHOD);
@@ -2997,7 +3002,12 @@
   // Push constructor on the stack.  If it's not a function it's used as
   // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
   // ignored.
-  VisitForStackValue(expr->expression());
+  if (expr->expression()->IsSuperReference()) {
+    EmitLoadSuperConstructor(expr->expression()->AsSuperReference());
+    __ push(result_register());
+  } else {
+    VisitForStackValue(expr->expression());
+  }

   // Push the arguments ("left-to-right") on the stack.
   ZoneList<Expression*>* args = expr->arguments();

--
--
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