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

Unified Diff: src/compiler/code-assembler.h

Issue 2504913002: Revert of [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/code-stubs-hydrogen.cc ('k') | src/compiler/code-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/code-assembler.h
diff --git a/src/compiler/code-assembler.h b/src/compiler/code-assembler.h
index ade8ddc7e4b121841ba6be32620789ec2762acf9..b3369004a2ce499a7f10fddceb608c0cffe46296 100644
--- a/src/compiler/code-assembler.h
+++ b/src/compiler/code-assembler.h
@@ -30,7 +30,6 @@
namespace compiler {
class CallDescriptor;
-class CodeAssemblerState;
class Node;
class RawMachineAssembler;
class RawMachineLabel;
@@ -174,17 +173,22 @@
// clients, CodeAssembler also provides an abstraction for creating variables
// and enhanced Label functionality to merge variable values along paths where
// they have differing values, including loops.
-//
-// The CodeAssembler itself is stateless (and instances are expected to be
-// temporary-scoped and short-lived); all its state is encapsulated into
-// a CodeAssemblerState instance.
class V8_EXPORT_PRIVATE CodeAssembler {
public:
- explicit CodeAssembler(CodeAssemblerState* state) : state_(state) {}
+ // Create with CallStub linkage.
+ // |result_size| specifies the number of results returned by the stub.
+ // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor.
+ CodeAssembler(Isolate* isolate, Zone* zone,
+ const CallInterfaceDescriptor& descriptor, Code::Flags flags,
+ const char* name, size_t result_size = 1);
+
+ // Create with JSCall linkage.
+ CodeAssembler(Isolate* isolate, Zone* zone, int parameter_count,
+ Code::Flags flags, const char* name);
virtual ~CodeAssembler();
- static Handle<Code> GenerateCode(CodeAssemblerState* state);
+ Handle<Code> GenerateCode();
bool Is64() const;
bool IsFloat64RoundUpSupported() const;
@@ -203,10 +207,9 @@
private:
friend class CodeAssembler;
- friend class CodeAssemblerState;
class Impl;
Impl* impl_;
- CodeAssemblerState* state_;
+ CodeAssembler* assembler_;
};
typedef ZoneList<Variable*> VariableList;
@@ -468,12 +471,17 @@
virtual void CallEpilogue();
private:
+ CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor,
+ Code::Flags flags, const char* name);
+
Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
- RawMachineAssembler* raw_assembler() const;
-
- CodeAssemblerState* state_;
+ std::unique_ptr<RawMachineAssembler> raw_assembler_;
+ Code::Flags flags_;
+ const char* name_;
+ bool code_generated_;
+ ZoneSet<Variable::Impl*> variables_;
DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
};
@@ -505,7 +513,7 @@
bool bound_;
size_t merge_count_;
- CodeAssemblerState* state_;
+ CodeAssembler* assembler_;
RawMachineLabel* label_;
// Map of variables that need to be merged to their phi nodes (or placeholders
// for those phis).
@@ -515,38 +523,6 @@
std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
};
-class V8_EXPORT_PRIVATE CodeAssemblerState {
- public:
- // Create with CallStub linkage.
- // |result_size| specifies the number of results returned by the stub.
- // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor.
- CodeAssemblerState(Isolate* isolate, Zone* zone,
- const CallInterfaceDescriptor& descriptor,
- Code::Flags flags, const char* name,
- size_t result_size = 1);
-
- // Create with JSCall linkage.
- CodeAssemblerState(Isolate* isolate, Zone* zone, int parameter_count,
- Code::Flags flags, const char* name);
-
- ~CodeAssemblerState();
-
- private:
- friend class CodeAssembler;
-
- CodeAssemblerState(Isolate* isolate, Zone* zone,
- CallDescriptor* call_descriptor, Code::Flags flags,
- const char* name);
-
- std::unique_ptr<RawMachineAssembler> raw_assembler_;
- Code::Flags flags_;
- const char* name_;
- bool code_generated_;
- ZoneSet<CodeAssembler::Variable::Impl*> variables_;
-
- DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState);
-};
-
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698