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

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

Issue 143633007: A64: Synchronize with r18764. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/codegen-arm.h ('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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 } 196 }
197 197
198 bool function_in_register = true; 198 bool function_in_register = true;
199 199
200 // Possibly allocate a local context. 200 // Possibly allocate a local context.
201 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 201 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
202 if (heap_slots > 0) { 202 if (heap_slots > 0) {
203 // Argument to NewContext is the function, which is still in r1. 203 // Argument to NewContext is the function, which is still in r1.
204 Comment cmnt(masm_, "[ Allocate context"); 204 Comment cmnt(masm_, "[ Allocate context");
205 __ push(r1);
206 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 205 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
206 __ push(r1);
207 __ Push(info->scope()->GetScopeInfo()); 207 __ Push(info->scope()->GetScopeInfo());
208 __ CallRuntime(Runtime::kNewGlobalContext, 2); 208 __ CallRuntime(Runtime::kNewGlobalContext, 2);
209 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 209 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
210 FastNewContextStub stub(heap_slots); 210 FastNewContextStub stub(heap_slots);
211 __ CallStub(&stub); 211 __ CallStub(&stub);
212 } else { 212 } else {
213 __ push(r1);
213 __ CallRuntime(Runtime::kNewFunctionContext, 1); 214 __ CallRuntime(Runtime::kNewFunctionContext, 1);
214 } 215 }
215 function_in_register = false; 216 function_in_register = false;
216 // Context is returned in both r0 and cp. It replaces the context 217 // Context is returned in r0. It replaces the context passed to us.
217 // passed to us. It's saved in the stack and kept live in cp. 218 // It's saved in the stack and kept live in cp.
218 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 219 __ mov(cp, r0);
220 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset));
219 // Copy any necessary parameters into the context. 221 // Copy any necessary parameters into the context.
220 int num_parameters = info->scope()->num_parameters(); 222 int num_parameters = info->scope()->num_parameters();
221 for (int i = 0; i < num_parameters; i++) { 223 for (int i = 0; i < num_parameters; i++) {
222 Variable* var = scope()->parameter(i); 224 Variable* var = scope()->parameter(i);
223 if (var->IsContextSlot()) { 225 if (var->IsContextSlot()) {
224 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 226 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
225 (num_parameters - 1 - i) * kPointerSize; 227 (num_parameters - 1 - i) * kPointerSize;
226 // Load parameter from stack. 228 // Load parameter from stack.
227 __ ldr(r0, MemOperand(fp, parameter_offset)); 229 __ ldr(r0, MemOperand(fp, parameter_offset));
228 // Store it in the context. 230 // Store it in the context.
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 2716
2715 void FullCodeGenerator::VisitCall(Call* expr) { 2717 void FullCodeGenerator::VisitCall(Call* expr) {
2716 #ifdef DEBUG 2718 #ifdef DEBUG
2717 // We want to verify that RecordJSReturnSite gets called on all paths 2719 // We want to verify that RecordJSReturnSite gets called on all paths
2718 // through this function. Avoid early returns. 2720 // through this function. Avoid early returns.
2719 expr->return_is_recorded_ = false; 2721 expr->return_is_recorded_ = false;
2720 #endif 2722 #endif
2721 2723
2722 Comment cmnt(masm_, "[ Call"); 2724 Comment cmnt(masm_, "[ Call");
2723 Expression* callee = expr->expression(); 2725 Expression* callee = expr->expression();
2724 VariableProxy* proxy = callee->AsVariableProxy(); 2726 Call::CallType call_type = expr->GetCallType(isolate());
2725 Property* property = callee->AsProperty();
2726 2727
2727 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { 2728 if (call_type == Call::POSSIBLY_EVAL_CALL) {
2728 // In a call to eval, we first call %ResolvePossiblyDirectEval to 2729 // In a call to eval, we first call %ResolvePossiblyDirectEval to
2729 // resolve the function we need to call and the receiver of the 2730 // resolve the function we need to call and the receiver of the
2730 // call. Then we call the resolved function using the given 2731 // call. Then we call the resolved function using the given
2731 // arguments. 2732 // arguments.
2732 ZoneList<Expression*>* args = expr->arguments(); 2733 ZoneList<Expression*>* args = expr->arguments();
2733 int arg_count = args->length(); 2734 int arg_count = args->length();
2734 2735
2735 { PreservePositionScope pos_scope(masm()->positions_recorder()); 2736 { PreservePositionScope pos_scope(masm()->positions_recorder());
2736 VisitForStackValue(callee); 2737 VisitForStackValue(callee);
2737 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 2738 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
(...skipping 18 matching lines...) Expand all
2756 2757
2757 // Record source position for debugger. 2758 // Record source position for debugger.
2758 SetSourcePosition(expr->position()); 2759 SetSourcePosition(expr->position());
2759 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); 2760 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS);
2760 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2761 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2761 __ CallStub(&stub); 2762 __ CallStub(&stub);
2762 RecordJSReturnSite(expr); 2763 RecordJSReturnSite(expr);
2763 // Restore context register. 2764 // Restore context register.
2764 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2765 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2765 context()->DropAndPlug(1, r0); 2766 context()->DropAndPlug(1, r0);
2766 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2767 } else if (call_type == Call::GLOBAL_CALL) {
2767 // Push global object as receiver for the call IC. 2768 // Push global object as receiver for the call IC.
2768 __ ldr(r0, GlobalObjectOperand()); 2769 __ ldr(r0, GlobalObjectOperand());
2769 __ push(r0); 2770 __ push(r0);
2771 VariableProxy* proxy = callee->AsVariableProxy();
2770 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); 2772 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
2771 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 2773 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2772 // Call to a lookup slot (dynamically introduced variable). 2774 // Call to a lookup slot (dynamically introduced variable).
2775 VariableProxy* proxy = callee->AsVariableProxy();
2773 Label slow, done; 2776 Label slow, done;
2774 2777
2775 { PreservePositionScope scope(masm()->positions_recorder()); 2778 { PreservePositionScope scope(masm()->positions_recorder());
2776 // Generate code for loading from variables potentially shadowed 2779 // Generate code for loading from variables potentially shadowed
2777 // by eval-introduced variables. 2780 // by eval-introduced variables.
2778 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); 2781 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done);
2779 } 2782 }
2780 2783
2781 __ bind(&slow); 2784 __ bind(&slow);
2782 // Call the runtime to find the function to call (returned in r0) 2785 // Call the runtime to find the function to call (returned in r0)
(...skipping 16 matching lines...) Expand all
2799 // The receiver is implicitly the global receiver. Indicate this 2802 // The receiver is implicitly the global receiver. Indicate this
2800 // by passing the hole to the call function stub. 2803 // by passing the hole to the call function stub.
2801 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2804 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2802 __ push(r1); 2805 __ push(r1);
2803 __ bind(&call); 2806 __ bind(&call);
2804 } 2807 }
2805 2808
2806 // The receiver is either the global receiver or an object found 2809 // The receiver is either the global receiver or an object found
2807 // by LoadContextSlot. 2810 // by LoadContextSlot.
2808 EmitCallWithStub(expr); 2811 EmitCallWithStub(expr);
2809 } else if (property != NULL) { 2812 } else if (call_type == Call::PROPERTY_CALL) {
2813 Property* property = callee->AsProperty();
2810 { PreservePositionScope scope(masm()->positions_recorder()); 2814 { PreservePositionScope scope(masm()->positions_recorder());
2811 VisitForStackValue(property->obj()); 2815 VisitForStackValue(property->obj());
2812 } 2816 }
2813 if (property->key()->IsPropertyName()) { 2817 if (property->key()->IsPropertyName()) {
2814 EmitCallWithIC(expr, 2818 EmitCallWithIC(expr,
2815 property->key()->AsLiteral()->value(), 2819 property->key()->AsLiteral()->value(),
2816 NOT_CONTEXTUAL); 2820 NOT_CONTEXTUAL);
2817 } else { 2821 } else {
2818 EmitKeyedCallWithIC(expr, property->key()); 2822 EmitKeyedCallWithIC(expr, property->key());
2819 } 2823 }
2820 } else { 2824 } else {
2825 ASSERT(call_type == Call::OTHER_CALL);
2821 // Call to an arbitrary expression not handled specially above. 2826 // Call to an arbitrary expression not handled specially above.
2822 { PreservePositionScope scope(masm()->positions_recorder()); 2827 { PreservePositionScope scope(masm()->positions_recorder());
2823 VisitForStackValue(callee); 2828 VisitForStackValue(callee);
2824 } 2829 }
2825 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2830 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2826 __ push(r1); 2831 __ push(r1);
2827 // Emit function call. 2832 // Emit function call.
2828 EmitCallWithStub(expr); 2833 EmitCallWithStub(expr);
2829 } 2834 }
2830 2835
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 generator.GenerateSlow(masm_, call_helper); 3669 generator.GenerateSlow(masm_, call_helper);
3665 3670
3666 __ bind(&done); 3671 __ bind(&done);
3667 context()->Plug(result); 3672 context()->Plug(result);
3668 } 3673 }
3669 3674
3670 3675
3671 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { 3676 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
3672 ZoneList<Expression*>* args = expr->arguments(); 3677 ZoneList<Expression*>* args = expr->arguments();
3673 ASSERT_EQ(2, args->length()); 3678 ASSERT_EQ(2, args->length());
3679 VisitForStackValue(args->at(0));
3680 VisitForAccumulatorValue(args->at(1));
3674 3681
3675 if (FLAG_new_string_add) { 3682 __ pop(r1);
3676 VisitForStackValue(args->at(0)); 3683 StringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
3677 VisitForAccumulatorValue(args->at(1)); 3684 __ CallStub(&stub);
3678
3679 __ pop(r1);
3680 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
3681 __ CallStub(&stub);
3682 } else {
3683 VisitForStackValue(args->at(0));
3684 VisitForStackValue(args->at(1));
3685
3686 StringAddStub stub(STRING_ADD_CHECK_BOTH);
3687 __ CallStub(&stub);
3688 }
3689 context()->Plug(r0); 3685 context()->Plug(r0);
3690 } 3686 }
3691 3687
3692 3688
3693 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) { 3689 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) {
3694 ZoneList<Expression*>* args = expr->arguments(); 3690 ZoneList<Expression*>* args = expr->arguments();
3695 ASSERT_EQ(2, args->length()); 3691 ASSERT_EQ(2, args->length());
3696 VisitForStackValue(args->at(0)); 3692 VisitForStackValue(args->at(0));
3697 VisitForStackValue(args->at(1)); 3693 VisitForStackValue(args->at(1));
3698 3694
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4909 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4905 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4910 reinterpret_cast<uint32_t>( 4906 reinterpret_cast<uint32_t>(
4911 isolate->builtins()->OsrAfterStackCheck()->entry())); 4907 isolate->builtins()->OsrAfterStackCheck()->entry()));
4912 return OSR_AFTER_STACK_CHECK; 4908 return OSR_AFTER_STACK_CHECK;
4913 } 4909 }
4914 4910
4915 4911
4916 } } // namespace v8::internal 4912 } } // namespace v8::internal
4917 4913
4918 #endif // V8_TARGET_ARCH_ARM 4914 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698