Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc
index 105bd35..5e217b0 100644
--- a/src/compiler/linkage.cc
+++ b/src/compiler/linkage.cc
@@ -88,7 +88,7 @@
bool CallDescriptor::CanTailCall(const Node* node,
int* stack_param_delta) const {
- CallDescriptor const* other = OpParameter<CallDescriptor const*>(node);
+ CallDescriptor const* other = CallDescriptorOf(node->op());
size_t current_input = 0;
size_t other_input = 0;
*stack_param_delta = 0;
@@ -112,19 +112,12 @@
++current_input;
++other_input;
}
- return HasSameReturnLocationsAs(OpParameter<CallDescriptor const*>(node));
+ return HasSameReturnLocationsAs(CallDescriptorOf(node->op()));
}
CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) {
DCHECK(!info->IsStub());
- if (info->has_literal()) {
- // If we already have the function literal, use the number of parameters
- // plus the receiver.
- return GetJSCallDescriptor(zone, info->is_osr(),
- 1 + info->literal()->parameter_count(),
- CallDescriptor::kNoFlags);
- }
if (!info->closure().is_null()) {
// If we are compiling a JS function, use a JS call descriptor,
// plus the receiver.
@@ -143,14 +136,19 @@
// not to call into arbitrary JavaScript, not to throw, and not to deoptimize
// are blacklisted here and can be called without a FrameState.
switch (function) {
+ case Runtime::kAbort:
case Runtime::kAllocateInTargetSpace:
case Runtime::kCreateIterResultObject:
case Runtime::kDefineDataPropertyInLiteral:
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
- case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
case Runtime::kForInDone:
case Runtime::kForInStep:
+ case Runtime::kGeneratorSetContext:
+ case Runtime::kGeneratorGetContinuation:
+ case Runtime::kGeneratorSetContinuation:
+ case Runtime::kGeneratorLoadRegister:
+ case Runtime::kGeneratorStoreRegister:
case Runtime::kGetSuperConstructor:
case Runtime::kIsFunction:
case Runtime::kNewClosure:
@@ -166,6 +164,7 @@
case Runtime::kStringLessThanOrEqual:
case Runtime::kStringGreaterThan:
case Runtime::kStringGreaterThanOrEqual:
+ case Runtime::kToFastProperties: // TODO(conradw): Is it safe?
case Runtime::kTraceEnter:
case Runtime::kTraceExit:
return 0;
@@ -411,6 +410,78 @@
descriptor.DebugName(isolate));
}
+// static
+CallDescriptor* Linkage::GetAllocateCallDescriptor(Zone* zone) {
+ LocationSignature::Builder locations(zone, 1, 1);
+ MachineSignature::Builder types(zone, 1, 1);
+
+ locations.AddParam(regloc(kAllocateSizeRegister));
+ types.AddParam(MachineType::Int32());
+
+ locations.AddReturn(regloc(kReturnRegister0));
+ types.AddReturn(MachineType::AnyTagged());
+
+ // The target for allocate calls is a code object.
+ MachineType target_type = MachineType::AnyTagged();
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallCodeObject, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ 0, // stack_parameter_count
+ Operator::kNoThrow, // properties
+ kNoCalleeSaved, // callee-saved registers
+ kNoCalleeSaved, // callee-saved fp
+ CallDescriptor::kCanUseRoots, // flags
+ "Allocate");
+}
+
+// static
+CallDescriptor* Linkage::GetBytecodeDispatchCallDescriptor(
+ Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
+ int stack_parameter_count) {
+ const int register_parameter_count = descriptor.GetRegisterParameterCount();
+ const int parameter_count = register_parameter_count + stack_parameter_count;
+
+ LocationSignature::Builder locations(zone, 0, parameter_count);
+ MachineSignature::Builder types(zone, 0, parameter_count);
+
+ // Add parameters in registers and on the stack.
+ for (int i = 0; i < parameter_count; i++) {
+ if (i < register_parameter_count) {
+ // The first parameters go in registers.
+ Register reg = descriptor.GetRegisterParameter(i);
+ Representation rep =
+ RepresentationFromType(descriptor.GetParameterType(i));
+ locations.AddParam(regloc(reg));
+ types.AddParam(reptyp(rep));
+ } else {
+ // The rest of the parameters go on the stack.
+ int stack_slot = i - register_parameter_count - stack_parameter_count;
+ locations.AddParam(LinkageLocation::ForCallerFrameSlot(stack_slot));
+ types.AddParam(MachineType::AnyTagged());
+ }
+ }
+
+ // The target for interpreter dispatches is a code entry address.
+ MachineType target_type = MachineType::Pointer();
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallAddress, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ stack_parameter_count, // stack_parameter_count
+ Operator::kNoProperties, // properties
+ kNoCalleeSaved, // callee-saved registers
+ kNoCalleeSaved, // callee-saved fp
+ CallDescriptor::kCanUseRoots | // flags
+ CallDescriptor::kSupportsTailCalls, // flags
+ descriptor.DebugName(isolate));
+}
LinkageLocation Linkage::GetOsrValueLocation(int index) const {
CHECK(incoming_->IsJSFunctionCall());