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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 622523004: Support for super keyed loads where key is a name. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 if (FLAG_vector_ics) { 2293 if (FLAG_vector_ics) {
2294 __ mov(VectorLoadICDescriptor::SlotRegister(), 2294 __ mov(VectorLoadICDescriptor::SlotRegister(),
2295 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); 2295 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot())));
2296 CallIC(ic); 2296 CallIC(ic);
2297 } else { 2297 } else {
2298 CallIC(ic, prop->PropertyFeedbackId()); 2298 CallIC(ic, prop->PropertyFeedbackId());
2299 } 2299 }
2300 } 2300 }
2301 2301
2302 2302
2303 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2304 // Stack: receiver, home_object, key.
2305 SetSourcePosition(prop->position());
2306
2307 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2308 }
2309
2310
2303 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2311 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2304 Token::Value op, 2312 Token::Value op,
2305 OverwriteMode mode, 2313 OverwriteMode mode,
2306 Expression* left, 2314 Expression* left,
2307 Expression* right) { 2315 Expression* right) {
2308 // Do combined smi check of the operands. Left operand is on the 2316 // Do combined smi check of the operands. Left operand is on the
2309 // stack. Right operand is in eax. 2317 // stack. Right operand is in eax.
2310 Label smi_case, done, stub_call; 2318 Label smi_case, done, stub_call;
2311 __ pop(edx); 2319 __ pop(edx);
2312 __ mov(ecx, eax); 2320 __ mov(ecx, eax);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 EmitNamedPropertyLoad(expr); 2606 EmitNamedPropertyLoad(expr);
2599 } else { 2607 } else {
2600 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2608 VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
2601 EmitLoadHomeObject(expr->obj()->AsSuperReference()); 2609 EmitLoadHomeObject(expr->obj()->AsSuperReference());
2602 __ push(result_register()); 2610 __ push(result_register());
2603 EmitNamedSuperPropertyLoad(expr); 2611 EmitNamedSuperPropertyLoad(expr);
2604 } 2612 }
2605 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2613 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2606 context()->Plug(eax); 2614 context()->Plug(eax);
2607 } else { 2615 } else {
2608 VisitForStackValue(expr->obj()); 2616 if (!expr->IsSuperAccess()) {
2609 VisitForAccumulatorValue(expr->key()); 2617 VisitForStackValue(expr->obj());
2610 __ pop(LoadDescriptor::ReceiverRegister()); // Object. 2618 VisitForAccumulatorValue(expr->key());
2611 __ Move(LoadDescriptor::NameRegister(), result_register()); // Key. 2619 __ pop(LoadDescriptor::ReceiverRegister()); // Object.
2612 EmitKeyedPropertyLoad(expr); 2620 __ Move(LoadDescriptor::NameRegister(), result_register()); // Key.
2621 EmitKeyedPropertyLoad(expr);
2622 } else {
2623 VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
2624 EmitLoadHomeObject(expr->obj()->AsSuperReference());
2625 __ push(result_register());
2626 VisitForStackValue(expr->key());
2627 EmitKeyedSuperPropertyLoad(expr);
2628 }
2613 context()->Plug(eax); 2629 context()->Plug(eax);
2614 } 2630 }
2615 } 2631 }
2616 2632
2617 2633
2618 void FullCodeGenerator::CallIC(Handle<Code> code, 2634 void FullCodeGenerator::CallIC(Handle<Code> code,
2619 TypeFeedbackId ast_id) { 2635 TypeFeedbackId ast_id) {
2620 ic_total_count_++; 2636 ic_total_count_++;
2621 __ call(code, RelocInfo::CODE_TARGET, ast_id); 2637 __ call(code, RelocInfo::CODE_TARGET, ast_id);
2622 } 2638 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2721 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2706 2722
2707 // Push the target function under the receiver. 2723 // Push the target function under the receiver.
2708 __ push(Operand(esp, 0)); 2724 __ push(Operand(esp, 0));
2709 __ mov(Operand(esp, kPointerSize), eax); 2725 __ mov(Operand(esp, kPointerSize), eax);
2710 2726
2711 EmitCall(expr, CallICState::METHOD); 2727 EmitCall(expr, CallICState::METHOD);
2712 } 2728 }
2713 2729
2714 2730
2731 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2732 Expression* callee = expr->expression();
2733 DCHECK(callee->IsProperty());
2734 Property* prop = callee->AsProperty();
2735 DCHECK(prop->IsSuperAccess());
2736
2737 SetSourcePosition(prop->position());
2738 // Load the function from the receiver.
2739 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference();
2740 EmitLoadHomeObject(super_ref);
2741 __ push(eax);
2742 VisitForAccumulatorValue(super_ref->this_var());
2743 __ push(eax);
2744 __ push(eax);
2745 __ push(Operand(esp, kPointerSize * 2));
2746 VisitForStackValue(prop->key());
2747 // Stack here:
2748 // - home_object
2749 // - this (receiver)
2750 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2751 // - home_object
2752 // - key
2753 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2754
2755 // Replace home_object with target function.
2756 __ mov(Operand(esp, kPointerSize), eax);
2757
2758 // Stack here:
2759 // - target function
2760 // - this (receiver)
2761 EmitCall(expr, CallICState::METHOD);
2762 }
2763
2764
2715 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2765 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
2716 // Load the arguments. 2766 // Load the arguments.
2717 ZoneList<Expression*>* args = expr->arguments(); 2767 ZoneList<Expression*>* args = expr->arguments();
2718 int arg_count = args->length(); 2768 int arg_count = args->length();
2719 { PreservePositionScope scope(masm()->positions_recorder()); 2769 { PreservePositionScope scope(masm()->positions_recorder());
2720 for (int i = 0; i < arg_count; i++) { 2770 for (int i = 0; i < arg_count; i++) {
2721 VisitForStackValue(args->at(i)); 2771 VisitForStackValue(args->at(i));
2722 } 2772 }
2723 } 2773 }
2724 2774
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 __ bind(&call); 2896 __ bind(&call);
2847 } 2897 }
2848 2898
2849 // The receiver is either the global receiver or an object found by 2899 // The receiver is either the global receiver or an object found by
2850 // LoadContextSlot. 2900 // LoadContextSlot.
2851 EmitCall(expr); 2901 EmitCall(expr);
2852 2902
2853 } else if (call_type == Call::PROPERTY_CALL) { 2903 } else if (call_type == Call::PROPERTY_CALL) {
2854 Property* property = callee->AsProperty(); 2904 Property* property = callee->AsProperty();
2855 bool is_named_call = property->key()->IsPropertyName(); 2905 bool is_named_call = property->key()->IsPropertyName();
2856 // super.x() is handled in EmitCallWithLoadIC. 2906 if (property->IsSuperAccess()) {
2857 if (property->IsSuperAccess() && is_named_call) { 2907 if (is_named_call) {
2858 EmitSuperCallWithLoadIC(expr); 2908 EmitSuperCallWithLoadIC(expr);
2909 } else {
2910 EmitKeyedSuperCallWithLoadIC(expr);
2911 }
2859 } else { 2912 } else {
2860 { 2913 {
2861 PreservePositionScope scope(masm()->positions_recorder()); 2914 PreservePositionScope scope(masm()->positions_recorder());
2862 VisitForStackValue(property->obj()); 2915 VisitForStackValue(property->obj());
2863 } 2916 }
2864 if (is_named_call) { 2917 if (is_named_call) {
2865 EmitCallWithLoadIC(expr); 2918 EmitCallWithLoadIC(expr);
2866 } else { 2919 } else {
2867 EmitKeyedCallWithLoadIC(expr, property->key()); 2920 EmitKeyedCallWithLoadIC(expr, property->key());
2868 } 2921 }
(...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after
4979 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5032 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4980 Assembler::target_address_at(call_target_address, 5033 Assembler::target_address_at(call_target_address,
4981 unoptimized_code)); 5034 unoptimized_code));
4982 return OSR_AFTER_STACK_CHECK; 5035 return OSR_AFTER_STACK_CHECK;
4983 } 5036 }
4984 5037
4985 5038
4986 } } // namespace v8::internal 5039 } } // namespace v8::internal
4987 5040
4988 #endif // V8_TARGET_ARCH_IA32 5041 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/runtime/runtime.h » ('j') | src/runtime/runtime-classes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698