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 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" | 73 << "s" << d.StackParameterCount() << "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, | 192 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const { |
193 int extra) const { | |
194 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || | 193 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || |
195 incoming_->kind() == CallDescriptor::kCallAddress) { | 194 incoming_->kind() == CallDescriptor::kCallAddress) { |
196 int offset; | 195 int offset; |
197 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 196 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
198 if (spill_slot >= 0) { | 197 if (spill_slot >= 0) { |
199 // Local or spill slot. Skip the frame pointer, function, and | 198 // Local or spill slot. Skip the frame pointer, function, and |
200 // context in the fixed part of the frame. | 199 // context in the fixed part of the frame. |
201 offset = | 200 offset = -(spill_slot + 1) * kPointerSize - register_save_area_size; |
202 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra; | |
203 } else { | 201 } else { |
204 // Incoming parameter. Skip the return address. | 202 // Incoming parameter. Skip the return address. |
205 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + | 203 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + |
206 kPCOnStackSize + extra; | 204 frame->PCOnStackSize(); |
207 } | 205 } |
208 return FrameOffset::FromFramePointer(offset); | 206 return FrameOffset::FromFramePointer(offset); |
209 } else { | 207 } else { |
210 // No frame. Retrieve all parameters relative to stack pointer. | 208 // No frame. Retrieve all parameters relative to stack pointer. |
211 DCHECK(spill_slot < 0); // Must be a parameter. | 209 DCHECK(spill_slot < 0); // Must be a parameter. |
212 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 210 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
213 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + | 211 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + |
214 kPCOnStackSize + extra; | 212 frame->PCOnStackSize(); |
215 return FrameOffset::FromStackPointer(offset); | 213 return FrameOffset::FromStackPointer(offset); |
216 } | 214 } |
217 } | 215 } |
218 | 216 |
219 | 217 |
220 // static | 218 // static |
221 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { | 219 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { |
222 // Most runtime functions need a FrameState. A few chosen ones that we know | 220 // Most runtime functions need a FrameState. A few chosen ones that we know |
223 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize | 221 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize |
224 // are blacklisted here and can be called without a FrameState. | 222 // are blacklisted here and can be called without a FrameState. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 return LinkageLocation::ForCalleeFrameSlot(spill_index); | 501 return LinkageLocation::ForCalleeFrameSlot(spill_index); |
504 } else { | 502 } else { |
505 // Parameter. Use the assigned location from the incoming call descriptor. | 503 // Parameter. Use the assigned location from the incoming call descriptor. |
506 int parameter_index = 1 + index; // skip index 0, which is the target. | 504 int parameter_index = 1 + index; // skip index 0, which is the target. |
507 return incoming_->GetInputLocation(parameter_index); | 505 return incoming_->GetInputLocation(parameter_index); |
508 } | 506 } |
509 } | 507 } |
510 } // namespace compiler | 508 } // namespace compiler |
511 } // namespace internal | 509 } // namespace internal |
512 } // namespace v8 | 510 } // namespace v8 |
OLD | NEW |