MIPS: Implement the new semantics for 'super(...)'.
authorbalazs.kilvady@imgtec.com <balazs.kilvady@imgtec.com>
Fri, 17 Oct 2014 11:30:13 +0000 (11:30 +0000)
committerbalazs.kilvady@imgtec.com <balazs.kilvady@imgtec.com>
Fri, 17 Oct 2014 11:30:13 +0000 (11:30 +0000)
Port r24683 (b1533f6)

Original commit message:
Per the latest ES6 draft, super(...) translates into a call
to function's prototype.

BUG=v8:3330
LOG=N
R=dusan.milosavljevic@imgtec.com

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

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

src/mips/full-codegen-mips.cc
src/mips64/full-codegen-mips64.cc

index 6f7166b..9f26d4c 100644 (file)
@@ -3049,6 +3049,15 @@ void FullCodeGenerator::VisitCall(Call* expr) {
         EmitKeyedCallWithLoadIC(expr, property->key());
       }
     }
+  } else if (call_type == Call::SUPER_CALL) {
+    SuperReference* super_ref = callee->AsSuperReference();
+    DCHECK(super_ref != NULL);
+    __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
+    __ Push(a0);
+    __ CallRuntime(Runtime::kGetPrototype, 1);
+    __ Push(result_register());
+    VisitForStackValue(super_ref->this_var());
+    EmitCall(expr, CallICState::METHOD);
   } else {
     DCHECK(call_type == Call::OTHER_CALL);
     // Call to an arbitrary expression not handled specially above.
index 79eec06..1a76c52 100644 (file)
@@ -3048,6 +3048,15 @@ void FullCodeGenerator::VisitCall(Call* expr) {
         EmitKeyedCallWithLoadIC(expr, property->key());
       }
     }
+  } else if (call_type == Call::SUPER_CALL) {
+    SuperReference* super_ref = callee->AsSuperReference();
+    DCHECK(super_ref != NULL);
+    __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
+    __ Push(a0);
+    __ CallRuntime(Runtime::kGetPrototype, 1);
+    __ Push(result_register());
+    VisitForStackValue(super_ref->this_var());
+    EmitCall(expr, CallICState::METHOD);
   } else {
     DCHECK(call_type == Call::OTHER_CALL);
     // Call to an arbitrary expression not handled specially above.