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

Side by Side Diff: src/compiler/linkage.cc

Issue 1460183002: [turbofan] Add general support for sp-based frame access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All platforms Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler.h" 6 #include "src/compiler.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/frame.h" 8 #include "src/compiler/frame.h"
9 #include "src/compiler/frame-access-state.h"
9 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
10 #include "src/compiler/node.h" 11 #include "src/compiler/node.h"
11 #include "src/compiler/osr.h" 12 #include "src/compiler/osr.h"
12 #include "src/compiler/pipeline.h" 13 #include "src/compiler/pipeline.h"
13 #include "src/scopes.h" 14 #include "src/scopes.h"
14 15
15 namespace v8 { 16 namespace v8 {
16 namespace internal { 17 namespace internal {
17 namespace compiler { 18 namespace compiler {
18 19
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // plus the receiver. 141 // plus the receiver.
141 SharedFunctionInfo* shared = info->closure()->shared(); 142 SharedFunctionInfo* shared = info->closure()->shared();
142 return GetJSCallDescriptor(zone, info->is_osr(), 143 return GetJSCallDescriptor(zone, info->is_osr(),
143 1 + shared->internal_formal_parameter_count(), 144 1 + shared->internal_formal_parameter_count(),
144 CallDescriptor::kNoFlags); 145 CallDescriptor::kNoFlags);
145 } 146 }
146 return NULL; // TODO(titzer): ? 147 return NULL; // TODO(titzer): ?
147 } 148 }
148 149
149 150
150 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const { 151 FrameOffset Linkage::GetFrameOffset(
titzer 2015/11/23 20:00:54 Now that I think about this method in modern times
danno 2015/11/24 12:02:00 Done.
151 bool has_frame = frame->GetSpillSlotCount() > 0 || 152 int spill_slot, FrameAccessState* frame_access_state) const {
152 incoming_->IsJSFunctionCall() ||
153 incoming_->kind() == CallDescriptor::kCallAddress;
154 const int offset = 153 const int offset =
155 (StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) * 154 (StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) *
156 kPointerSize; 155 kPointerSize;
157 if (has_frame) { 156 if (frame_access_state->access_frame_with_fp()) {
157 DCHECK(frame_access_state->frame()->needs_frame());
158 return FrameOffset::FromFramePointer(offset); 158 return FrameOffset::FromFramePointer(offset);
159 } else { 159 } else {
160 // No frame. Retrieve all parameters relative to stack pointer. 160 // No frame. Retrieve all parameters relative to stack pointer.
161 DCHECK(spill_slot < 0); // Must be a parameter. 161 int sp_offset =
162 int sp_offset = offset + (frame->GetSpToFpSlotCount() * kPointerSize); 162 offset + ((frame_access_state->frame()->GetSpToFpSlotCount() +
163 frame_access_state->sp_delta()) *
164 kPointerSize);
163 return FrameOffset::FromStackPointer(sp_offset); 165 return FrameOffset::FromStackPointer(sp_offset);
164 } 166 }
165 } 167 }
166 168
167 169
168 // static 170 // static
169 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { 171 int Linkage::FrameStateInputCount(Runtime::FunctionId function) {
170 // Most runtime functions need a FrameState. A few chosen ones that we know 172 // Most runtime functions need a FrameState. A few chosen ones that we know
171 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize 173 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize
172 // are blacklisted here and can be called without a FrameState. 174 // are blacklisted here and can be called without a FrameState.
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } else { 544 } else {
543 DCHECK(loc == regloc(kContextRegister)); 545 DCHECK(loc == regloc(kContextRegister));
544 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); 546 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot);
545 } 547 }
546 } 548 }
547 549
548 550
549 } // namespace compiler 551 } // namespace compiler
550 } // namespace internal 552 } // namespace internal
551 } // namespace v8 553 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698