Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index c0ab7e9e5a17cdb243db3224d5636aef572e8880..e25e77ab8954a4125ffc7976c745ca85a9326e7a 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -271,7 +271,57 @@ class PlatformCodeStub : public CodeStub { |
enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS }; |
-class CodeStubInterfaceDescriptor { |
+class InterfaceDescriptor { |
+ public: |
+ bool initialized() const { return register_param_count_ >= 0; } |
danno
2014/07/16 13:19:59
style: should be IsInitialized()
mvstanton
2014/07/17 09:04:05
Done.
|
+ |
+ int GetEnvironmentLength() const { |
+ return register_param_count_; |
+ } |
danno
2014/07/16 13:19:59
I think with a little more "duplication", you can
mvstanton
2014/07/17 09:04:04
I fully factored this out so that customers who pr
|
+ |
+ int register_param_count() const { return register_param_count_; } |
danno
2014/07/16 13:19:59
For consistency, make this GetRegisterParameterCou
mvstanton
2014/07/17 09:04:05
Done.
|
+ |
+ Register GetParameterRegister(int index) const { |
+ return register_params_[index]; |
+ } |
+ |
+ Representation GetParameterRepresentation(int index) const { |
+ ASSERT(index < register_param_count_); |
+ if (register_param_representations_.get() == NULL) { |
+ return Representation::Tagged(); |
+ } |
+ |
+ return register_param_representations_[index]; |
+ } |
+ |
+ static const Register ContextRegister(); |
+ |
+ protected: |
+ InterfaceDescriptor(); |
+ virtual ~InterfaceDescriptor() {} |
+ |
+ void Initialize(int register_parameter_count, Register* registers, |
+ Representation* register_param_representations); |
+ |
+ private: |
+ int register_param_count_; |
+ |
+ // The Register params are allocated dynamically by the |
+ // InterfaceDescriptor, and freed on destruction. This is because static |
+ // arrays of Registers cause creation of runtime static initializers |
+ // which we don't want. |
+ SmartArrayPointer<Register> register_params_; |
+ // Specifies Representations for the stub's parameter. Points to an array of |
+ // Representations of the same length of the numbers of parameters to the |
+ // stub, or if NULL (the default value), Representation of each parameter |
+ // assumed to be Tagged(). |
+ SmartArrayPointer<Representation> register_param_representations_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor); |
+}; |
+ |
+ |
+class CodeStubInterfaceDescriptor: public InterfaceDescriptor { |
public: |
CodeStubInterfaceDescriptor(); |
@@ -287,11 +337,6 @@ class CodeStubInterfaceDescriptor { |
int hint_stack_parameter_count = -1, |
StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE, |
HandlerArgumentsMode handler_mode = DONT_PASS_ARGUMENTS); |
- bool initialized() const { return register_param_count_ >= 0; } |
- |
- int environment_length() const { |
- return register_param_count_; |
- } |
void SetMissHandler(ExternalReference handler) { |
miss_handler_ = handler; |
@@ -310,78 +355,46 @@ class CodeStubInterfaceDescriptor { |
return has_miss_handler_; |
} |
- Register GetParameterRegister(int index) const { |
- return register_params_[index]; |
- } |
- |
- Representation GetRegisterParameterRepresentation(int index) const { |
- ASSERT(index < register_param_count_); |
- if (register_param_representations_.get() == NULL) { |
- return Representation::Tagged(); |
- } |
- |
- return register_param_representations_[index]; |
- } |
- |
bool IsParameterCountRegister(int index) const { |
return GetParameterRegister(index).is(stack_parameter_count_); |
} |
int GetHandlerParameterCount() const { |
- int params = environment_length(); |
+ // Context is dealt with as a defined part of the frame, not as a parameter. |
+ int params = GetEnvironmentLength() - 1; |
if (handler_arguments_mode_ == PASS_ARGUMENTS) { |
params += 1; |
} |
return params; |
} |
- int register_param_count() const { return register_param_count_; } |
int hint_stack_parameter_count() const { return hint_stack_parameter_count_; } |
Register stack_parameter_count() const { return stack_parameter_count_; } |
StubFunctionMode function_mode() const { return function_mode_; } |
Address deoptimization_handler() const { return deoptimization_handler_; } |
- Representation* register_param_representations() const { |
- return register_param_representations_.get(); |
- } |
private: |
- int register_param_count_; |
- |
Register stack_parameter_count_; |
// If hint_stack_parameter_count_ > 0, the code stub can optimize the |
// return sequence. Default value is -1, which means it is ignored. |
int hint_stack_parameter_count_; |
StubFunctionMode function_mode_; |
- // The Register params are allocated dynamically by the |
- // CodeStubInterfaceDescriptor, and freed on destruction. This is because |
- // static arrays of Registers cause creation of runtime static initializers |
- // which we don't want. |
- SmartArrayPointer<Register> register_params_; |
- // Specifies Representations for the stub's parameter. Points to an array of |
- // Representations of the same length of the numbers of parameters to the |
- // stub, or if NULL (the default value), Representation of each parameter |
- // assumed to be Tagged(). |
- SmartArrayPointer<Representation> register_param_representations_; |
Address deoptimization_handler_; |
HandlerArgumentsMode handler_arguments_mode_; |
ExternalReference miss_handler_; |
bool has_miss_handler_; |
- DISALLOW_COPY_AND_ASSIGN(CodeStubInterfaceDescriptor); |
}; |
class PlatformCallInterfaceDescriptor; |
-class CallInterfaceDescriptor { |
+class CallInterfaceDescriptor: public InterfaceDescriptor { |
public: |
CallInterfaceDescriptor() |
- : register_param_count_(-1), |
- register_params_(NULL), |
- param_representations_(NULL), |
- platform_specific_descriptor_(NULL) { } |
+ : platform_specific_descriptor_(NULL) { } |
// A copy of the passed in registers and param_representations is made |
// and owned by the CallInterfaceDescriptor. |
@@ -394,28 +407,11 @@ class CallInterfaceDescriptor { |
Representation* param_representations, |
PlatformCallInterfaceDescriptor* platform_descriptor = NULL); |
- bool initialized() const { return register_param_count_ >= 0; } |
- |
- int environment_length() const { |
- return register_param_count_; |
- } |
- |
- Representation GetParameterRepresentation(int index) const { |
- return param_representations_[index]; |
- } |
- |
- Register GetParameterRegister(int index) const { |
- return register_params_[index]; |
- } |
- |
PlatformCallInterfaceDescriptor* platform_specific_descriptor() const { |
return platform_specific_descriptor_; |
} |
private: |
- int register_param_count_; |
- SmartArrayPointer<Register> register_params_; |
- SmartArrayPointer<Representation> param_representations_; |
PlatformCallInterfaceDescriptor* platform_specific_descriptor_; |
}; |