{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- static Register registers[] = { r1, // JSFunction
- cp, // context
- r0, // actual number of arguments
- r2, // expected number of arguments
+ Register registers[] = { r1, // JSFunction
+ cp, // context
+ r0, // actual number of arguments
+ r2, // expected number of arguments
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // JSFunction
Representation::Tagged(), // context
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->register_param_count_ = 4;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::KeyedCall);
- static Register registers[] = { cp, // context
- r2, // key
+ Register registers[] = { cp, // context
+ r2, // key
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &noInlineDescriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &noInlineDescriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::NamedCall);
- static Register registers[] = { cp, // context
- r2, // name
+ Register registers[] = { cp, // context
+ r2, // name
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &noInlineDescriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &noInlineDescriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::CallHandler);
- static Register registers[] = { cp, // context
- r0, // receiver
+ Register registers[] = { cp, // context
+ r0, // receiver
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- static Register registers[] = { r0, // callee
- r4, // call_data
- r2, // holder
- r1, // api_function_address
- cp, // context
+ Register registers[] = { r0, // callee
+ r4, // call_data
+ r2, // holder
+ r1, // api_function_address
+ cp, // context
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Tagged(), // context
};
- descriptor->register_param_count_ = 5;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
}
};
-struct PlatformCallInterfaceDescriptor {
+class PlatformCallInterfaceDescriptor {
+ public:
explicit PlatformCallInterfaceDescriptor(
TargetAddressStorageMode storage_mode)
: storage_mode_(storage_mode) { }
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- static Register registers[] = { x1, // JSFunction
- cp, // context
- x0, // actual number of arguments
- x2, // expected number of arguments
+ Register registers[] = { x1, // JSFunction
+ cp, // context
+ x0, // actual number of arguments
+ x2, // expected number of arguments
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // JSFunction
Representation::Tagged(), // context
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->register_param_count_ = 4;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::KeyedCall);
- static Register registers[] = { cp, // context
- x2, // key
+ Register registers[] = { cp, // context
+ x2, // key
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &noInlineDescriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &noInlineDescriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::NamedCall);
- static Register registers[] = { cp, // context
- x2, // name
+ Register registers[] = { cp, // context
+ x2, // name
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &noInlineDescriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &noInlineDescriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::CallHandler);
- static Register registers[] = { cp, // context
- x0, // receiver
+ Register registers[] = { cp, // context
+ x0, // receiver
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- static Register registers[] = { x0, // callee
- x4, // call_data
- x2, // holder
- x1, // api_function_address
- cp, // context
+ Register registers[] = { x0, // callee
+ x4, // call_data
+ x2, // holder
+ x1, // api_function_address
+ cp, // context
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Tagged(), // context
};
- descriptor->register_param_count_ = 5;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
- descriptor->platform_specific_descriptor_ = &default_descriptor;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ representations, &default_descriptor);
}
}
};
-struct PlatformCallInterfaceDescriptor {
+class PlatformCallInterfaceDescriptor {
+ public:
explicit PlatformCallInterfaceDescriptor(
TargetAddressStorageMode storage_mode)
: storage_mode_(storage_mode) { }
}
+void CallInterfaceDescriptor::Initialize(
+ int register_parameter_count,
+ Register* registers,
+ Representation* param_representations,
+ PlatformCallInterfaceDescriptor* platform_descriptor) {
+ // CallInterfaceDescriptor owns a copy of the registers array.
+ register_param_count_ = register_parameter_count;
+ register_params_.Reset(NewArray<Register>(register_parameter_count));
+ for (int i = 0; i < register_parameter_count; i++) {
+ register_params_[i] = registers[i];
+ }
+
+ // Also the register parameter representations.
+ param_representations_.Reset(
+ NewArray<Representation>(register_parameter_count));
+ for (int i = 0; i < register_parameter_count; i++) {
+ param_representations_[i] = param_representations[i];
+ }
+
+ platform_specific_descriptor_ = platform_descriptor;
+}
+
+
bool CodeStub::FindCodeInCache(Code** code_out) {
UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs();
int index = stubs->FindEntry(GetKey());
};
-struct PlatformCallInterfaceDescriptor;
+class PlatformCallInterfaceDescriptor;
-struct CallInterfaceDescriptor {
+class CallInterfaceDescriptor {
+ public:
CallInterfaceDescriptor()
: register_param_count_(-1),
register_params_(NULL),
param_representations_(NULL),
platform_specific_descriptor_(NULL) { }
+ // A copy of the passed in registers and param_representations is made
+ // and owned by the CallInterfaceDescriptor.
+
+ // TODO(mvstanton): Instead of taking parallel arrays register and
+ // param_representations, how about a struct that puts the representation
+ // and register side by side (eg, RegRep(r1, Representation::Tagged()).
+ // The same should go for the CodeStubInterfaceDescriptor class.
+ void Initialize(int register_parameter_count, Register* registers,
+ Representation* param_representations,
+ PlatformCallInterfaceDescriptor* platform_descriptor = NULL);
+
bool initialized() const { return register_param_count_ >= 0; }
int environment_length() const {
return platform_specific_descriptor_;
}
+ private:
int register_param_count_;
- Register* register_params_;
- Representation* param_representations_;
+ SmartArrayPointer<Register> register_params_;
+ SmartArrayPointer<Representation> param_representations_;
PlatformCallInterfaceDescriptor* platform_specific_descriptor_;
};
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- static Register registers[] = { edi, // JSFunction
- esi, // context
- eax, // actual number of arguments
- ebx, // expected number of arguments
+ Register registers[] = { edi, // JSFunction
+ esi, // context
+ eax, // actual number of arguments
+ ebx, // expected number of arguments
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // JSFunction
Representation::Tagged(), // context
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->register_param_count_ = 4;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::KeyedCall);
- static Register registers[] = { esi, // context
- ecx, // key
+ Register registers[] = { esi, // context
+ ecx, // key
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::NamedCall);
- static Register registers[] = { esi, // context
- ecx, // name
+ Register registers[] = { esi, // context
+ ecx, // name
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::CallHandler);
- static Register registers[] = { esi, // context
- edx, // receiver
+ Register registers[] = { esi, // context
+ edx, // receiver
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- static Register registers[] = { eax, // callee
- ebx, // call_data
- ecx, // holder
- edx, // api_function_address
- esi, // context
+ Register registers[] = { eax, // callee
+ ebx, // call_data
+ ecx, // holder
+ edx, // api_function_address
+ esi, // context
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Tagged(), // context
};
- descriptor->register_param_count_ = 5;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
}
namespace internal {
class Bootstrapper;
-struct CallInterfaceDescriptor;
+class CallInterfaceDescriptor;
class CodeGenerator;
class CodeRange;
class CodeStubInterfaceDescriptor;
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- static Register registers[] = { rdi, // JSFunction
- rsi, // context
- rax, // actual number of arguments
- rbx, // expected number of arguments
+ Register registers[] = { rdi, // JSFunction
+ rsi, // context
+ rax, // actual number of arguments
+ rbx, // expected number of arguments
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // JSFunction
Representation::Tagged(), // context
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->register_param_count_ = 4;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::KeyedCall);
- static Register registers[] = { rsi, // context
- rcx, // key
+ Register registers[] = { rsi, // context
+ rcx, // key
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::NamedCall);
- static Register registers[] = { rsi, // context
- rcx, // name
+ Register registers[] = { rsi, // context
+ rcx, // name
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::CallHandler);
- static Register registers[] = { rsi, // context
- rdx, // receiver
+ Register registers[] = { rsi, // context
+ rdx, // receiver
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->register_param_count_ = 2;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- static Register registers[] = { rax, // callee
- rbx, // call_data
- rcx, // holder
- rdx, // api_function_address
- rsi, // context
+ Register registers[] = { rax, // callee
+ rbx, // call_data
+ rcx, // holder
+ rdx, // api_function_address
+ rsi, // context
};
- static Representation representations[] = {
+ Representation representations[] = {
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Tagged(), // context
};
- descriptor->register_param_count_ = 5;
- descriptor->register_params_ = registers;
- descriptor->param_representations_ = representations;
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
}
}