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

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

Issue 132623005: A64: Synchronize with r18642. (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/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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Classic mode functions and builtins need to replace the receiver with the 147 // Classic mode functions and builtins need to replace the receiver with the
148 // global proxy when called as functions (without an explicit receiver 148 // global proxy when called as functions (without an explicit receiver
149 // object). 149 // object).
150 if (info->is_classic_mode() && !info->is_native()) { 150 if (info->is_classic_mode() && !info->is_native()) {
151 Label ok; 151 Label ok;
152 __ cmp(r5, Operand::Zero());
153 __ b(eq, &ok);
154
155 int receiver_offset = info->scope()->num_parameters() * kPointerSize; 152 int receiver_offset = info->scope()->num_parameters() * kPointerSize;
156 __ ldr(r2, MemOperand(sp, receiver_offset)); 153 __ ldr(r2, MemOperand(sp, receiver_offset));
157 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); 154 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
158 __ b(ne, &ok); 155 __ b(ne, &ok);
159 156
160 __ ldr(r2, GlobalObjectOperand()); 157 __ ldr(r2, GlobalObjectOperand());
161 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); 158 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
162 159
163 __ str(r2, MemOperand(sp, receiver_offset)); 160 __ str(r2, MemOperand(sp, receiver_offset));
164 161
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 break; 2111 break;
2115 } 2112 }
2116 } 2113 }
2117 } 2114 }
2118 2115
2119 2116
2120 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 2117 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
2121 Expression *value, 2118 Expression *value,
2122 JSGeneratorObject::ResumeMode resume_mode) { 2119 JSGeneratorObject::ResumeMode resume_mode) {
2123 // The value stays in r0, and is ultimately read by the resumed generator, as 2120 // The value stays in r0, and is ultimately read by the resumed generator, as
2124 // if the CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. r1 2121 // if the CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it
2125 // will hold the generator object until the activation has been resumed. 2122 // is read to throw the value when the resumed generator is already closed.
2123 // r1 will hold the generator object until the activation has been resumed.
2126 VisitForStackValue(generator); 2124 VisitForStackValue(generator);
2127 VisitForAccumulatorValue(value); 2125 VisitForAccumulatorValue(value);
2128 __ pop(r1); 2126 __ pop(r1);
2129 2127
2130 // Check generator state. 2128 // Check generator state.
2131 Label wrong_state, done; 2129 Label wrong_state, closed_state, done;
2132 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); 2130 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset));
2133 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); 2131 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0);
2134 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); 2132 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0);
2135 __ cmp(r3, Operand(Smi::FromInt(0))); 2133 __ cmp(r3, Operand(Smi::FromInt(0)));
2136 __ b(le, &wrong_state); 2134 __ b(eq, &closed_state);
2135 __ b(lt, &wrong_state);
2137 2136
2138 // Load suspended function and context. 2137 // Load suspended function and context.
2139 __ ldr(cp, FieldMemOperand(r1, JSGeneratorObject::kContextOffset)); 2138 __ ldr(cp, FieldMemOperand(r1, JSGeneratorObject::kContextOffset));
2140 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset)); 2139 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset));
2141 2140
2142 // Load receiver and store as the first argument. 2141 // Load receiver and store as the first argument.
2143 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kReceiverOffset)); 2142 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kReceiverOffset));
2144 __ push(r2); 2143 __ push(r2);
2145 2144
2146 // Push holes for the rest of the arguments to the generator function. 2145 // Push holes for the rest of the arguments to the generator function.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 __ push(r2); 2200 __ push(r2);
2202 __ b(&push_operand_holes); 2201 __ b(&push_operand_holes);
2203 __ bind(&call_resume); 2202 __ bind(&call_resume);
2204 ASSERT(!result_register().is(r1)); 2203 ASSERT(!result_register().is(r1));
2205 __ Push(r1, result_register()); 2204 __ Push(r1, result_register());
2206 __ Push(Smi::FromInt(resume_mode)); 2205 __ Push(Smi::FromInt(resume_mode));
2207 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 2206 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
2208 // Not reached: the runtime call returns elsewhere. 2207 // Not reached: the runtime call returns elsewhere.
2209 __ stop("not-reached"); 2208 __ stop("not-reached");
2210 2209
2210 // Reach here when generator is closed.
2211 __ bind(&closed_state);
2212 if (resume_mode == JSGeneratorObject::NEXT) {
2213 // Return completed iterator result when generator is closed.
2214 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
2215 __ push(r2);
2216 // Pop value from top-of-stack slot; box result into result register.
2217 EmitCreateIteratorResult(true);
2218 } else {
2219 // Throw the provided value.
2220 __ push(r0);
2221 __ CallRuntime(Runtime::kThrow, 1);
2222 }
2223 __ jmp(&done);
2224
2211 // Throw error if we attempt to operate on a running generator. 2225 // Throw error if we attempt to operate on a running generator.
2212 __ bind(&wrong_state); 2226 __ bind(&wrong_state);
2213 __ push(r1); 2227 __ push(r1);
2214 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); 2228 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1);
2215 2229
2216 __ bind(&done); 2230 __ bind(&done);
2217 context()->Plug(result_register()); 2231 context()->Plug(result_register());
2218 } 2232 }
2219 2233
2220 2234
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 int arg_count = args->length(); 2607 int arg_count = args->length();
2594 { PreservePositionScope scope(masm()->positions_recorder()); 2608 { PreservePositionScope scope(masm()->positions_recorder());
2595 for (int i = 0; i < arg_count; i++) { 2609 for (int i = 0; i < arg_count; i++) {
2596 VisitForStackValue(args->at(i)); 2610 VisitForStackValue(args->at(i));
2597 } 2611 }
2598 __ mov(r2, Operand(name)); 2612 __ mov(r2, Operand(name));
2599 } 2613 }
2600 // Record source position for debugger. 2614 // Record source position for debugger.
2601 SetSourcePosition(expr->position()); 2615 SetSourcePosition(expr->position());
2602 // Call the IC initialization code. 2616 // Call the IC initialization code.
2603 Handle<Code> ic = 2617 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
2604 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
2605 TypeFeedbackId ast_id = mode == CONTEXTUAL 2618 TypeFeedbackId ast_id = mode == CONTEXTUAL
2606 ? TypeFeedbackId::None() 2619 ? TypeFeedbackId::None()
2607 : expr->CallFeedbackId(); 2620 : expr->CallFeedbackId();
2608 CallIC(ic, mode, ast_id); 2621 CallIC(ic, mode, ast_id);
2609 RecordJSReturnSite(expr); 2622 RecordJSReturnSite(expr);
2610 // Restore context register. 2623 // Restore context register.
2611 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2624 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2612 context()->Plug(r0); 2625 context()->Plug(r0);
2613 } 2626 }
2614 2627
(...skipping 24 matching lines...) Expand all
2639 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); 2652 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count);
2640 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. 2653 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key.
2641 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); 2654 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId());
2642 RecordJSReturnSite(expr); 2655 RecordJSReturnSite(expr);
2643 // Restore context register. 2656 // Restore context register.
2644 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2657 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2645 context()->DropAndPlug(1, r0); // Drop the key still on the stack. 2658 context()->DropAndPlug(1, r0); // Drop the key still on the stack.
2646 } 2659 }
2647 2660
2648 2661
2649 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { 2662 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
2650 // Code common for calls using the call stub. 2663 // Code common for calls using the call stub.
2651 ZoneList<Expression*>* args = expr->arguments(); 2664 ZoneList<Expression*>* args = expr->arguments();
2652 int arg_count = args->length(); 2665 int arg_count = args->length();
2653 { PreservePositionScope scope(masm()->positions_recorder()); 2666 { PreservePositionScope scope(masm()->positions_recorder());
2654 for (int i = 0; i < arg_count; i++) { 2667 for (int i = 0; i < arg_count; i++) {
2655 VisitForStackValue(args->at(i)); 2668 VisitForStackValue(args->at(i));
2656 } 2669 }
2657 } 2670 }
2658 // Record source position for debugger. 2671 // Record source position for debugger.
2659 SetSourcePosition(expr->position()); 2672 SetSourcePosition(expr->position());
2660 2673
2661 // Record call targets in unoptimized code.
2662 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET);
2663 Handle<Object> uninitialized = 2674 Handle<Object> uninitialized =
2664 TypeFeedbackCells::UninitializedSentinel(isolate()); 2675 TypeFeedbackCells::UninitializedSentinel(isolate());
2665 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); 2676 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized);
2666 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); 2677 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell);
2667 __ mov(r2, Operand(cell)); 2678 __ mov(r2, Operand(cell));
2668 2679
2669 CallFunctionStub stub(arg_count, flags); 2680 // Record call targets in unoptimized code.
2681 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
2670 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2682 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2671 __ CallStub(&stub, expr->CallFeedbackId()); 2683 __ CallStub(&stub, expr->CallFeedbackId());
2672 RecordJSReturnSite(expr); 2684 RecordJSReturnSite(expr);
2673 // Restore context register. 2685 // Restore context register.
2674 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2686 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2675 context()->DropAndPlug(1, r0); 2687 context()->DropAndPlug(1, r0);
2676 } 2688 }
2677 2689
2678 2690
2679 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2691 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 __ push(r0); 2798 __ push(r0);
2787 // The receiver is implicitly the global receiver. Indicate this 2799 // The receiver is implicitly the global receiver. Indicate this
2788 // by passing the hole to the call function stub. 2800 // by passing the hole to the call function stub.
2789 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2801 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2790 __ push(r1); 2802 __ push(r1);
2791 __ bind(&call); 2803 __ bind(&call);
2792 } 2804 }
2793 2805
2794 // The receiver is either the global receiver or an object found 2806 // The receiver is either the global receiver or an object found
2795 // by LoadContextSlot. 2807 // by LoadContextSlot.
2796 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); 2808 EmitCallWithStub(expr);
2797 } else if (property != NULL) { 2809 } else if (property != NULL) {
2798 { PreservePositionScope scope(masm()->positions_recorder()); 2810 { PreservePositionScope scope(masm()->positions_recorder());
2799 VisitForStackValue(property->obj()); 2811 VisitForStackValue(property->obj());
2800 } 2812 }
2801 if (property->key()->IsPropertyName()) { 2813 if (property->key()->IsPropertyName()) {
2802 EmitCallWithIC(expr, 2814 EmitCallWithIC(expr,
2803 property->key()->AsLiteral()->value(), 2815 property->key()->AsLiteral()->value(),
2804 NOT_CONTEXTUAL); 2816 NOT_CONTEXTUAL);
2805 } else { 2817 } else {
2806 EmitKeyedCallWithIC(expr, property->key()); 2818 EmitKeyedCallWithIC(expr, property->key());
2807 } 2819 }
2808 } else { 2820 } else {
2809 // Call to an arbitrary expression not handled specially above. 2821 // Call to an arbitrary expression not handled specially above.
2810 { PreservePositionScope scope(masm()->positions_recorder()); 2822 { PreservePositionScope scope(masm()->positions_recorder());
2811 VisitForStackValue(callee); 2823 VisitForStackValue(callee);
2812 } 2824 }
2813 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 2825 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
2814 __ push(r1); 2826 __ push(r1);
2815 // Emit function call. 2827 // Emit function call.
2816 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); 2828 EmitCallWithStub(expr);
2817 } 2829 }
2818 2830
2819 #ifdef DEBUG 2831 #ifdef DEBUG
2820 // RecordJSReturnSite should have been called. 2832 // RecordJSReturnSite should have been called.
2821 ASSERT(expr->return_is_recorded_); 2833 ASSERT(expr->return_is_recorded_);
2822 #endif 2834 #endif
2823 } 2835 }
2824 2836
2825 2837
2826 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2838 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 3734
3723 Label runtime, done; 3735 Label runtime, done;
3724 // Check for non-function argument (including proxy). 3736 // Check for non-function argument (including proxy).
3725 __ JumpIfSmi(r0, &runtime); 3737 __ JumpIfSmi(r0, &runtime);
3726 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); 3738 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE);
3727 __ b(ne, &runtime); 3739 __ b(ne, &runtime);
3728 3740
3729 // InvokeFunction requires the function in r1. Move it in there. 3741 // InvokeFunction requires the function in r1. Move it in there.
3730 __ mov(r1, result_register()); 3742 __ mov(r1, result_register());
3731 ParameterCount count(arg_count); 3743 ParameterCount count(arg_count);
3732 __ InvokeFunction(r1, count, CALL_FUNCTION, 3744 __ InvokeFunction(r1, count, CALL_FUNCTION, NullCallWrapper());
3733 NullCallWrapper(), CALL_AS_FUNCTION);
3734 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3745 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3735 __ jmp(&done); 3746 __ jmp(&done);
3736 3747
3737 __ bind(&runtime); 3748 __ bind(&runtime);
3738 __ push(r0); 3749 __ push(r0);
3739 __ CallRuntime(Runtime::kCall, args->length()); 3750 __ CallRuntime(Runtime::kCall, args->length());
3740 __ bind(&done); 3751 __ bind(&done);
3741 3752
3742 context()->Plug(r0); 3753 context()->Plug(r0);
3743 } 3754 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 4146
4136 // Push the arguments ("left-to-right"). 4147 // Push the arguments ("left-to-right").
4137 int arg_count = args->length(); 4148 int arg_count = args->length();
4138 for (int i = 0; i < arg_count; i++) { 4149 for (int i = 0; i < arg_count; i++) {
4139 VisitForStackValue(args->at(i)); 4150 VisitForStackValue(args->at(i));
4140 } 4151 }
4141 4152
4142 if (expr->is_jsruntime()) { 4153 if (expr->is_jsruntime()) {
4143 // Call the JS runtime function. 4154 // Call the JS runtime function.
4144 __ mov(r2, Operand(expr->name())); 4155 __ mov(r2, Operand(expr->name()));
4145 ContextualMode mode = NOT_CONTEXTUAL; 4156 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
4146 Handle<Code> ic = 4157 CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4147 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
4148 CallIC(ic, mode, expr->CallRuntimeFeedbackId());
4149 // Restore context register. 4158 // Restore context register.
4150 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4159 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4151 } else { 4160 } else {
4152 // Call the C runtime function. 4161 // Call the C runtime function.
4153 __ CallRuntime(expr->function(), arg_count); 4162 __ CallRuntime(expr->function(), arg_count);
4154 } 4163 }
4155 context()->Plug(r0); 4164 context()->Plug(r0);
4156 } 4165 }
4157 4166
4158 4167
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
4900 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4909 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4901 reinterpret_cast<uint32_t>( 4910 reinterpret_cast<uint32_t>(
4902 isolate->builtins()->OsrAfterStackCheck()->entry())); 4911 isolate->builtins()->OsrAfterStackCheck()->entry()));
4903 return OSR_AFTER_STACK_CHECK; 4912 return OSR_AFTER_STACK_CHECK;
4904 } 4913 }
4905 4914
4906 4915
4907 } } // namespace v8::internal 4916 } } // namespace v8::internal
4908 4917
4909 #endif // V8_TARGET_ARCH_ARM 4918 #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