2014-08-29 10:40:02 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "src/interface-descriptors.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
|
|
|
|
void CallInterfaceDescriptorData::InitializePlatformSpecific(
|
2016-06-02 09:25:46 +00:00
|
|
|
int register_parameter_count, const Register* registers,
|
2014-08-29 10:40:02 +00:00
|
|
|
PlatformInterfaceDescriptor* platform_descriptor) {
|
|
|
|
platform_specific_descriptor_ = platform_descriptor;
|
|
|
|
register_param_count_ = register_parameter_count;
|
|
|
|
|
|
|
|
// InterfaceDescriptor owns a copy of the registers array.
|
[assembler] Make Register et al. real classes
Up to now, each architecture defined all Register types as structs,
with lots of redundancy. An often found comment noted that they cannot
be classes due to initialization order problems. As these problems are
gone with C++11 constexpr constants, I now tried making Registers
classes again.
All register types now inherit from RegisterBase, which provides a
default set of methods and named constructors (like ::from_code,
code(), bit(), is_valid(), ...).
This design allows to guarantee an interesting property: Each register
is either valid, or it's the no_reg register. There are no other
invalid registers. This is guaranteed statically by the constexpr
constructor, and dynamically by ::from_code.
I decided to disallow the default constructor completely, so instead of
"Register reg;" you now need "Register reg = no_reg;". This makes
explicit how the Register is initialized.
I did this change to the x64, ia32, arm, arm64, mips and mips64 ports.
Overall, code got much more compact and more safe. In theory, it should
also increase performance (since the is_valid() check is simpler), but
this is probably not measurable.
R=mstarzinger@chromium.org
Change-Id: I5ccfa4050daf4e146a557970e9d37fd3d2788d4a
Reviewed-on: https://chromium-review.googlesource.com/650927
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47847}
2017-09-06 08:05:07 +00:00
|
|
|
register_params_.reset(NewArray<Register>(register_parameter_count, no_reg));
|
2014-08-29 10:40:02 +00:00
|
|
|
for (int i = 0; i < register_parameter_count; i++) {
|
|
|
|
register_params_[i] = registers[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void CallInterfaceDescriptorData::InitializePlatformIndependent(
|
|
|
|
int parameter_count, int extra_parameter_count,
|
|
|
|
const MachineType* machine_types) {
|
|
|
|
// InterfaceDescriptor owns a copy of the MachineType array.
|
|
|
|
// We only care about parameters, not receiver and result.
|
|
|
|
param_count_ = parameter_count + extra_parameter_count;
|
|
|
|
machine_types_.reset(NewArray<MachineType>(param_count_));
|
|
|
|
for (int i = 0; i < param_count_; i++) {
|
2017-10-13 16:33:03 +00:00
|
|
|
if (machine_types == nullptr || i >= parameter_count) {
|
2016-09-01 20:08:42 +00:00
|
|
|
machine_types_[i] = MachineType::AnyTagged();
|
|
|
|
} else {
|
|
|
|
machine_types_[i] = machine_types[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-30 09:00:58 +00:00
|
|
|
const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
|
2014-09-08 15:18:54 +00:00
|
|
|
CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
|
2014-09-08 16:18:37 +00:00
|
|
|
size_t index = data_ - start;
|
2014-09-08 15:18:54 +00:00
|
|
|
DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
|
|
|
|
CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
|
|
|
|
switch (key) {
|
2017-04-07 15:42:11 +00:00
|
|
|
#define DEF_CASE(NAME, ...) \
|
2014-09-08 15:18:54 +00:00
|
|
|
case CallDescriptors::NAME: \
|
|
|
|
return #NAME " Descriptor";
|
|
|
|
INTERFACE_DESCRIPTOR_LIST(DEF_CASE)
|
|
|
|
#undef DEF_CASE
|
|
|
|
case CallDescriptors::NUMBER_OF_DESCRIPTORS:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-02 12:35:12 +00:00
|
|
|
void VoidDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
data->InitializePlatformSpecific(0, nullptr);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void FastNewFunctionContextDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2016-08-01 19:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FastNewFunctionContextDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {FunctionRegister(), SlotsRegister()};
|
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-12-29 11:11:14 +00:00
|
|
|
void FastNewObjectDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {TargetRegister(), NewTargetRegister()};
|
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Register FastNewObjectDescriptor::TargetRegister() {
|
|
|
|
return kJSFunctionRegister;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Register FastNewObjectDescriptor::NewTargetRegister() {
|
|
|
|
return kJavaScriptCallNewTargetRegister;
|
|
|
|
}
|
|
|
|
|
2017-02-07 16:02:44 +00:00
|
|
|
void FastNewArgumentsDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {TargetRegister()};
|
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Register FastNewArgumentsDescriptor::TargetRegister() {
|
|
|
|
return kJSFunctionRegister;
|
|
|
|
}
|
|
|
|
|
2017-08-03 11:17:17 +00:00
|
|
|
void RecordWriteDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
MachineType machine_types[] = {MachineType::TaggedPointer(),
|
2017-09-22 09:13:07 +00:00
|
|
|
MachineType::Pointer(), MachineType::Pointer(),
|
|
|
|
MachineType::TaggedSigned(),
|
|
|
|
MachineType::TaggedSigned()};
|
2017-08-03 11:17:17 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void LoadDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kName, kSlot
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2015-06-24 06:21:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoadDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
2014-09-03 10:51:51 +00:00
|
|
|
}
|
|
|
|
|
2016-12-23 12:01:26 +00:00
|
|
|
void LoadFieldDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kSmiHandler
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoadFieldDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {ReceiverRegister(), SmiHandlerRegister()};
|
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void LoadGlobalDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-11-16 18:17:22 +00:00
|
|
|
// kName, kSlot
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned()};
|
2016-09-01 20:08:42 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2016-06-15 12:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoadGlobalDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-11-16 18:17:22 +00:00
|
|
|
Register registers[] = {NameRegister(), SlotRegister()};
|
2016-06-15 12:34:57 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void LoadGlobalWithVectorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-11-16 18:17:22 +00:00
|
|
|
// kName, kSlot, kVector
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned(),
|
2016-09-01 20:08:42 +00:00
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2016-06-14 13:20:42 +00:00
|
|
|
}
|
|
|
|
|
2016-06-15 12:34:57 +00:00
|
|
|
void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific(
|
2016-06-14 13:20:42 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-11-16 18:17:22 +00:00
|
|
|
Register registers[] = {NameRegister(), SlotRegister(), VectorRegister()};
|
2016-06-14 13:20:42 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
2014-09-03 10:51:51 +00:00
|
|
|
|
2017-12-13 09:30:08 +00:00
|
|
|
void StoreGlobalDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kName, kValue, kSlot
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StoreGlobalDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {NameRegister(), ValueRegister(), SlotRegister()};
|
|
|
|
|
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
|
|
|
data->InitializePlatformSpecific(len, registers);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StoreGlobalWithVectorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kName, kValue, kSlot, kVector
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned(), MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StoreGlobalWithVectorDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {NameRegister(), ValueRegister(), SlotRegister(),
|
|
|
|
VectorRegister()};
|
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
|
|
|
data->InitializePlatformSpecific(len, registers);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void StoreDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kName, kValue, kSlot
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::TaggedSigned()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2016-07-14 17:04:22 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void StoreDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-07-14 17:04:22 +00:00
|
|
|
Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
|
|
|
|
SlotRegister()};
|
2014-09-03 10:51:51 +00:00
|
|
|
|
2016-09-22 08:43:53 +00:00
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
|
|
|
data->InitializePlatformSpecific(len, registers);
|
2015-08-21 09:04:43 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 14:23:26 +00:00
|
|
|
void StoreTransitionDescriptor::InitializePlatformSpecific(
|
2015-10-12 07:34:18 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-09-16 14:23:26 +00:00
|
|
|
Register registers[] = {
|
|
|
|
ReceiverRegister(), NameRegister(), MapRegister(),
|
|
|
|
ValueRegister(), SlotRegister(), VectorRegister(),
|
|
|
|
};
|
2016-09-22 08:43:53 +00:00
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
2016-09-16 14:23:26 +00:00
|
|
|
data->InitializePlatformSpecific(len, registers);
|
2015-10-12 07:34:18 +00:00
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void StoreTransitionDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-09-16 14:23:26 +00:00
|
|
|
// kReceiver, kName, kMap, kValue, kSlot, kVector
|
2016-09-01 20:08:42 +00:00
|
|
|
MachineType machine_types[] = {
|
2016-09-16 14:23:26 +00:00
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned(), MachineType::AnyTagged()};
|
2016-09-01 20:08:42 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2015-07-13 09:18:44 +00:00
|
|
|
}
|
|
|
|
|
2016-10-05 14:56:57 +00:00
|
|
|
void StoreNamedTransitionDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kFieldOffset, kMap, kValue, kSlot, kVector, kName
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::TaggedSigned(),
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StoreNamedTransitionDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
Register registers[] = {
|
|
|
|
ReceiverRegister(), FieldOffsetRegister(), MapRegister(),
|
|
|
|
ValueRegister(), SlotRegister(), VectorRegister(),
|
|
|
|
NameRegister(),
|
|
|
|
};
|
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
|
|
|
data->InitializePlatformSpecific(len, registers);
|
|
|
|
}
|
|
|
|
|
2018-01-15 09:21:20 +00:00
|
|
|
void StringAtDescriptor::InitializePlatformIndependent(
|
2016-12-22 07:11:22 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kPosition
|
|
|
|
// TODO(turbofan): Allow builtins to return untagged values.
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::IntPtr()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2018-01-15 09:21:20 +00:00
|
|
|
void StringAtDescriptor::InitializePlatformSpecific(
|
2016-12-22 07:11:22 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
DefaultInitializePlatformSpecific(data, kParameterCount);
|
|
|
|
}
|
|
|
|
|
2016-03-21 06:02:17 +00:00
|
|
|
void TypeConversionDescriptor::InitializePlatformSpecific(
|
2015-07-31 12:25:28 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-03-21 06:02:17 +00:00
|
|
|
Register registers[] = {ArgumentRegister()};
|
2015-07-31 12:25:28 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2017-06-22 15:43:35 +00:00
|
|
|
void TypeConversionStackParameterDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
data->InitializePlatformSpecific(0, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypeConversionStackParameterDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2017-10-13 16:33:03 +00:00
|
|
|
data->InitializePlatformIndependent(data->register_param_count(), 1, nullptr);
|
2017-06-22 15:43:35 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void MathPowTaggedDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {exponent()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
2014-09-11 07:11:10 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void MathPowIntegerDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {exponent()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-12-23 12:01:26 +00:00
|
|
|
const Register LoadFieldDescriptor::ReceiverRegister() {
|
|
|
|
// Reuse the register from the LoadDescriptor, since given the
|
|
|
|
// LoadFieldDescriptor's usage, it doesn't matter exactly which registers are
|
|
|
|
// used to pass parameters in.
|
|
|
|
return LoadDescriptor::ReceiverRegister();
|
|
|
|
}
|
|
|
|
const Register LoadFieldDescriptor::SmiHandlerRegister() {
|
|
|
|
// Reuse the register from the LoadDescriptor, since given the
|
|
|
|
// LoadFieldDescriptor's usage, it doesn't matter exactly which registers are
|
|
|
|
// used to pass parameters in.
|
|
|
|
return LoadDescriptor::NameRegister();
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void LoadWithVectorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kName, kSlot, kVector
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::TaggedSigned(), MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2014-09-11 07:11:10 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void LoadWithVectorDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
|
|
|
|
VectorRegister()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void StoreWithVectorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kReceiver, kName, kValue, kSlot, kVector
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::TaggedSigned(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2015-05-22 14:36:48 +00:00
|
|
|
}
|
|
|
|
|
2016-07-14 17:04:22 +00:00
|
|
|
void StoreWithVectorDescriptor::InitializePlatformSpecific(
|
2015-06-24 06:21:47 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
|
|
|
|
SlotRegister(), VectorRegister()};
|
2016-09-22 08:43:53 +00:00
|
|
|
int len = arraysize(registers) - kStackArgumentsCount;
|
|
|
|
data->InitializePlatformSpecific(len, registers);
|
2015-05-22 14:36:48 +00:00
|
|
|
}
|
|
|
|
|
2016-04-20 08:01:08 +00:00
|
|
|
const Register ApiGetterDescriptor::ReceiverRegister() {
|
|
|
|
return LoadDescriptor::ReceiverRegister();
|
2015-06-24 06:21:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ApiGetterDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-04-20 08:01:08 +00:00
|
|
|
Register registers[] = {ReceiverRegister(), HolderRegister(),
|
|
|
|
CallbackRegister()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
2014-09-11 07:11:10 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void ContextOnlyDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
data->InitializePlatformSpecific(0, nullptr);
|
2014-09-03 10:51:51 +00:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:21:47 +00:00
|
|
|
void GrowArrayElementsDescriptor::InitializePlatformSpecific(
|
2015-04-30 12:34:02 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2015-07-01 08:45:05 +00:00
|
|
|
Register registers[] = {ObjectRegister(), KeyRegister()};
|
2015-06-24 06:21:47 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
2016-12-08 08:28:13 +00:00
|
|
|
void NewArgumentsElementsDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2017-09-01 08:54:08 +00:00
|
|
|
// kFrame, kLength, kMappedCount
|
2017-02-28 11:16:27 +00:00
|
|
|
MachineType const kMachineTypes[] = {MachineType::Pointer(),
|
2017-09-01 08:54:08 +00:00
|
|
|
MachineType::TaggedSigned(),
|
2017-02-28 11:16:27 +00:00
|
|
|
MachineType::TaggedSigned()};
|
2016-12-08 08:28:13 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(kMachineTypes), 0,
|
|
|
|
kMachineTypes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewArgumentsElementsDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2017-09-01 08:54:08 +00:00
|
|
|
DefaultInitializePlatformSpecific(data, 3);
|
2016-12-08 08:28:13 +00:00
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void CallTrampolineDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kActualArgumentsCount
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-06-08 18:31:59 +00:00
|
|
|
void CallVarargsDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kActualArgumentsCount, kArgumentsList, kArgumentsLength
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged(),
|
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-01-26 09:29:56 +00:00
|
|
|
void CallForwardVarargsDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
[turbofan] Avoid allocating rest parameters for spread calls.
We already had an optimization to turn Function.prototype.apply with
arguments object, i.e.
function foo() { return bar.apply(this, arguments); }
into a special operator JSCallForwardVarargs, which avoids the
allocation and deconstruction of the arguments object, but just passes
along the incoming parameters. We can do the same for rest parameters
and spread calls/constructs, i.e.
class A extends B {
constructor(...args) { super(...args); }
}
or
function foo(...args) { return bar(1, 2, 3, ...args); }
where we basically pass along the parameters (plus maybe additional
statically known parameters).
For this, we introduce a new JSConstructForwardVarargs operator and
generalize the CallForwardVarargs builtins that are backing this.
BUG=v8:6407,v8:6278,v8:6344
R=jarin@chromium.org
Review-Url: https://codereview.chromium.org/2890023004
Cr-Commit-Position: refs/heads/master@{#45388}
2017-05-18 07:32:22 +00:00
|
|
|
// kTarget, kActualArgumentsCount, kStartIndex
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-06-20 11:14:26 +00:00
|
|
|
void CallWithSpreadDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kArgumentsCount, kArgumentsList
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-06-08 18:31:59 +00:00
|
|
|
void CallWithArrayLikeDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kArgumentsList
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConstructVarargsDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kNewTarget, kActualArgumentsCount, kArgumentsList,
|
|
|
|
// kArgumentsLength
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
[turbofan] Avoid allocating rest parameters for spread calls.
We already had an optimization to turn Function.prototype.apply with
arguments object, i.e.
function foo() { return bar.apply(this, arguments); }
into a special operator JSCallForwardVarargs, which avoids the
allocation and deconstruction of the arguments object, but just passes
along the incoming parameters. We can do the same for rest parameters
and spread calls/constructs, i.e.
class A extends B {
constructor(...args) { super(...args); }
}
or
function foo(...args) { return bar(1, 2, 3, ...args); }
where we basically pass along the parameters (plus maybe additional
statically known parameters).
For this, we introduce a new JSConstructForwardVarargs operator and
generalize the CallForwardVarargs builtins that are backing this.
BUG=v8:6407,v8:6278,v8:6344
R=jarin@chromium.org
Review-Url: https://codereview.chromium.org/2890023004
Cr-Commit-Position: refs/heads/master@{#45388}
2017-05-18 07:32:22 +00:00
|
|
|
void ConstructForwardVarargsDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kNewTarget, kActualArgumentsCount, kStartIndex
|
2017-01-26 09:29:56 +00:00
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
[turbofan] Avoid allocating rest parameters for spread calls.
We already had an optimization to turn Function.prototype.apply with
arguments object, i.e.
function foo() { return bar.apply(this, arguments); }
into a special operator JSCallForwardVarargs, which avoids the
allocation and deconstruction of the arguments object, but just passes
along the incoming parameters. We can do the same for rest parameters
and spread calls/constructs, i.e.
class A extends B {
constructor(...args) { super(...args); }
}
or
function foo(...args) { return bar(1, 2, 3, ...args); }
where we basically pass along the parameters (plus maybe additional
statically known parameters).
For this, we introduce a new JSConstructForwardVarargs operator and
generalize the CallForwardVarargs builtins that are backing this.
BUG=v8:6407,v8:6278,v8:6344
R=jarin@chromium.org
Review-Url: https://codereview.chromium.org/2890023004
Cr-Commit-Position: refs/heads/master@{#45388}
2017-05-18 07:32:22 +00:00
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
2017-01-26 09:29:56 +00:00
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-06-20 11:14:26 +00:00
|
|
|
void ConstructWithSpreadDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kNewTarget, kArgumentsCount, kSpread
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-06-08 18:31:59 +00:00
|
|
|
void ConstructWithArrayLikeDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kNewTarget, kArgumentsList
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void ConstructStubDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kNewTarget, kActualArgumentsCount, kAllocationSite
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConstructTrampolineDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kNewTarget, kActualArgumentsCount
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2016-11-07 21:26:18 +00:00
|
|
|
void BuiltinDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-12-14 10:50:59 +00:00
|
|
|
// kTarget, kNewTarget, kArgumentsCount
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
|
2016-11-07 21:26:18 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BuiltinDescriptor::InitializePlatformSpecific(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
2016-11-29 16:57:58 +00:00
|
|
|
Register registers[] = {TargetRegister(), NewTargetRegister(),
|
|
|
|
ArgumentsCountRegister()};
|
2016-11-07 21:26:18 +00:00
|
|
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Register BuiltinDescriptor::ArgumentsCountRegister() {
|
|
|
|
return kJavaScriptCallArgCountRegister;
|
|
|
|
}
|
|
|
|
const Register BuiltinDescriptor::NewTargetRegister() {
|
|
|
|
return kJavaScriptCallNewTargetRegister;
|
|
|
|
}
|
|
|
|
|
2016-11-29 16:57:58 +00:00
|
|
|
const Register BuiltinDescriptor::TargetRegister() {
|
|
|
|
return kJSFunctionRegister;
|
|
|
|
}
|
|
|
|
|
2017-02-02 13:29:33 +00:00
|
|
|
void ArrayConstructorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite
|
|
|
|
MachineType machine_types[] = {MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void ArrayNoArgumentConstructorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter
|
|
|
|
MachineType machine_types[] = {MachineType::TaggedPointer(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArraySingleArgumentConstructorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter,
|
|
|
|
// kArraySizeSmiParameter
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::TaggedPointer(), MachineType::AnyTagged(),
|
|
|
|
MachineType::Int32(), MachineType::AnyTagged(), MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArrayNArgumentsConstructorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kAllocationSite, kActualArgumentsCount
|
2017-02-02 13:29:33 +00:00
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
|
2016-09-01 20:08:42 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArgumentAdaptorDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kFunction, kNewTarget, kActualArgumentsCount, kExpectedArgumentsCount
|
|
|
|
MachineType machine_types[] = {MachineType::TaggedPointer(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Int32(),
|
|
|
|
MachineType::Int32()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2015-06-24 06:21:47 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 11:08:25 +00:00
|
|
|
void ApiCallbackDescriptor::InitializePlatformIndependent(
|
2016-09-01 20:08:42 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
2017-11-06 14:10:18 +00:00
|
|
|
// kTargetContext, kCallData, kHolder, kApiFunctionAddress
|
2016-09-01 20:08:42 +00:00
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Pointer()};
|
2016-09-21 11:08:25 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
2016-09-01 20:08:42 +00:00
|
|
|
machine_types);
|
2015-06-24 06:21:47 +00:00
|
|
|
}
|
|
|
|
|
2016-09-01 20:08:42 +00:00
|
|
|
void InterpreterDispatchDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kAccumulator, kBytecodeOffset, kBytecodeArray, kDispatchTable
|
2016-09-27 14:59:54 +00:00
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::AnyTagged(), MachineType::IntPtr(), MachineType::AnyTagged(),
|
2017-02-16 16:54:02 +00:00
|
|
|
MachineType::IntPtr()};
|
2016-09-01 20:08:42 +00:00
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
2016-02-10 16:38:49 +00:00
|
|
|
}
|
2015-06-24 06:21:47 +00:00
|
|
|
|
2017-04-11 14:20:30 +00:00
|
|
|
void InterpreterPushArgsThenCallDescriptor::InitializePlatformIndependent(
|
2016-09-29 13:48:05 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kNumberOfArguments, kFirstArgument, kFunction
|
|
|
|
MachineType machine_types[] = {MachineType::Int32(), MachineType::Pointer(),
|
|
|
|
MachineType::AnyTagged()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-04-11 14:20:30 +00:00
|
|
|
void InterpreterPushArgsThenConstructDescriptor::InitializePlatformIndependent(
|
2016-09-29 13:48:05 +00:00
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kNumberOfArguments, kNewTarget, kConstructor, kFeedbackElement,
|
|
|
|
// kFirstArgument
|
|
|
|
MachineType machine_types[] = {
|
|
|
|
MachineType::Int32(), MachineType::AnyTagged(), MachineType::AnyTagged(),
|
|
|
|
MachineType::AnyTagged(), MachineType::Pointer()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterpreterCEntryDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// kNumberOfArguments, kFirstArgument, kFunctionEntry
|
|
|
|
MachineType machine_types[] = {MachineType::Int32(), MachineType::Pointer(),
|
|
|
|
MachineType::Pointer()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2017-01-27 07:31:03 +00:00
|
|
|
void FrameDropperTrampolineDescriptor::InitializePlatformIndependent(
|
|
|
|
CallInterfaceDescriptorData* data) {
|
|
|
|
// New FP value.
|
|
|
|
MachineType machine_types[] = {MachineType::Pointer()};
|
|
|
|
data->InitializePlatformIndependent(arraysize(machine_types), 0,
|
|
|
|
machine_types);
|
|
|
|
}
|
|
|
|
|
2015-06-01 22:46:54 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|