OLD | NEW |
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 Loading... |
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( |
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } else { | 539 } else { |
538 DCHECK(loc == regloc(kContextRegister)); | 540 DCHECK(loc == regloc(kContextRegister)); |
539 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); | 541 return LinkageLocation::ForCalleeFrameSlot(Frame::kContextSlot); |
540 } | 542 } |
541 } | 543 } |
542 | 544 |
543 | 545 |
544 } // namespace compiler | 546 } // namespace compiler |
545 } // namespace internal | 547 } // namespace internal |
546 } // namespace v8 | 548 } // namespace v8 |
OLD | NEW |