Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: src/code-stubs.h

Issue 384403002: StubCallInterfaceDescriptor takes a context register. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Base class for Descriptors. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/hydrogen-instructions.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index c0ab7e9e5a17cdb243db3224d5636aef572e8880..525e1a1053dcff339d0174b0a03c051f905e8f39 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -271,7 +271,61 @@ 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 {
danno 2014/07/15 07:48:31 In general, could more stuff in this class be priv
+ public:
+ static const Register ContextRegister();
danno 2014/07/15 07:48:31 Can you make this a virtual register that returns
+
+ InterfaceDescriptor();
+ virtual ~InterfaceDescriptor() {}
+
+ bool initialized() const { return register_param_count_ >= 0; }
+
+ int environment_length() const {
danno 2014/07/15 07:48:31 Since this is not an accessor with an indentical n
mvstanton 2014/07/16 09:43:26 Done.
+ return register_param_count_;
+ }
+
+ int register_param_count() const { return register_param_count_; }
+
+ 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];
+ }
+
+ Representation* register_param_representations() const {
danno 2014/07/15 07:48:31 Does this have to be public?
mvstanton 2014/07/16 09:43:26 No, it is gone, good catch.
+ return register_param_representations_.get();
+ }
+
+ virtual bool needs_context_register() const { return true; }
danno 2014/07/15 07:48:31 NeedsContextRegister
mvstanton 2014/07/16 09:43:26 Done.
+
+ protected:
+ 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
+ // 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_;
+};
+
+
+class CodeStubInterfaceDescriptor: public InterfaceDescriptor {
public:
CodeStubInterfaceDescriptor();
@@ -287,11 +341,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,19 +359,6 @@ 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_);
}
@@ -335,33 +371,17 @@ class 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_.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_;
@@ -375,13 +395,10 @@ class 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 +411,12 @@ 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_;
};
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698