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

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

Issue 131663003: Make the strict-mode calling convention for contextual calls the default one. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix arm port Created 6 years, 11 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/code-stubs-arm.cc ('k') | src/arm/ic-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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 138 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
139 139
140 #ifdef DEBUG 140 #ifdef DEBUG
141 if (strlen(FLAG_stop_at) > 0 && 141 if (strlen(FLAG_stop_at) > 0 &&
142 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 142 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
143 __ stop("stop-at"); 143 __ stop("stop-at");
144 } 144 }
145 #endif 145 #endif
146 146
147 // Strict mode functions and builtins need to replace the receiver 147 // Classic mode functions and builtins need to replace the receiver with the
148 // with undefined when called as functions (without an explicit 148 // global proxy when called as functions (without an explicit receiver
149 // receiver object). r5 is zero for method calls and non-zero for 149 // object).
150 // function calls. 150 if (info->is_classic_mode() && !info->is_native()) {
151 if (!info->is_classic_mode() || info->is_native()) { 151 Label ok;
152 __ cmp(r5, Operand::Zero()); 152 __ cmp(r5, Operand::Zero());
153 __ b(eq, &ok);
154
153 int receiver_offset = info->scope()->num_parameters() * kPointerSize; 155 int receiver_offset = info->scope()->num_parameters() * kPointerSize;
154 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 156 __ ldr(r2, MemOperand(sp, receiver_offset));
155 __ str(r2, MemOperand(sp, receiver_offset), ne); 157 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
158 __ b(ne, &ok);
159
160 __ ldr(r2, GlobalObjectOperand());
161 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
162
163 __ str(r2, MemOperand(sp, receiver_offset));
164
165 __ bind(&ok);
156 } 166 }
157 167
158 // Open a frame scope to indicate that there is a frame on the stack. The 168 // Open a frame scope to indicate that there is a frame on the stack. The
159 // MANUAL indicates that the scope shouldn't actually generate code to set up 169 // MANUAL indicates that the scope shouldn't actually generate code to set up
160 // the frame (that is done below). 170 // the frame (that is done below).
161 FrameScope frame_scope(masm_, StackFrame::MANUAL); 171 FrameScope frame_scope(masm_, StackFrame::MANUAL);
162 172
163 info->set_prologue_offset(masm_->pc_offset()); 173 info->set_prologue_offset(masm_->pc_offset());
164 __ Prologue(BUILD_FUNCTION_FRAME); 174 __ Prologue(BUILD_FUNCTION_FRAME);
165 info->AddNoFrameRange(0, masm_->pc_offset()); 175 info->AddNoFrameRange(0, masm_->pc_offset());
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 EmitResolvePossiblyDirectEval(arg_count); 2737 EmitResolvePossiblyDirectEval(arg_count);
2728 2738
2729 // The runtime call returns a pair of values in r0 (function) and 2739 // The runtime call returns a pair of values in r0 (function) and
2730 // r1 (receiver). Touch up the stack with the right values. 2740 // r1 (receiver). Touch up the stack with the right values.
2731 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2741 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize));
2732 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); 2742 __ str(r1, MemOperand(sp, arg_count * kPointerSize));
2733 } 2743 }
2734 2744
2735 // Record source position for debugger. 2745 // Record source position for debugger.
2736 SetSourcePosition(expr->position()); 2746 SetSourcePosition(expr->position());
2737 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); 2747 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS);
2738 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2748 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2739 __ CallStub(&stub); 2749 __ CallStub(&stub);
2740 RecordJSReturnSite(expr); 2750 RecordJSReturnSite(expr);
2741 // Restore context register. 2751 // Restore context register.
2742 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2752 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2743 context()->DropAndPlug(1, r0); 2753 context()->DropAndPlug(1, r0);
2744 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2754 } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
2745 // Push global object as receiver for the call IC. 2755 // Push global object as receiver for the call IC.
2746 __ ldr(r0, GlobalObjectOperand()); 2756 __ ldr(r0, GlobalObjectOperand());
2747 __ push(r0); 2757 __ push(r0);
(...skipping 21 matching lines...) Expand all
2769 // function and receiver and have the slow path jump around this 2779 // function and receiver and have the slow path jump around this
2770 // code. 2780 // code.
2771 if (done.is_linked()) { 2781 if (done.is_linked()) {
2772 Label call; 2782 Label call;
2773 __ b(&call); 2783 __ b(&call);
2774 __ bind(&done); 2784 __ bind(&done);
2775 // Push function. 2785 // Push function.
2776 __ push(r0); 2786 __ push(r0);
2777 // The receiver is implicitly the global receiver. Indicate this 2787 // The receiver is implicitly the global receiver. Indicate this
2778 // by passing the hole to the call function stub. 2788 // by passing the hole to the call function stub.
2779 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); 2789 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2780 __ push(r1); 2790 __ push(r1);
2781 __ bind(&call); 2791 __ bind(&call);
2782 } 2792 }
2783 2793
2784 // The receiver is either the global receiver or an object found 2794 // The receiver is either the global receiver or an object found
2785 // by LoadContextSlot. That object could be the hole if the 2795 // by LoadContextSlot.
2786 // receiver is implicitly the global object. 2796 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
2787 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT);
2788 } else if (property != NULL) { 2797 } else if (property != NULL) {
2789 { PreservePositionScope scope(masm()->positions_recorder()); 2798 { PreservePositionScope scope(masm()->positions_recorder());
2790 VisitForStackValue(property->obj()); 2799 VisitForStackValue(property->obj());
2791 } 2800 }
2792 if (property->key()->IsPropertyName()) { 2801 if (property->key()->IsPropertyName()) {
2793 EmitCallWithIC(expr, 2802 EmitCallWithIC(expr,
2794 property->key()->AsLiteral()->value(), 2803 property->key()->AsLiteral()->value(),
2795 NOT_CONTEXTUAL); 2804 NOT_CONTEXTUAL);
2796 } else { 2805 } else {
2797 EmitKeyedCallWithIC(expr, property->key()); 2806 EmitKeyedCallWithIC(expr, property->key());
2798 } 2807 }
2799 } else { 2808 } else {
2800 // Call to an arbitrary expression not handled specially above. 2809 // Call to an arbitrary expression not handled specially above.
2801 { PreservePositionScope scope(masm()->positions_recorder()); 2810 { PreservePositionScope scope(masm()->positions_recorder());
2802 VisitForStackValue(callee); 2811 VisitForStackValue(callee);
2803 } 2812 }
2804 // Push the hole as receiver. 2813 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2805 // It will be correctly replaced in the call stub.
2806 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex);
2807 __ push(r1); 2814 __ push(r1);
2808 // Emit function call. 2815 // Emit function call.
2809 EmitCallWithStub(expr, RECEIVER_IS_IMPLICIT); 2816 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
2810 } 2817 }
2811 2818
2812 #ifdef DEBUG 2819 #ifdef DEBUG
2813 // RecordJSReturnSite should have been called. 2820 // RecordJSReturnSite should have been called.
2814 ASSERT(expr->return_is_recorded_); 2821 ASSERT(expr->return_is_recorded_);
2815 #endif 2822 #endif
2816 } 2823 }
2817 2824
2818 2825
2819 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2826 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
3716 Label runtime, done; 3723 Label runtime, done;
3717 // Check for non-function argument (including proxy). 3724 // Check for non-function argument (including proxy).
3718 __ JumpIfSmi(r0, &runtime); 3725 __ JumpIfSmi(r0, &runtime);
3719 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); 3726 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE);
3720 __ b(ne, &runtime); 3727 __ b(ne, &runtime);
3721 3728
3722 // InvokeFunction requires the function in r1. Move it in there. 3729 // InvokeFunction requires the function in r1. Move it in there.
3723 __ mov(r1, result_register()); 3730 __ mov(r1, result_register());
3724 ParameterCount count(arg_count); 3731 ParameterCount count(arg_count);
3725 __ InvokeFunction(r1, count, CALL_FUNCTION, 3732 __ InvokeFunction(r1, count, CALL_FUNCTION,
3726 NullCallWrapper(), CALL_AS_METHOD); 3733 NullCallWrapper(), CALL_AS_FUNCTION);
3727 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3734 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3728 __ jmp(&done); 3735 __ jmp(&done);
3729 3736
3730 __ bind(&runtime); 3737 __ bind(&runtime);
3731 __ push(r0); 3738 __ push(r0);
3732 __ CallRuntime(Runtime::kCall, args->length()); 3739 __ CallRuntime(Runtime::kCall, args->length());
3733 __ bind(&done); 3740 __ bind(&done);
3734 3741
3735 context()->Plug(r0); 3742 context()->Plug(r0);
3736 } 3743 }
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
4893 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4900 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4894 reinterpret_cast<uint32_t>( 4901 reinterpret_cast<uint32_t>(
4895 isolate->builtins()->OsrAfterStackCheck()->entry())); 4902 isolate->builtins()->OsrAfterStackCheck()->entry()));
4896 return OSR_AFTER_STACK_CHECK; 4903 return OSR_AFTER_STACK_CHECK;
4897 } 4904 }
4898 4905
4899 4906
4900 } } // namespace v8::internal 4907 } } // namespace v8::internal
4901 4908
4902 #endif // V8_TARGET_ARCH_ARM 4909 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698