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

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

Issue 22267005: Use StackArgumenstAccessor and kPCOnStackSize/kFPOnStackSize to compute stack address/operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 7 years, 2 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/x64/frames-x64.h ('k') | src/x64/lithium-codegen-x64.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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #endif 133 #endif
134 134
135 // Strict mode functions and builtins need to replace the receiver 135 // Strict mode functions and builtins need to replace the receiver
136 // with undefined when called as functions (without an explicit 136 // with undefined when called as functions (without an explicit
137 // receiver object). rcx is zero for method calls and non-zero for 137 // receiver object). rcx is zero for method calls and non-zero for
138 // function calls. 138 // function calls.
139 if (!info->is_classic_mode() || info->is_native()) { 139 if (!info->is_classic_mode() || info->is_native()) {
140 Label ok; 140 Label ok;
141 __ testq(rcx, rcx); 141 __ testq(rcx, rcx);
142 __ j(zero, &ok, Label::kNear); 142 __ j(zero, &ok, Label::kNear);
143 // +1 for return address. 143 StackArgumentsAccessor args(rsp, info->scope()->num_parameters());
144 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize;
145 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 144 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
146 __ movq(Operand(rsp, receiver_offset), kScratchRegister); 145 __ movq(args.GetReceiverOperand(), kScratchRegister);
147 __ bind(&ok); 146 __ bind(&ok);
148 } 147 }
149 148
150 // Open a frame scope to indicate that there is a frame on the stack. The 149 // Open a frame scope to indicate that there is a frame on the stack. The
151 // MANUAL indicates that the scope shouldn't actually generate code to set up 150 // MANUAL indicates that the scope shouldn't actually generate code to set up
152 // the frame (that is done below). 151 // the frame (that is done below).
153 FrameScope frame_scope(masm_, StackFrame::MANUAL); 152 FrameScope frame_scope(masm_, StackFrame::MANUAL);
154 153
155 info->set_prologue_offset(masm_->pc_offset()); 154 info->set_prologue_offset(masm_->pc_offset());
156 __ push(rbp); // Caller's frame pointer. 155 __ push(rbp); // Caller's frame pointer.
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 } 670 }
672 } 671 }
673 672
674 673
675 MemOperand FullCodeGenerator::StackOperand(Variable* var) { 674 MemOperand FullCodeGenerator::StackOperand(Variable* var) {
676 ASSERT(var->IsStackAllocated()); 675 ASSERT(var->IsStackAllocated());
677 // Offset is negative because higher indexes are at lower addresses. 676 // Offset is negative because higher indexes are at lower addresses.
678 int offset = -var->index() * kPointerSize; 677 int offset = -var->index() * kPointerSize;
679 // Adjust by a (parameter or local) base offset. 678 // Adjust by a (parameter or local) base offset.
680 if (var->IsParameter()) { 679 if (var->IsParameter()) {
681 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; 680 offset += kFPOnStackSize + kPCOnStackSize +
681 (info_->scope()->num_parameters() - 1) * kPointerSize;
682 } else { 682 } else {
683 offset += JavaScriptFrameConstants::kLocal0Offset; 683 offset += JavaScriptFrameConstants::kLocal0Offset;
684 } 684 }
685 return Operand(rbp, offset); 685 return Operand(rbp, offset);
686 } 686 }
687 687
688 688
689 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { 689 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) {
690 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); 690 ASSERT(var->IsContextSlot() || var->IsStackAllocated());
691 if (var->IsContextSlot()) { 691 if (var->IsContextSlot()) {
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 2625
2626 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2626 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
2627 // Push copy of the first argument or undefined if it doesn't exist. 2627 // Push copy of the first argument or undefined if it doesn't exist.
2628 if (arg_count > 0) { 2628 if (arg_count > 0) {
2629 __ push(Operand(rsp, arg_count * kPointerSize)); 2629 __ push(Operand(rsp, arg_count * kPointerSize));
2630 } else { 2630 } else {
2631 __ PushRoot(Heap::kUndefinedValueRootIndex); 2631 __ PushRoot(Heap::kUndefinedValueRootIndex);
2632 } 2632 }
2633 2633
2634 // Push the receiver of the enclosing function and do runtime call. 2634 // Push the receiver of the enclosing function and do runtime call.
2635 __ push(Operand(rbp, (2 + info_->scope()->num_parameters()) * kPointerSize)); 2635 StackArgumentsAccessor args(rbp, info_->scope()->num_parameters());
2636 __ push(args.GetReceiverOperand());
2636 2637
2637 // Push the language mode. 2638 // Push the language mode.
2638 __ Push(Smi::FromInt(language_mode())); 2639 __ Push(Smi::FromInt(language_mode()));
2639 2640
2640 // Push the start position of the scope the calls resides in. 2641 // Push the start position of the scope the calls resides in.
2641 __ Push(Smi::FromInt(scope()->start_position())); 2642 __ Push(Smi::FromInt(scope()->start_position()));
2642 2643
2643 // Do the runtime call. 2644 // Do the runtime call.
2644 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2645 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2645 } 2646 }
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4946 4947
4947 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4948 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4948 Assembler::target_address_at(call_target_address)); 4949 Assembler::target_address_at(call_target_address));
4949 return OSR_AFTER_STACK_CHECK; 4950 return OSR_AFTER_STACK_CHECK;
4950 } 4951 }
4951 4952
4952 4953
4953 } } // namespace v8::internal 4954 } } // namespace v8::internal
4954 4955
4955 #endif // V8_TARGET_ARCH_X64 4956 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/frames-x64.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698