summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/linkage-impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/linkage-impl.h')
-rw-r--r--deps/v8/src/compiler/linkage-impl.h41
1 files changed, 35 insertions, 6 deletions
diff --git a/deps/v8/src/compiler/linkage-impl.h b/deps/v8/src/compiler/linkage-impl.h
index c13bd74f40..abd0696837 100644
--- a/deps/v8/src/compiler/linkage-impl.h
+++ b/deps/v8/src/compiler/linkage-impl.h
@@ -6,6 +6,7 @@
#define V8_COMPILER_LINKAGE_IMPL_H_
#include "src/code-stubs.h"
+#include "src/compiler/osr.h"
namespace v8 {
namespace internal {
@@ -28,7 +29,8 @@ class LinkageHelper {
}
// TODO(turbofan): cache call descriptors for JSFunction calls.
- static CallDescriptor* GetJSCallDescriptor(Zone* zone, int js_parameter_count,
+ static CallDescriptor* GetJSCallDescriptor(Zone* zone, bool is_osr,
+ int js_parameter_count,
CallDescriptor::Flags flags) {
const size_t return_count = 1;
const size_t context_count = 1;
@@ -55,7 +57,12 @@ class LinkageHelper {
// The target for JS function calls is the JSFunction object.
MachineType target_type = kMachAnyTagged;
- LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg());
+ // Unoptimized code doesn't preserve the JSCallFunctionReg, so expect the
+ // closure on the stack.
+ LinkageLocation target_loc =
+ is_osr ? stackloc(Linkage::kJSFunctionCallClosureParamIndex -
+ js_parameter_count)
+ : regloc(LinkageTraits::JSCallFunctionReg());
return new (zone) CallDescriptor( // --
CallDescriptor::kCallJSFunction, // kind
target_type, // target MachineType
@@ -133,7 +140,7 @@ class LinkageHelper {
// TODO(turbofan): cache call descriptors for code stub calls.
static CallDescriptor* GetStubCallDescriptor(
- Zone* zone, const CallInterfaceDescriptor& descriptor,
+ Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
int stack_parameter_count, CallDescriptor::Flags flags,
Operator::Properties properties) {
const int register_parameter_count =
@@ -182,11 +189,11 @@ class LinkageHelper {
properties, // properties
kNoCalleeSaved, // callee-saved registers
flags, // flags
- descriptor.DebugName(zone->isolate()));
+ descriptor.DebugName(isolate));
}
- static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone,
- MachineSignature* msig) {
+ static CallDescriptor* GetSimplifiedCDescriptor(
+ Zone* zone, const MachineSignature* msig) {
LocationSignature::Builder locations(zone, msig->return_count(),
msig->parameter_count());
// Add return location(s).
@@ -226,6 +233,28 @@ class LinkageHelper {
return LinkageLocation(i);
}
};
+
+
+LinkageLocation Linkage::GetOsrValueLocation(int index) const {
+ CHECK(incoming_->IsJSFunctionCall());
+ int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1);
+ int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count);
+
+ if (index >= first_stack_slot) {
+ // Local variable stored in this (callee) stack.
+ int spill_index =
+ LinkageLocation::ANY_REGISTER + 1 + index - first_stack_slot;
+ // TODO(titzer): bailout instead of crashing here.
+ CHECK(spill_index <= LinkageLocation::MAX_STACK_SLOT);
+ return LinkageLocation(spill_index);
+ } else {
+ // Parameter. Use the assigned location from the incoming call descriptor.
+ int parameter_index = 1 + index; // skip index 0, which is the target.
+ return incoming_->GetInputLocation(parameter_index);
+ }
+}
+
+
} // namespace compiler
} // namespace internal
} // namespace v8