From 3a7b5b44c1f3c42b04d6198c06e79a0deadf5370 Mon Sep 17 00:00:00 2001 From: "mvstanton@chromium.org" Date: Mon, 1 Sep 2014 12:15:25 +0000 Subject: [PATCH] InterfaceDescriptor becomes CallInterfaceDescriptor. There was no difference between these two classes in a hierarchical relationship. R=yangguo@chromium.org Review URL: https://codereview.chromium.org/532473002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/interface-descriptors-arm.cc | 2 +- src/arm/lithium-arm.cc | 2 +- src/arm/lithium-arm.h | 13 ++++---- src/arm64/interface-descriptors-arm64.cc | 2 +- src/arm64/lithium-arm64.cc | 2 +- src/arm64/lithium-arm64.h | 13 ++++---- src/hydrogen-instructions.h | 27 +++++++-------- src/ia32/interface-descriptors-ia32.cc | 2 +- src/ia32/lithium-ia32.cc | 2 +- src/ia32/lithium-ia32.h | 7 ++-- src/interface-descriptors.cc | 24 ++++---------- src/interface-descriptors.h | 42 +++++++++--------------- src/x64/interface-descriptors-x64.cc | 2 +- src/x64/lithium-x64.cc | 2 +- src/x64/lithium-x64.h | 7 ++-- 15 files changed, 58 insertions(+), 91 deletions(-) diff --git a/src/arm/interface-descriptors-arm.cc b/src/arm/interface-descriptors-arm.cc index 6a5f12de0b..969d4ae957 100644 --- a/src/arm/interface-descriptors-arm.cc +++ b/src/arm/interface-descriptors-arm.cc @@ -11,7 +11,7 @@ namespace v8 { namespace internal { -const Register InterfaceDescriptor::ContextRegister() { return cp; } +const Register CallInterfaceDescriptor::ContextRegister() { return cp; } void CallDescriptors::InitializeForIsolate(Isolate* isolate) { diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 39b33938c5..55b1a127e2 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1082,7 +1082,7 @@ LInstruction* LChunkBuilder::DoCallJSFunction( LInstruction* LChunkBuilder::DoCallWithDescriptor( HCallWithDescriptor* instr) { - const InterfaceDescriptor* descriptor = instr->descriptor(); + const CallInterfaceDescriptor* descriptor = instr->descriptor(); LOperand* target = UseRegisterOrConstantAtStart(instr->target()); ZoneList ops(instr->OperandCount(), zone()); diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 16f522e5b6..2c84022180 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -1874,18 +1874,17 @@ class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { public: - LCallWithDescriptor(const InterfaceDescriptor* descriptor, - const ZoneList& operands, - Zone* zone) - : descriptor_(descriptor), - inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { + LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, + const ZoneList& operands, Zone* zone) + : descriptor_(descriptor), + inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { DCHECK(descriptor->GetRegisterParameterCount() + 1 == operands.length()); inputs_.AddAll(operands, zone); } LOperand* target() const { return inputs_[0]; } - const InterfaceDescriptor* descriptor() { return descriptor_; } + const CallInterfaceDescriptor* descriptor() { return descriptor_; } private: DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") @@ -1895,7 +1894,7 @@ class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { int arity() const { return hydrogen()->argument_count() - 1; } - const InterfaceDescriptor* descriptor_; + const CallInterfaceDescriptor* descriptor_; ZoneList inputs_; // Iterator support. diff --git a/src/arm64/interface-descriptors-arm64.cc b/src/arm64/interface-descriptors-arm64.cc index 1bea2bae0a..fb490a7d39 100644 --- a/src/arm64/interface-descriptors-arm64.cc +++ b/src/arm64/interface-descriptors-arm64.cc @@ -11,7 +11,7 @@ namespace v8 { namespace internal { -const Register InterfaceDescriptor::ContextRegister() { return cp; } +const Register CallInterfaceDescriptor::ContextRegister() { return cp; } void CallDescriptors::InitializeForIsolate(Isolate* isolate) { diff --git a/src/arm64/lithium-arm64.cc b/src/arm64/lithium-arm64.cc index 1f670cc71c..92c18a7c56 100644 --- a/src/arm64/lithium-arm64.cc +++ b/src/arm64/lithium-arm64.cc @@ -1036,7 +1036,7 @@ LInstruction* LChunkBuilder::DoCallJSFunction( LInstruction* LChunkBuilder::DoCallWithDescriptor( HCallWithDescriptor* instr) { - const InterfaceDescriptor* descriptor = instr->descriptor(); + const CallInterfaceDescriptor* descriptor = instr->descriptor(); LOperand* target = UseRegisterOrConstantAtStart(instr->target()); ZoneList ops(instr->OperandCount(), zone()); diff --git a/src/arm64/lithium-arm64.h b/src/arm64/lithium-arm64.h index a5a3eb0b91..4e6f26ccbb 100644 --- a/src/arm64/lithium-arm64.h +++ b/src/arm64/lithium-arm64.h @@ -1523,18 +1523,17 @@ class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> { class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { public: - LCallWithDescriptor(const InterfaceDescriptor* descriptor, - const ZoneList& operands, - Zone* zone) - : descriptor_(descriptor), - inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { + LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, + const ZoneList& operands, Zone* zone) + : descriptor_(descriptor), + inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { DCHECK(descriptor->GetRegisterParameterCount() + 1 == operands.length()); inputs_.AddAll(operands, zone); } LOperand* target() const { return inputs_[0]; } - const InterfaceDescriptor* descriptor() { return descriptor_; } + const CallInterfaceDescriptor* descriptor() { return descriptor_; } private: DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") @@ -1544,7 +1543,7 @@ class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { int arity() const { return hydrogen()->argument_count() - 1; } - const InterfaceDescriptor* descriptor_; + const CallInterfaceDescriptor* descriptor_; ZoneList inputs_; // Iterator support. diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 06d2bb48b0..b80c7c50ab 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -2318,11 +2318,10 @@ class HCallJSFunction V8_FINAL : public HCall<1> { class HCallWithDescriptor V8_FINAL : public HInstruction { public: - static HCallWithDescriptor* New(Zone* zone, HValue* context, - HValue* target, - int argument_count, - const InterfaceDescriptor* descriptor, - const Vector& operands) { + static HCallWithDescriptor* New(Zone* zone, HValue* context, HValue* target, + int argument_count, + const CallInterfaceDescriptor* descriptor, + const Vector& operands) { DCHECK(operands.length() == descriptor->GetEnvironmentLength()); HCallWithDescriptor* res = new(zone) HCallWithDescriptor(target, argument_count, @@ -2362,9 +2361,7 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { return -argument_count_; } - const InterfaceDescriptor* descriptor() const { - return descriptor_; - } + const CallInterfaceDescriptor* descriptor() const { return descriptor_; } HValue* target() { return OperandAt(0); @@ -2374,13 +2371,11 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { private: // The argument count includes the receiver. - HCallWithDescriptor(HValue* target, - int argument_count, - const InterfaceDescriptor* descriptor, - const Vector& operands, - Zone* zone) - : descriptor_(descriptor), - values_(descriptor->GetEnvironmentLength() + 1, zone) { + HCallWithDescriptor(HValue* target, int argument_count, + const CallInterfaceDescriptor* descriptor, + const Vector& operands, Zone* zone) + : descriptor_(descriptor), + values_(descriptor->GetEnvironmentLength() + 1, zone) { argument_count_ = argument_count; AddOperand(target, zone); for (int i = 0; i < operands.length(); i++) { @@ -2400,7 +2395,7 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { values_[index] = value; } - const InterfaceDescriptor* descriptor_; + const CallInterfaceDescriptor* descriptor_; ZoneList values_; int argument_count_; }; diff --git a/src/ia32/interface-descriptors-ia32.cc b/src/ia32/interface-descriptors-ia32.cc index 9f7cf263e4..ca2c12616f 100644 --- a/src/ia32/interface-descriptors-ia32.cc +++ b/src/ia32/interface-descriptors-ia32.cc @@ -12,7 +12,7 @@ namespace v8 { namespace internal { -const Register InterfaceDescriptor::ContextRegister() { return esi; } +const Register CallInterfaceDescriptor::ContextRegister() { return esi; } void CallDescriptors::InitializeForIsolate(Isolate* isolate) { diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 4569dc5598..d685240750 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1123,7 +1123,7 @@ LInstruction* LChunkBuilder::DoCallJSFunction( LInstruction* LChunkBuilder::DoCallWithDescriptor( HCallWithDescriptor* instr) { - const InterfaceDescriptor* descriptor = instr->descriptor(); + const CallInterfaceDescriptor* descriptor = instr->descriptor(); LOperand* target = UseRegisterOrConstantAtStart(instr->target()); ZoneList ops(instr->OperandCount(), zone()); ops.Add(target, zone()); diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 4206482de7..730975a9c3 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -1891,10 +1891,9 @@ class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { public: - LCallWithDescriptor(const InterfaceDescriptor* descriptor, - const ZoneList& operands, - Zone* zone) - : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { + LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, + const ZoneList& operands, Zone* zone) + : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { DCHECK(descriptor->GetRegisterParameterCount() + 1 == operands.length()); inputs_.AddAll(operands, zone); } diff --git a/src/interface-descriptors.cc b/src/interface-descriptors.cc index 2324c62eda..2661b09bc6 100644 --- a/src/interface-descriptors.cc +++ b/src/interface-descriptors.cc @@ -10,10 +10,7 @@ namespace v8 { namespace internal { -InterfaceDescriptor::InterfaceDescriptor() : register_param_count_(-1) {} - - -void InterfaceDescriptor::Initialize( +void CallInterfaceDescriptor::Initialize( int register_parameter_count, Register* registers, Representation* register_param_representations, PlatformInterfaceDescriptor* platform_descriptor) { @@ -45,20 +42,11 @@ void InterfaceDescriptor::Initialize( } -void CallInterfaceDescriptor::Initialize( - int register_parameter_count, Register* registers, - Representation* param_representations, - PlatformInterfaceDescriptor* platform_descriptor) { - InterfaceDescriptor::Initialize(register_parameter_count, registers, - param_representations, platform_descriptor); -} - - void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { { CallInterfaceDescriptor* descriptor = isolate->call_descriptor(CallDescriptorKey::LoadICCall); - Register registers[] = {InterfaceDescriptor::ContextRegister(), + Register registers[] = {CallInterfaceDescriptor::ContextRegister(), LoadConvention::ReceiverRegister(), LoadConvention::NameRegister()}; descriptor->Initialize(arraysize(registers), registers, NULL); @@ -66,7 +54,7 @@ void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { { CallInterfaceDescriptor* descriptor = isolate->call_descriptor(CallDescriptorKey::StoreICCall); - Register registers[] = {InterfaceDescriptor::ContextRegister(), + Register registers[] = {CallInterfaceDescriptor::ContextRegister(), StoreConvention::ReceiverRegister(), StoreConvention::NameRegister(), StoreConvention::ValueRegister()}; @@ -76,7 +64,7 @@ void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { CallInterfaceDescriptor* descriptor = isolate->call_descriptor( CallDescriptorKey::ElementTransitionAndStoreCall); Register registers[] = { - InterfaceDescriptor::ContextRegister(), + CallInterfaceDescriptor::ContextRegister(), StoreConvention::ValueRegister(), StoreConvention::MapRegister(), StoreConvention::NameRegister(), StoreConvention::ReceiverRegister()}; descriptor->Initialize(arraysize(registers), registers, NULL); @@ -84,7 +72,7 @@ void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { { CallInterfaceDescriptor* descriptor = isolate->call_descriptor(CallDescriptorKey::InstanceofCall); - Register registers[] = {InterfaceDescriptor::ContextRegister(), + Register registers[] = {CallInterfaceDescriptor::ContextRegister(), InstanceofConvention::left(), InstanceofConvention::right()}; descriptor->Initialize(arraysize(registers), registers, NULL); @@ -92,7 +80,7 @@ void CallDescriptors::InitializeForIsolateAllPlatforms(Isolate* isolate) { { CallInterfaceDescriptor* descriptor = isolate->call_descriptor(CallDescriptorKey::VectorLoadICCall); - Register registers[] = {InterfaceDescriptor::ContextRegister(), + Register registers[] = {CallInterfaceDescriptor::ContextRegister(), FullVectorLoadConvention::ReceiverRegister(), FullVectorLoadConvention::NameRegister(), FullVectorLoadConvention::SlotRegister(), diff --git a/src/interface-descriptors.h b/src/interface-descriptors.h index 639b1f0a88..5b552e892b 100644 --- a/src/interface-descriptors.h +++ b/src/interface-descriptors.h @@ -13,8 +13,21 @@ namespace internal { class PlatformInterfaceDescriptor; -class InterfaceDescriptor { +class CallInterfaceDescriptor { public: + CallInterfaceDescriptor() : register_param_count_(-1) {} + + // 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, + PlatformInterfaceDescriptor* platform_descriptor = NULL); + bool IsInitialized() const { return register_param_count_ >= 0; } int GetEnvironmentLength() const { return register_param_count_; } @@ -55,14 +68,6 @@ class InterfaceDescriptor { static const Register ContextRegister(); - protected: - InterfaceDescriptor(); - virtual ~InterfaceDescriptor() {} - - void Initialize(int register_parameter_count, Register* registers, - Representation* register_param_representations, - PlatformInterfaceDescriptor* platform_descriptor = NULL); - private: int register_param_count_; @@ -79,7 +84,7 @@ class InterfaceDescriptor { PlatformInterfaceDescriptor* platform_specific_descriptor_; - DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor); + DISALLOW_COPY_AND_ASSIGN(CallInterfaceDescriptor); }; @@ -118,23 +123,6 @@ enum CallDescriptorKey { }; -class CallInterfaceDescriptor : public InterfaceDescriptor { - public: - CallInterfaceDescriptor() {} - - // 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, - PlatformInterfaceDescriptor* platform_descriptor = NULL); -}; - - class CallDescriptors { public: static void InitializeForIsolate(Isolate* isolate); diff --git a/src/x64/interface-descriptors-x64.cc b/src/x64/interface-descriptors-x64.cc index dfb8c4df88..e8908843b7 100644 --- a/src/x64/interface-descriptors-x64.cc +++ b/src/x64/interface-descriptors-x64.cc @@ -11,7 +11,7 @@ namespace v8 { namespace internal { -const Register InterfaceDescriptor::ContextRegister() { return rsi; } +const Register CallInterfaceDescriptor::ContextRegister() { return rsi; } void CallDescriptors::InitializeForIsolate(Isolate* isolate) { diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 14da898eee..2bcb491332 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1102,7 +1102,7 @@ LInstruction* LChunkBuilder::DoCallJSFunction( LInstruction* LChunkBuilder::DoCallWithDescriptor( HCallWithDescriptor* instr) { - const InterfaceDescriptor* descriptor = instr->descriptor(); + const CallInterfaceDescriptor* descriptor = instr->descriptor(); LOperand* target = UseRegisterOrConstantAtStart(instr->target()); ZoneList ops(instr->OperandCount(), zone()); diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index a1c563f882..b652d34929 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -1877,10 +1877,9 @@ class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> { class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> { public: - LCallWithDescriptor(const InterfaceDescriptor* descriptor, - const ZoneList& operands, - Zone* zone) - : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { + LCallWithDescriptor(const CallInterfaceDescriptor* descriptor, + const ZoneList& operands, Zone* zone) + : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) { DCHECK(descriptor->GetRegisterParameterCount() + 1 == operands.length()); inputs_.AddAll(operands, zone); }