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/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 os << "InterpreterDispatch"; | 30 os << "InterpreterDispatch"; |
31 break; | 31 break; |
32 } | 32 } |
33 return os; | 33 return os; |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { | 37 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { |
38 // TODO(svenpanne) Output properties etc. and be less cryptic. | 38 // TODO(svenpanne) Output properties etc. and be less cryptic. |
39 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() | 39 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() |
40 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" | 40 << "s" << d.StackParameterCount() << "i" << d.InputCount() << "f" |
41 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); | 41 << d.FrameStateCount() << "t" << d.SupportsTailCalls(); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 bool CallDescriptor::HasSameReturnLocationsAs( | 45 bool CallDescriptor::HasSameReturnLocationsAs( |
46 const CallDescriptor* other) const { | 46 const CallDescriptor* other) const { |
47 if (ReturnCount() != other->ReturnCount()) return false; | 47 if (ReturnCount() != other->ReturnCount()) return false; |
48 for (size_t i = 0; i < ReturnCount(); ++i) { | 48 for (size_t i = 0; i < ReturnCount(); ++i) { |
49 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; | 49 if (GetReturnLocation(i) != other->GetReturnLocation(i)) return false; |
50 } | 50 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // plus the receiver. | 149 // plus the receiver. |
150 SharedFunctionInfo* shared = info->closure()->shared(); | 150 SharedFunctionInfo* shared = info->closure()->shared(); |
151 return GetJSCallDescriptor(zone, info->is_osr(), | 151 return GetJSCallDescriptor(zone, info->is_osr(), |
152 1 + shared->internal_formal_parameter_count(), | 152 1 + shared->internal_formal_parameter_count(), |
153 CallDescriptor::kNoFlags); | 153 CallDescriptor::kNoFlags); |
154 } | 154 } |
155 return NULL; // TODO(titzer): ? | 155 return NULL; // TODO(titzer): ? |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, | 159 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const { |
160 int extra) const { | |
161 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || | 160 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || |
162 incoming_->kind() == CallDescriptor::kCallAddress) { | 161 incoming_->kind() == CallDescriptor::kCallAddress) { |
163 int offset; | 162 int offset; |
164 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 163 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
165 if (spill_slot >= 0) { | 164 if (spill_slot >= 0) { |
166 // Local or spill slot. Skip the frame pointer, function, and | 165 // Local or spill slot. Skip the frame pointer, function, and |
167 // context in the fixed part of the frame. | 166 // context in the fixed part of the frame. |
168 offset = | 167 offset = -(spill_slot + 1) * kPointerSize - register_save_area_size; |
169 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra; | |
170 } else { | 168 } else { |
171 // Incoming parameter. Skip the return address. | 169 // Incoming parameter. Skip the return address. |
172 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + | 170 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + |
173 kPCOnStackSize + extra; | 171 frame->PCOnStackSize(); |
174 } | 172 } |
175 return FrameOffset::FromFramePointer(offset); | 173 return FrameOffset::FromFramePointer(offset); |
176 } else { | 174 } else { |
177 // No frame. Retrieve all parameters relative to stack pointer. | 175 // No frame. Retrieve all parameters relative to stack pointer. |
178 DCHECK(spill_slot < 0); // Must be a parameter. | 176 DCHECK(spill_slot < 0); // Must be a parameter. |
179 int register_save_area_size = frame->GetRegisterSaveAreaSize(); | 177 int register_save_area_size = frame->GetRegisterSaveAreaSize(); |
180 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + | 178 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + |
181 kPCOnStackSize + extra; | 179 frame->PCOnStackSize(); |
182 return FrameOffset::FromStackPointer(offset); | 180 return FrameOffset::FromStackPointer(offset); |
183 } | 181 } |
184 } | 182 } |
185 | 183 |
186 | 184 |
187 // static | 185 // static |
188 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { | 186 int Linkage::FrameStateInputCount(Runtime::FunctionId function) { |
189 // Most runtime functions need a FrameState. A few chosen ones that we know | 187 // Most runtime functions need a FrameState. A few chosen ones that we know |
190 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize | 188 // not to call into arbitrary JavaScript, not to throw, and not to deoptimize |
191 // are blacklisted here and can be called without a FrameState. | 189 // are blacklisted here and can be called without a FrameState. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 Operator::Properties properties, MachineType return_type) { | 278 Operator::Properties properties, MachineType return_type) { |
281 UNIMPLEMENTED(); | 279 UNIMPLEMENTED(); |
282 return NULL; | 280 return NULL; |
283 } | 281 } |
284 | 282 |
285 | 283 |
286 #endif // !V8_TURBOFAN_BACKEND | 284 #endif // !V8_TURBOFAN_BACKEND |
287 } // namespace compiler | 285 } // namespace compiler |
288 } // namespace internal | 286 } // namespace internal |
289 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |