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

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

Issue 223823002: Revert r20474 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 TypeFeedbackId ast_id) { 2625 TypeFeedbackId ast_id) {
2626 ic_total_count_++; 2626 ic_total_count_++;
2627 // All calls must have a predictable size in full-codegen code to ensure that 2627 // All calls must have a predictable size in full-codegen code to ensure that
2628 // the debugger can patch them correctly. 2628 // the debugger can patch them correctly.
2629 __ Call(code, RelocInfo::CODE_TARGET, ast_id, al, 2629 __ Call(code, RelocInfo::CODE_TARGET, ast_id, al,
2630 NEVER_INLINE_TARGET_ADDRESS); 2630 NEVER_INLINE_TARGET_ADDRESS);
2631 } 2631 }
2632 2632
2633 2633
2634 // Code common for calls using the IC. 2634 // Code common for calls using the IC.
2635 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2635 void FullCodeGenerator::EmitCallWithIC(Call* expr) {
2636 Expression* callee = expr->expression(); 2636 Expression* callee = expr->expression();
2637 ZoneList<Expression*>* args = expr->arguments();
2638 int arg_count = args->length();
2637 2639
2638 CallIC::CallType call_type = callee->IsVariableProxy() 2640 CallFunctionFlags flags;
2639 ? CallIC::FUNCTION
2640 : CallIC::METHOD;
2641
2642 // Get the target function. 2641 // Get the target function.
2643 if (call_type == CallIC::FUNCTION) { 2642 if (callee->IsVariableProxy()) {
2644 { StackValueContext context(this); 2643 { StackValueContext context(this);
2645 EmitVariableLoad(callee->AsVariableProxy()); 2644 EmitVariableLoad(callee->AsVariableProxy());
2646 PrepareForBailout(callee, NO_REGISTERS); 2645 PrepareForBailout(callee, NO_REGISTERS);
2647 } 2646 }
2648 // Push undefined as receiver. This is patched in the method prologue if it 2647 // Push undefined as receiver. This is patched in the method prologue if it
2649 // is a sloppy mode method. 2648 // is a sloppy mode method.
2650 __ Push(isolate()->factory()->undefined_value()); 2649 __ Push(isolate()->factory()->undefined_value());
2650 flags = NO_CALL_FUNCTION_FLAGS;
2651 } else { 2651 } else {
2652 // Load the function from the receiver. 2652 // Load the function from the receiver.
2653 ASSERT(callee->IsProperty()); 2653 ASSERT(callee->IsProperty());
2654 __ ldr(r0, MemOperand(sp, 0)); 2654 __ ldr(r0, MemOperand(sp, 0));
2655 EmitNamedPropertyLoad(callee->AsProperty()); 2655 EmitNamedPropertyLoad(callee->AsProperty());
2656 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2656 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2657 // Push the target function under the receiver. 2657 // Push the target function under the receiver.
2658 __ ldr(ip, MemOperand(sp, 0)); 2658 __ ldr(ip, MemOperand(sp, 0));
2659 __ push(ip); 2659 __ push(ip);
2660 __ str(r0, MemOperand(sp, kPointerSize)); 2660 __ str(r0, MemOperand(sp, kPointerSize));
2661 flags = CALL_AS_METHOD;
2661 } 2662 }
2662 2663
2663 EmitCall(expr, call_type); 2664 // Load the arguments.
2665 { PreservePositionScope scope(masm()->positions_recorder());
2666 for (int i = 0; i < arg_count; i++) {
2667 VisitForStackValue(args->at(i));
2668 }
2669 }
2670
2671 // Record source position for debugger.
2672 SetSourcePosition(expr->position());
2673 CallFunctionStub stub(arg_count, flags);
2674 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2675 __ CallStub(&stub);
2676
2677 RecordJSReturnSite(expr);
2678
2679 // Restore context register.
2680 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2681
2682 context()->DropAndPlug(1, r0);
2664 } 2683 }
2665 2684
2666 2685
2667 // Code common for calls using the IC. 2686 // Code common for calls using the IC.
2668 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2687 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
2669 Expression* key) { 2688 Expression* key) {
2670 // Load the key. 2689 // Load the key.
2671 VisitForAccumulatorValue(key); 2690 VisitForAccumulatorValue(key);
2672 2691
2673 Expression* callee = expr->expression(); 2692 Expression* callee = expr->expression();
2693 ZoneList<Expression*>* args = expr->arguments();
2694 int arg_count = args->length();
2674 2695
2675 // Load the function from the receiver. 2696 // Load the function from the receiver.
2676 ASSERT(callee->IsProperty()); 2697 ASSERT(callee->IsProperty());
2677 __ ldr(r1, MemOperand(sp, 0)); 2698 __ ldr(r1, MemOperand(sp, 0));
2678 EmitKeyedPropertyLoad(callee->AsProperty()); 2699 EmitKeyedPropertyLoad(callee->AsProperty());
2679 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2700 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2680 2701
2681 // Push the target function under the receiver. 2702 // Push the target function under the receiver.
2682 __ ldr(ip, MemOperand(sp, 0)); 2703 __ ldr(ip, MemOperand(sp, 0));
2683 __ push(ip); 2704 __ push(ip);
2684 __ str(r0, MemOperand(sp, kPointerSize)); 2705 __ str(r0, MemOperand(sp, kPointerSize));
2685 2706
2686 EmitCall(expr, CallIC::METHOD); 2707 { PreservePositionScope scope(masm()->positions_recorder());
2708 for (int i = 0; i < arg_count; i++) {
2709 VisitForStackValue(args->at(i));
2710 }
2711 }
2712
2713 // Record source position for debugger.
2714 SetSourcePosition(expr->position());
2715 CallFunctionStub stub(arg_count, CALL_AS_METHOD);
2716 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2717 __ CallStub(&stub);
2718
2719 RecordJSReturnSite(expr);
2720 // Restore context register.
2721 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2722
2723 context()->DropAndPlug(1, r0);
2687 } 2724 }
2688 2725
2689 2726
2690 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { 2727 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
2691 // Load the arguments. 2728 // Code common for calls using the call stub.
2692 ZoneList<Expression*>* args = expr->arguments(); 2729 ZoneList<Expression*>* args = expr->arguments();
2693 int arg_count = args->length(); 2730 int arg_count = args->length();
2694 { PreservePositionScope scope(masm()->positions_recorder()); 2731 { PreservePositionScope scope(masm()->positions_recorder());
2695 for (int i = 0; i < arg_count; i++) { 2732 for (int i = 0; i < arg_count; i++) {
2696 VisitForStackValue(args->at(i)); 2733 VisitForStackValue(args->at(i));
2697 } 2734 }
2698 } 2735 }
2736 // Record source position for debugger.
2737 SetSourcePosition(expr->position());
2699 2738
2700 // Record source position of the IC call.
2701 SetSourcePosition(expr->position());
2702 Handle<Code> ic = CallIC::initialize_stub(
2703 isolate(), arg_count, call_type);
2704 Handle<Object> uninitialized = 2739 Handle<Object> uninitialized =
2705 TypeFeedbackInfo::UninitializedSentinel(isolate()); 2740 TypeFeedbackInfo::UninitializedSentinel(isolate());
2706 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); 2741 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
2707 __ Move(r2, FeedbackVector()); 2742 __ Move(r2, FeedbackVector());
2708 __ mov(r3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); 2743 __ mov(r3, Operand(Smi::FromInt(expr->CallFeedbackSlot())));
2744
2745 // Record call targets in unoptimized code.
2746 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
2709 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2747 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2710 // Don't assign a type feedback id to the IC, since type feedback is provided 2748 __ CallStub(&stub);
2711 // by the vector above.
2712 CallIC(ic);
2713
2714 RecordJSReturnSite(expr); 2749 RecordJSReturnSite(expr);
2715 // Restore context register. 2750 // Restore context register.
2716 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2751 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2717 context()->DropAndPlug(1, r0); 2752 context()->DropAndPlug(1, r0);
2718 } 2753 }
2719 2754
2720 2755
2721 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2756 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
2722 // r4: copy of the first argument or undefined if it doesn't exist. 2757 // r4: copy of the first argument or undefined if it doesn't exist.
2723 if (arg_count > 0) { 2758 if (arg_count > 0) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 // Record source position for debugger. 2821 // Record source position for debugger.
2787 SetSourcePosition(expr->position()); 2822 SetSourcePosition(expr->position());
2788 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); 2823 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS);
2789 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2824 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2790 __ CallStub(&stub); 2825 __ CallStub(&stub);
2791 RecordJSReturnSite(expr); 2826 RecordJSReturnSite(expr);
2792 // Restore context register. 2827 // Restore context register.
2793 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2828 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2794 context()->DropAndPlug(1, r0); 2829 context()->DropAndPlug(1, r0);
2795 } else if (call_type == Call::GLOBAL_CALL) { 2830 } else if (call_type == Call::GLOBAL_CALL) {
2796 EmitCallWithLoadIC(expr); 2831 EmitCallWithIC(expr);
2797 2832
2798 } else if (call_type == Call::LOOKUP_SLOT_CALL) { 2833 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2799 // Call to a lookup slot (dynamically introduced variable). 2834 // Call to a lookup slot (dynamically introduced variable).
2800 VariableProxy* proxy = callee->AsVariableProxy(); 2835 VariableProxy* proxy = callee->AsVariableProxy();
2801 Label slow, done; 2836 Label slow, done;
2802 2837
2803 { PreservePositionScope scope(masm()->positions_recorder()); 2838 { PreservePositionScope scope(masm()->positions_recorder());
2804 // Generate code for loading from variables potentially shadowed 2839 // Generate code for loading from variables potentially shadowed
2805 // by eval-introduced variables. 2840 // by eval-introduced variables.
2806 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); 2841 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done);
(...skipping 19 matching lines...) Expand all
2826 __ push(r0); 2861 __ push(r0);
2827 // The receiver is implicitly the global receiver. Indicate this 2862 // The receiver is implicitly the global receiver. Indicate this
2828 // by passing the hole to the call function stub. 2863 // by passing the hole to the call function stub.
2829 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2864 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2830 __ push(r1); 2865 __ push(r1);
2831 __ bind(&call); 2866 __ bind(&call);
2832 } 2867 }
2833 2868
2834 // The receiver is either the global receiver or an object found 2869 // The receiver is either the global receiver or an object found
2835 // by LoadContextSlot. 2870 // by LoadContextSlot.
2836 EmitCall(expr); 2871 EmitCallWithStub(expr);
2837 } else if (call_type == Call::PROPERTY_CALL) { 2872 } else if (call_type == Call::PROPERTY_CALL) {
2838 Property* property = callee->AsProperty(); 2873 Property* property = callee->AsProperty();
2839 { PreservePositionScope scope(masm()->positions_recorder()); 2874 { PreservePositionScope scope(masm()->positions_recorder());
2840 VisitForStackValue(property->obj()); 2875 VisitForStackValue(property->obj());
2841 } 2876 }
2842 if (property->key()->IsPropertyName()) { 2877 if (property->key()->IsPropertyName()) {
2843 EmitCallWithLoadIC(expr); 2878 EmitCallWithIC(expr);
2844 } else { 2879 } else {
2845 EmitKeyedCallWithLoadIC(expr, property->key()); 2880 EmitKeyedCallWithIC(expr, property->key());
2846 } 2881 }
2847 } else { 2882 } else {
2848 ASSERT(call_type == Call::OTHER_CALL); 2883 ASSERT(call_type == Call::OTHER_CALL);
2849 // Call to an arbitrary expression not handled specially above. 2884 // Call to an arbitrary expression not handled specially above.
2850 { PreservePositionScope scope(masm()->positions_recorder()); 2885 { PreservePositionScope scope(masm()->positions_recorder());
2851 VisitForStackValue(callee); 2886 VisitForStackValue(callee);
2852 } 2887 }
2853 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2888 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2854 __ push(r1); 2889 __ push(r1);
2855 // Emit function call. 2890 // Emit function call.
2856 EmitCall(expr); 2891 EmitCallWithStub(expr);
2857 } 2892 }
2858 2893
2859 #ifdef DEBUG 2894 #ifdef DEBUG
2860 // RecordJSReturnSite should have been called. 2895 // RecordJSReturnSite should have been called.
2861 ASSERT(expr->return_is_recorded_); 2896 ASSERT(expr->return_is_recorded_);
2862 #endif 2897 #endif
2863 } 2898 }
2864 2899
2865 2900
2866 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2901 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
(...skipping 29 matching lines...) Expand all
2896 if (FLAG_pretenuring_call_new) { 2931 if (FLAG_pretenuring_call_new) {
2897 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), 2932 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(),
2898 isolate()->factory()->NewAllocationSite()); 2933 isolate()->factory()->NewAllocationSite());
2899 ASSERT(expr->AllocationSiteFeedbackSlot() == 2934 ASSERT(expr->AllocationSiteFeedbackSlot() ==
2900 expr->CallNewFeedbackSlot() + 1); 2935 expr->CallNewFeedbackSlot() + 1);
2901 } 2936 }
2902 2937
2903 __ Move(r2, FeedbackVector()); 2938 __ Move(r2, FeedbackVector());
2904 __ mov(r3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); 2939 __ mov(r3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot())));
2905 2940
2906 CallConstructStub stub(RECORD_CONSTRUCTOR_TARGET); 2941 CallConstructStub stub(RECORD_CALL_TARGET);
2907 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); 2942 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
2908 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2943 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2909 context()->Plug(r0); 2944 context()->Plug(r0);
2910 } 2945 }
2911 2946
2912 2947
2913 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2948 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2914 ZoneList<Expression*>* args = expr->arguments(); 2949 ZoneList<Expression*>* args = expr->arguments();
2915 ASSERT(args->length() == 1); 2950 ASSERT(args->length() == 1);
2916 2951
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
4892 4927
4893 ASSERT(interrupt_address == 4928 ASSERT(interrupt_address ==
4894 isolate->builtins()->OsrAfterStackCheck()->entry()); 4929 isolate->builtins()->OsrAfterStackCheck()->entry());
4895 return OSR_AFTER_STACK_CHECK; 4930 return OSR_AFTER_STACK_CHECK;
4896 } 4931 }
4897 4932
4898 4933
4899 } } // namespace v8::internal 4934 } } // namespace v8::internal
4900 4935
4901 #endif // V8_TARGET_ARCH_ARM 4936 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698