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 #include "src/compiler/osr.h" |
10 | 10 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return kMachNone; | 270 return kMachNone; |
271 } | 271 } |
272 }; | 272 }; |
273 | 273 |
274 | 274 |
275 LinkageLocation Linkage::GetOsrValueLocation(int index) const { | 275 LinkageLocation Linkage::GetOsrValueLocation(int index) const { |
276 CHECK(incoming_->IsJSFunctionCall()); | 276 CHECK(incoming_->IsJSFunctionCall()); |
277 int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1); | 277 int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1); |
278 int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count); | 278 int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count); |
279 | 279 |
280 if (index >= first_stack_slot) { | 280 if (index == kOsrContextSpillSlotIndex) { |
| 281 // Context. Use the parameter location of the context spill slot. |
| 282 // Parameter (arity + 1) is special for the context of the function frame. |
| 283 int context_index = 1 + 1 + parameter_count; // target + receiver + params |
| 284 return incoming_->GetInputLocation(context_index); |
| 285 } else if (index >= first_stack_slot) { |
281 // Local variable stored in this (callee) stack. | 286 // Local variable stored in this (callee) stack. |
282 int spill_index = | 287 int spill_index = |
283 LinkageLocation::ANY_REGISTER + 1 + index - first_stack_slot; | 288 LinkageLocation::ANY_REGISTER + 1 + index - first_stack_slot; |
284 // TODO(titzer): bailout instead of crashing here. | 289 // TODO(titzer): bailout instead of crashing here. |
285 CHECK(spill_index <= LinkageLocation::MAX_STACK_SLOT); | 290 CHECK(spill_index <= LinkageLocation::MAX_STACK_SLOT); |
286 return LinkageLocation(spill_index); | 291 return LinkageLocation(spill_index); |
287 } else { | 292 } else { |
288 // Parameter. Use the assigned location from the incoming call descriptor. | 293 // Parameter. Use the assigned location from the incoming call descriptor. |
289 int parameter_index = 1 + index; // skip index 0, which is the target. | 294 int parameter_index = 1 + index; // skip index 0, which is the target. |
290 return incoming_->GetInputLocation(parameter_index); | 295 return incoming_->GetInputLocation(parameter_index); |
291 } | 296 } |
292 } | 297 } |
293 | 298 |
294 } // namespace compiler | 299 } // namespace compiler |
295 } // namespace internal | 300 } // namespace internal |
296 } // namespace v8 | 301 } // namespace v8 |
297 | 302 |
298 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 303 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
OLD | NEW |