Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index b243b56093167772c395b22892603a7985964c93..f3bba71add99a6c8d4442c19b0628d680d0c7772 100644 |
| --- a/src/code-stubs.h |
| +++ b/src/code-stubs.h |
| @@ -266,25 +266,22 @@ class PlatformCodeStub : public CodeStub { |
| enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
| enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS }; |
| -struct CodeStubInterfaceDescriptor { |
| +class CodeStubInterfaceDescriptor { |
| + public: |
| CodeStubInterfaceDescriptor(); |
| - 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_; |
| - 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() |
| - Representation* register_param_representations_; |
| - |
| - Address deoptimization_handler_; |
| - HandlerArgumentsMode handler_arguments_mode_; |
| + void Initialize(int register_parameter_count, Register* registers, |
| + Address deoptimization_handler = NULL, |
| + Representation* register_param_representations = NULL, |
| + int hint_stack_parameter_count = -1, |
| + StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE); |
| + void Initialize(int register_parameter_count, Register* registers, |
| + Register stack_parameter_count, |
| + Address deoptimization_handler = NULL, |
| + Representation* register_param_representations = NULL, |
| + 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 { |
| @@ -299,12 +296,12 @@ struct CodeStubInterfaceDescriptor { |
| ASSERT(!stack_parameter_count_.is_valid()); |
| } |
| - ExternalReference miss_handler() { |
| + ExternalReference miss_handler() const { |
| ASSERT(has_miss_handler_); |
| return miss_handler_; |
| } |
| - bool has_miss_handler() { |
| + bool has_miss_handler() const { |
| return has_miss_handler_; |
| } |
| @@ -312,11 +309,20 @@ struct CodeStubInterfaceDescriptor { |
| return register_params_[index]; |
| } |
| - bool IsParameterCountRegister(int index) { |
| + Representation GetRegisterParameterRepresentation(int index) const { |
| + ASSERT(index < register_param_count_); |
| + if (register_param_representations_ == NULL) { |
| + return Representation::Tagged(); |
| + } |
| + |
| + return register_param_representations_[index]; |
| + } |
| + |
| + bool IsParameterCountRegister(int index) const { |
| return GetParameterRegister(index).is(stack_parameter_count_); |
| } |
| - int GetHandlerParameterCount() { |
| + int GetHandlerParameterCount() const { |
| int params = environment_length(); |
| if (handler_arguments_mode_ == PASS_ARGUMENTS) { |
| params += 1; |
| @@ -324,9 +330,45 @@ struct CodeStubInterfaceDescriptor { |
| 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_; |
| + } |
| + |
| private: |
| + // Allocating the register parameter array is platform dependent, due to |
| + // different sizes of the Register struct. |
| + void InitializeRegisterParams(int register_parameter_count, |
| + Register* registers); |
| + |
| + int register_param_count_; |
| + |
| + Register stack_parameter_count_; |
| + // if hint_stack_parameter_count_ > 0, the code stub can optimize the |
|
Jakob Kummerow
2014/06/24 17:23:24
nit: s/if/If/
mvstanton
2014/06/25 06:43:13
Done.
|
| + // 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() |
|
Jakob Kummerow
2014/06/24 17:23:24
nit: trailing full stop
mvstanton
2014/06/25 06:43:13
Done.
|
| + Representation* register_param_representations_; |
|
Jakob Kummerow
2014/06/24 17:23:24
This should probably be a SmartArrayPointer too, b
mvstanton
2014/06/25 06:43:13
Yep, I did this because otherwise the asymmetry is
|
| + |
| + Address deoptimization_handler_; |
| + HandlerArgumentsMode handler_arguments_mode_; |
| + |
| ExternalReference miss_handler_; |
| bool has_miss_handler_; |
| + DISALLOW_COPY_AND_ASSIGN(CodeStubInterfaceDescriptor); |
| }; |