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/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 os << "Addr"; | 63 os << "Addr"; |
64 break; | 64 break; |
65 } | 65 } |
66 return os; | 66 return os; |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { | 70 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { |
71 // TODO(svenpanne) Output properties etc. and be less cryptic. | 71 // TODO(svenpanne) Output properties etc. and be less cryptic. |
72 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() | 72 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() |
73 << "s" << d.StackParameterCount() << "i" << d.InputCount() << "f" | 73 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" |
74 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); | 74 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 bool CallDescriptor::HasSameReturnLocationsAs( | 78 bool CallDescriptor::HasSameReturnLocationsAs( |
79 const CallDescriptor* other) const { | 79 const CallDescriptor* other) const { |
80 if (ReturnCount() != other->ReturnCount()) return false; | 80 if (ReturnCount() != other->ReturnCount()) return false; |
81 for (size_t i = 0; i < ReturnCount(); ++i) { | 81 for (size_t i = 0; i < ReturnCount(); ++i) { |
82 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; | 82 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; |
83 } | 83 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // plus the receiver. | 182 // plus the receiver. |
183 SharedFunctionInfo* shared = info->closure()->shared(); | 183 SharedFunctionInfo* shared = info->closure()->shared(); |
184 return GetJSCallDescriptor(zone, info->is_osr(), | 184 return GetJSCallDescriptor(zone, info->is_osr(), |
185 1 + shared->internal_formal_parameter_count(), | 185 1 + shared->internal_formal_parameter_count(), |
186 CallDescriptor::kNoFlags); | 186 CallDescriptor::kNoFlags); |
187 } | 187 } |
188 return NULL; // TODO(titzer): ? | 188 return NULL; // TODO(titzer): ? |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const { | 192 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, |
| 193 int extra) const { |
193 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || | 194 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || |
194 incoming_->kind() == CallDescriptor::kCallAddress) { | 195 incoming_->kind() == CallDescriptor::kCallAddress) { |
195 int offset; | 196 int offset; |
196 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 197 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
197 if (spill_slot >= 0) { | 198 if (spill_slot >= 0) { |
198 // Local or spill slot. Skip the frame pointer, function, and | 199 // Local or spill slot. Skip the frame pointer, function, and |
199 // context in the fixed part of the frame. | 200 // context in the fixed part of the frame. |
200 offset = -(spill_slot + 1) * kPointerSize - register_save_area_size; | 201 offset = |
| 202 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra; |
201 } else { | 203 } else { |
202 // Incoming parameter. Skip the return address. | 204 // Incoming parameter. Skip the return address. |
203 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + | 205 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + |
204 frame->PCOnStackSize(); | 206 kPCOnStackSize + extra; |
205 } | 207 } |
206 return FrameOffset::FromFramePointer(offset); | 208 return FrameOffset::FromFramePointer(offset); |
207 } else { | 209 } else { |
208 // No frame. Retrieve all parameters relative to stack pointer. | 210 // No frame. Retrieve all parameters relative to stack pointer. |
209 DCHECK(spill_slot < 0); // Must be a parameter. | 211 DCHECK(spill_slot < 0); // Must be a parameter. |
210 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 212 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
211 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + | 213 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + |
212 frame->PCOnStackSize(); | 214 kPCOnStackSize + extra; |
213 return FrameOffset::FromStackPointer(offset); | 215 return FrameOffset::FromStackPointer(offset); |
214 } | 216 } |
215 } | 217 } |
216 | 218 |
217 | 219 |
218 // static | 220 // static |
219 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { | 221 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { |
220 // Most runtime functions need a FrameState. A few chosen ones that we know | 222 // Most runtime functions need a FrameState. A few chosen ones that we know |
221 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize | 223 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize |
222 // are blacklisted here and can be called without a FrameState. | 224 // are blacklisted here and can be called without a FrameState. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return LinkageLocation::ForCalleeFrameSlot(spill_index); | 503 return LinkageLocation::ForCalleeFrameSlot(spill_index); |
502 } else { | 504 } else { |
503 // Parameter. Use the assigned location from the incoming call descriptor. | 505 // Parameter. Use the assigned location from the incoming call descriptor. |
504 int parameter_index = 1 + index; // skip index 0, which is the target. | 506 int parameter_index = 1 + index; // skip index 0, which is the target. |
505 return incoming_->GetInputLocation(parameter_index); | 507 return incoming_->GetInputLocation(parameter_index); |
506 } | 508 } |
507 } | 509 } |
508 } // namespace compiler | 510 } // namespace compiler |
509 } // namespace internal | 511 } // namespace internal |
510 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |