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

Unified Diff: src/hydrogen.h

Issue 6794041: Use placement new for zone objects in hydrogen. (Closed)
Patch Set: Created 9 years, 9 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/hydrogen.cc » ('j') | src/hydrogen.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index 93664e963dfe36c8cd7595369cda91ea7e95a845..1b2c76a746c71d220d91a20c662aecb6e7d14968 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -141,6 +141,8 @@ class HBasicBlock: public ZoneObject {
bool IsInlineReturnTarget() const { return is_inline_return_target_; }
void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; }
+ inline Zone* zone();
+
#ifdef DEBUG
void Verify();
#endif
@@ -201,6 +203,9 @@ class HGraph: public ZoneObject {
public:
explicit HGraph(CompilationInfo* info);
+ Isolate* isolate() { return isolate_; }
+ Zone* zone() { return isolate_->zone(); }
+
const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
HBasicBlock* entry_block() const { return entry_block_; }
@@ -281,8 +286,6 @@ class HGraph: public ZoneObject {
void InitializeInferredTypes(int from_inclusive, int to_inclusive);
void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
- Isolate* isolate() { return isolate_; }
-
Isolate* isolate_;
int next_block_id_;
HBasicBlock* entry_block_;
@@ -301,6 +304,9 @@ class HGraph: public ZoneObject {
};
+Zone* HBasicBlock::zone() { return graph_->zone(); }
+
+
class HEnvironment: public ZoneObject {
public:
HEnvironment(HEnvironment* outer,
@@ -462,6 +468,8 @@ class AstContext {
HGraphBuilder* owner() const { return owner_; }
+ inline Zone* zone();
+
// We want to be able to assert, in a context-specific way, that the stack
// height makes sense when the context is filled.
#ifdef DEBUG
@@ -630,7 +638,8 @@ class HGraphBuilder: public AstVisitor {
break_scope_(NULL),
graph_(NULL),
current_block_(NULL),
- inlined_count_(0) {
+ inlined_count_(0),
+ zone_(info->isolate()->zone()) {
// This is not initialized in the initializer list because the
// constructor for the initial state relies on function_state_ == NULL
// to know it's the initial state.
@@ -874,6 +883,7 @@ class HGraphBuilder: public AstVisitor {
Handle<Map> receiver_map,
bool smi_and_map_check);
+ Zone* zone() { return zone_; }
// The translation state of the currently-being-translated function.
FunctionState* function_state_;
@@ -893,6 +903,8 @@ class HGraphBuilder: public AstVisitor {
int inlined_count_;
+ Zone* zone_;
+
friend class FunctionState; // Pushes and pops the state stack.
friend class AstContext; // Pushes and pops the AST context stack.
@@ -900,6 +912,9 @@ class HGraphBuilder: public AstVisitor {
};
+Zone* AstContext::zone() { return owner_->zone(); }
+
+
class HValueMap: public ZoneObject {
public:
HValueMap()
@@ -922,7 +937,10 @@ class HValueMap: public ZoneObject {
}
HValue* Lookup(HValue* value) const;
- HValueMap* Copy() const { return new HValueMap(this); }
+
+ HValueMap* Copy(Zone* zone) const {
+ return new(zone) HValueMap(this);
+ }
private:
// A linked list of HValue* values. Stored in arrays.
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698