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 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ | 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ |
6 #define V8_COMPILER_LINKAGE_IMPL_H_ | 6 #define V8_COMPILER_LINKAGE_IMPL_H_ |
7 | 7 |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler/osr.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 namespace compiler { | 13 namespace compiler { |
13 | 14 |
14 // TODO(titzer): replace uses of int with size_t in LinkageHelper. | 15 // TODO(titzer): replace uses of int with size_t in LinkageHelper. |
15 template <typename LinkageTraits> | 16 template <typename LinkageTraits> |
16 class LinkageHelper { | 17 class LinkageHelper { |
17 public: | 18 public: |
18 static const RegList kNoCalleeSaved = 0; | 19 static const RegList kNoCalleeSaved = 0; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 220 |
220 static LinkageLocation regloc(Register reg) { | 221 static LinkageLocation regloc(Register reg) { |
221 return LinkageLocation(Register::ToAllocationIndex(reg)); | 222 return LinkageLocation(Register::ToAllocationIndex(reg)); |
222 } | 223 } |
223 | 224 |
224 static LinkageLocation stackloc(int i) { | 225 static LinkageLocation stackloc(int i) { |
225 DCHECK_LT(i, 0); | 226 DCHECK_LT(i, 0); |
226 return LinkageLocation(i); | 227 return LinkageLocation(i); |
227 } | 228 } |
228 }; | 229 }; |
| 230 |
| 231 |
| 232 LinkageLocation Linkage::GetOsrValueLocation(int index) const { |
| 233 CHECK(incoming_->IsJSFunctionCall()); |
| 234 int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1); |
| 235 int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count); |
| 236 |
| 237 if (index >= first_stack_slot) { |
| 238 // Local variable stored in this (callee) stack. |
| 239 int spill_index = |
| 240 LinkageLocation::ANY_REGISTER + 1 + index - first_stack_slot; |
| 241 // TODO(titzer): bailout instead of crashing here. |
| 242 CHECK(spill_index <= LinkageLocation::MAX_STACK_SLOT); |
| 243 return LinkageLocation(spill_index); |
| 244 } else { |
| 245 // Parameter. Use the assigned location from the incoming call descriptor. |
| 246 int parameter_index = 1 + index; // skip index 0, which is the target. |
| 247 return incoming_->GetInputLocation(parameter_index); |
| 248 } |
| 249 } |
| 250 |
| 251 |
229 } // namespace compiler | 252 } // namespace compiler |
230 } // namespace internal | 253 } // namespace internal |
231 } // namespace v8 | 254 } // namespace v8 |
232 | 255 |
233 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 256 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
OLD | NEW |