Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 495773002: Codegen for super.x and super[x] (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 04fb4830c7ee8297e4cfa226d51327e29bb4eb62..bfae9a83fd656127dbf21e5b8d9806966539a96d 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -1278,6 +1278,34 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
}
+void FullCodeGenerator::VisitSuperReference(SuperReference* expr) {
+ Comment cnmt(masm_, "[ SuperReference ");
+
+ Label super_lookup_failure;
+ __ mov(LoadIC::ReceiverRegister(),
+ Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
+
+ Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
+ __ mov(LoadIC::NameRegister(), home_object_symbol);
+
+ CallLoadIC(NOT_CONTEXTUAL,
+ expr->HomeObjectFeedbackId());
+
+ __ cmp(eax, isolate()->factory()->undefined_value());
+ __ j(equal, &super_lookup_failure);
+ __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset));
+ __ mov(eax, FieldOperand(eax, Map::kPrototypeOffset));
+ Label done;
+ __ jmp(&done);
+ __ bind(&super_lookup_failure);
+ __ push(Immediate(isolate()->factory()->empty_string()));
+ __ CallRuntime(Runtime::kThrowReferenceError, 1);
+ __ bind(&done);
+ context()->Plug(eax);
+}
+
+
+
void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
TypeofState typeof_state,
Label* slow) {
@@ -2220,6 +2248,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position());
Literal* key = prop->key()->AsLiteral();
DCHECK(!key->value()->IsSmi());
+
__ mov(LoadIC::NameRegister(), Immediate(key->value()));
if (FLAG_vector_ics) {
__ mov(LoadIC::SlotRegister(),
@@ -2568,8 +2597,15 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
EmitNamedPropertyLoad(callee->AsProperty());
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
// Push the target function under the receiver.
- __ push(Operand(esp, 0));
- __ mov(Operand(esp, kPointerSize), eax);
+ if (callee->AsProperty()->IsSuperAccess()) {
+ __ mov(Operand(esp, 0), eax);
+ SuperReference* super_ref =
+ callee->AsProperty()->obj()->AsSuperReference();
+ VisitForStackValue(super_ref->this_var());
+ } else {
+ __ push(Operand(esp, 0));
+ __ mov(Operand(esp, kPointerSize), eax);
+ }
}
EmitCall(expr, call_type);
@@ -2592,8 +2628,14 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
// Push the target function under the receiver.
- __ push(Operand(esp, 0));
- __ mov(Operand(esp, kPointerSize), eax);
+ if (callee->AsProperty()->IsSuperAccess()) {
+ __ mov(Operand(esp, 0), eax);
+ SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference();
+ VisitForStackValue(super_ref->this_var());
+ } else {
+ __ push(Operand(esp, 0));
+ __ mov(Operand(esp, kPointerSize), eax);
+ }
EmitCall(expr, CallIC::METHOD);
}
« no previous file with comments | « src/full-codegen.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698