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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-ia32.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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 } 176 }
177 177
178 bool function_in_register = true; 178 bool function_in_register = true;
179 179
180 // Possibly allocate a local context. 180 // Possibly allocate a local context.
181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
182 if (heap_slots > 0) { 182 if (heap_slots > 0) {
183 Comment cmnt(masm_, "[ Allocate context"); 183 Comment cmnt(masm_, "[ Allocate context");
184 // Argument to NewContext is the function, which is still in edi. 184 // Argument to NewContext is the function, which is still in edi.
185 __ push(edi);
186 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 185 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
186 __ push(edi);
187 __ Push(info->scope()->GetScopeInfo()); 187 __ Push(info->scope()->GetScopeInfo());
188 __ CallRuntime(Runtime::kNewGlobalContext, 2); 188 __ CallRuntime(Runtime::kNewGlobalContext, 2);
189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
190 FastNewContextStub stub(heap_slots); 190 FastNewContextStub stub(heap_slots);
191 __ CallStub(&stub); 191 __ CallStub(&stub);
192 } else { 192 } else {
193 __ push(edi);
193 __ CallRuntime(Runtime::kNewFunctionContext, 1); 194 __ CallRuntime(Runtime::kNewFunctionContext, 1);
194 } 195 }
195 function_in_register = false; 196 function_in_register = false;
196 // Context is returned in both eax and esi. It replaces the context 197 // Context is returned in eax. It replaces the context passed to us.
197 // passed to us. It's saved in the stack and kept live in esi. 198 // It's saved in the stack and kept live in esi.
198 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); 199 __ mov(esi, eax);
200 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
199 201
200 // Copy parameters into context if necessary. 202 // Copy parameters into context if necessary.
201 int num_parameters = info->scope()->num_parameters(); 203 int num_parameters = info->scope()->num_parameters();
202 for (int i = 0; i < num_parameters; i++) { 204 for (int i = 0; i < num_parameters; i++) {
203 Variable* var = scope()->parameter(i); 205 Variable* var = scope()->parameter(i);
204 if (var->IsContextSlot()) { 206 if (var->IsContextSlot()) {
205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 207 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
206 (num_parameters - 1 - i) * kPointerSize; 208 (num_parameters - 1 - i) * kPointerSize;
207 // Load parameter from stack. 209 // Load parameter from stack.
208 __ mov(eax, Operand(ebp, parameter_offset)); 210 __ mov(eax, Operand(ebp, parameter_offset));
(...skipping 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 2668
2667 void FullCodeGenerator::VisitCall(Call* expr) { 2669 void FullCodeGenerator::VisitCall(Call* expr) {
2668 #ifdef DEBUG 2670 #ifdef DEBUG
2669 // We want to verify that RecordJSReturnSite gets called on all paths 2671 // We want to verify that RecordJSReturnSite gets called on all paths
2670 // through this function. Avoid early returns. 2672 // through this function. Avoid early returns.
2671 expr->return_is_recorded_ = false; 2673 expr->return_is_recorded_ = false;
2672 #endif 2674 #endif
2673 2675
2674 Comment cmnt(masm_, "[ Call"); 2676 Comment cmnt(masm_, "[ Call");
2675 Expression* callee = expr->expression(); 2677 Expression* callee = expr->expression();
2676 VariableProxy* proxy = callee->AsVariableProxy(); 2678 Call::CallType call_type = expr->GetCallType(isolate());
2677 Property* property = callee->AsProperty();
2678 2679
2679 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { 2680 if (call_type == Call::POSSIBLY_EVAL_CALL) {
2680 // In a call to eval, we first call %ResolvePossiblyDirectEval to 2681 // In a call to eval, we first call %ResolvePossiblyDirectEval to
2681 // resolve the function we need to call and the receiver of the call. 2682 // resolve the function we need to call and the receiver of the call.
2682 // Then we call the resolved function using the given arguments. 2683 // Then we call the resolved function using the given arguments.
2683 ZoneList<Expression*>* args = expr->arguments(); 2684 ZoneList<Expression*>* args = expr->arguments();
2684 int arg_count = args->length(); 2685 int arg_count = args->length();
2685 { PreservePositionScope pos_scope(masm()->positions_recorder()); 2686 { PreservePositionScope pos_scope(masm()->positions_recorder());
2686 VisitForStackValue(callee); 2687 VisitForStackValue(callee);
2687 // Reserved receiver slot. 2688 // Reserved receiver slot.
2688 __ push(Immediate(isolate()->factory()->undefined_value())); 2689 __ push(Immediate(isolate()->factory()->undefined_value()));
2689 // Push the arguments. 2690 // Push the arguments.
(...skipping 14 matching lines...) Expand all
2704 // Record source position for debugger. 2705 // Record source position for debugger.
2705 SetSourcePosition(expr->position()); 2706 SetSourcePosition(expr->position());
2706 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); 2707 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS);
2707 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2708 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2708 __ CallStub(&stub); 2709 __ CallStub(&stub);
2709 RecordJSReturnSite(expr); 2710 RecordJSReturnSite(expr);
2710 // Restore context register. 2711 // Restore context register.
2711 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2712 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2712 context()->DropAndPlug(1, eax); 2713 context()->DropAndPlug(1, eax);
2713 2714
2714 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2715 } else if (call_type == Call::GLOBAL_CALL) {
2715 // Push global object as receiver for the call IC. 2716 // Push global object as receiver for the call IC.
2716 __ push(GlobalObjectOperand()); 2717 __ push(GlobalObjectOperand());
2718 VariableProxy* proxy = callee->AsVariableProxy();
2717 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); 2719 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
2718 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 2720 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2719 // Call to a lookup slot (dynamically introduced variable). 2721 // Call to a lookup slot (dynamically introduced variable).
2722 VariableProxy* proxy = callee->AsVariableProxy();
2720 Label slow, done; 2723 Label slow, done;
2721 { PreservePositionScope scope(masm()->positions_recorder()); 2724 { PreservePositionScope scope(masm()->positions_recorder());
2722 // Generate code for loading from variables potentially shadowed by 2725 // Generate code for loading from variables potentially shadowed by
2723 // eval-introduced variables. 2726 // eval-introduced variables.
2724 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); 2727 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done);
2725 } 2728 }
2726 __ bind(&slow); 2729 __ bind(&slow);
2727 // Call the runtime to find the function to call (returned in eax) and 2730 // Call the runtime to find the function to call (returned in eax) and
2728 // the object holding it (returned in edx). 2731 // the object holding it (returned in edx).
2729 __ push(context_register()); 2732 __ push(context_register());
(...skipping 13 matching lines...) Expand all
2743 // The receiver is implicitly the global receiver. Indicate this by 2746 // The receiver is implicitly the global receiver. Indicate this by
2744 // passing the hole to the call function stub. 2747 // passing the hole to the call function stub.
2745 __ push(Immediate(isolate()->factory()->undefined_value())); 2748 __ push(Immediate(isolate()->factory()->undefined_value()));
2746 __ bind(&call); 2749 __ bind(&call);
2747 } 2750 }
2748 2751
2749 // The receiver is either the global receiver or an object found by 2752 // The receiver is either the global receiver or an object found by
2750 // LoadContextSlot. 2753 // LoadContextSlot.
2751 EmitCallWithStub(expr); 2754 EmitCallWithStub(expr);
2752 2755
2753 } else if (property != NULL) { 2756 } else if (call_type == Call::PROPERTY_CALL) {
2757 Property* property = callee->AsProperty();
2754 { PreservePositionScope scope(masm()->positions_recorder()); 2758 { PreservePositionScope scope(masm()->positions_recorder());
2755 VisitForStackValue(property->obj()); 2759 VisitForStackValue(property->obj());
2756 } 2760 }
2757 if (property->key()->IsPropertyName()) { 2761 if (property->key()->IsPropertyName()) {
2758 EmitCallWithIC(expr, 2762 EmitCallWithIC(expr,
2759 property->key()->AsLiteral()->value(), 2763 property->key()->AsLiteral()->value(),
2760 NOT_CONTEXTUAL); 2764 NOT_CONTEXTUAL);
2761 } else { 2765 } else {
2762 EmitKeyedCallWithIC(expr, property->key()); 2766 EmitKeyedCallWithIC(expr, property->key());
2763 } 2767 }
2764 2768
2765 } else { 2769 } else {
2770 ASSERT(call_type == Call::OTHER_CALL);
2766 // Call to an arbitrary expression not handled specially above. 2771 // Call to an arbitrary expression not handled specially above.
2767 { PreservePositionScope scope(masm()->positions_recorder()); 2772 { PreservePositionScope scope(masm()->positions_recorder());
2768 VisitForStackValue(callee); 2773 VisitForStackValue(callee);
2769 } 2774 }
2770 __ push(Immediate(isolate()->factory()->undefined_value())); 2775 __ push(Immediate(isolate()->factory()->undefined_value()));
2771 // Emit function call. 2776 // Emit function call.
2772 EmitCallWithStub(expr); 2777 EmitCallWithStub(expr);
2773 } 2778 }
2774 2779
2775 #ifdef DEBUG 2780 #ifdef DEBUG
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 generator.GenerateSlow(masm_, call_helper); 3631 generator.GenerateSlow(masm_, call_helper);
3627 3632
3628 __ bind(&done); 3633 __ bind(&done);
3629 context()->Plug(result); 3634 context()->Plug(result);
3630 } 3635 }
3631 3636
3632 3637
3633 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { 3638 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
3634 ZoneList<Expression*>* args = expr->arguments(); 3639 ZoneList<Expression*>* args = expr->arguments();
3635 ASSERT_EQ(2, args->length()); 3640 ASSERT_EQ(2, args->length());
3641 VisitForStackValue(args->at(0));
3642 VisitForAccumulatorValue(args->at(1));
3636 3643
3637 if (FLAG_new_string_add) { 3644 __ pop(edx);
3638 VisitForStackValue(args->at(0)); 3645 StringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
3639 VisitForAccumulatorValue(args->at(1)); 3646 __ CallStub(&stub);
3640
3641 __ pop(edx);
3642 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED);
3643 __ CallStub(&stub);
3644 } else {
3645 VisitForStackValue(args->at(0));
3646 VisitForStackValue(args->at(1));
3647
3648 StringAddStub stub(STRING_ADD_CHECK_BOTH);
3649 __ CallStub(&stub);
3650 }
3651 context()->Plug(eax); 3647 context()->Plug(eax);
3652 } 3648 }
3653 3649
3654 3650
3655 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) { 3651 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) {
3656 ZoneList<Expression*>* args = expr->arguments(); 3652 ZoneList<Expression*>* args = expr->arguments();
3657 ASSERT_EQ(2, args->length()); 3653 ASSERT_EQ(2, args->length());
3658 3654
3659 VisitForStackValue(args->at(0)); 3655 VisitForStackValue(args->at(0));
3660 VisitForStackValue(args->at(1)); 3656 VisitForStackValue(args->at(1));
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4898 4894
4899 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4895 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4900 Assembler::target_address_at(call_target_address)); 4896 Assembler::target_address_at(call_target_address));
4901 return OSR_AFTER_STACK_CHECK; 4897 return OSR_AFTER_STACK_CHECK;
4902 } 4898 }
4903 4899
4904 4900
4905 } } // namespace v8::internal 4901 } } // namespace v8::internal
4906 4902
4907 #endif // V8_TARGET_ARCH_IA32 4903 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698