Reviewers: titzer,
Description:
Use ZoneVector instead of ZoneList in the graph builder.
[email protected]
Please review this at https://codereview.chromium.org/742433002/
Base URL:
https://chromium.googlesource.com/v8/v8.git@local_cleanup-operator-counts
Affected files (+15, -17 lines):
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
M src/compiler/control-builders.h
M src/compiler/control-builders.cc
M src/parser.h
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
4eb72a6d66598d63c00200ca2f5d9db9c2897720..e2d8aabc2b95c6f4d5205a110e37c6c5535ef06c
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -395,8 +395,8 @@ void
AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
Handle<Oddball> value = variable->binding_needs_init()
? isolate()->factory()->the_hole_value()
:
isolate()->factory()->undefined_value();
- globals()->Add(variable->name(), zone());
- globals()->Add(value, zone());
+ globals()->push_back(variable->name());
+ globals()->push_back(value);
break;
}
case Variable::PARAMETER:
@@ -427,8 +427,8 @@ void
AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
Compiler::BuildFunctionInfo(decl->fun(), info()->script(),
info());
// Check for stack-overflow exception.
if (function.is_null()) return SetStackOverflow();
- globals()->Add(variable->name(), zone());
- globals()->Add(function, zone());
+ globals()->push_back(variable->name());
+ globals()->push_back(function);
break;
}
case Variable::PARAMETER:
@@ -1639,12 +1639,13 @@ void AstGraphBuilder::VisitCaseClause(CaseClause*
expr) { UNREACHABLE(); }
void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>*
declarations) {
- DCHECK(globals()->is_empty());
+ DCHECK(globals()->empty());
AstVisitor::VisitDeclarations(declarations);
- if (globals()->is_empty()) return;
- Handle<FixedArray> data =
- isolate()->factory()->NewFixedArray(globals()->length(), TENURED);
- for (int i = 0; i < globals()->length(); ++i) data->set(i,
*globals()->at(i));
+ if (globals()->empty()) return;
+ int array_index = 0;
+ Handle<FixedArray> data = isolate()->factory()->NewFixedArray(
+ static_cast<int>(globals()->size()), TENURED);
+ for (Handle<Object> obj : *globals()) data->set(array_index++, *obj);
int encoded_flags = DeclareGlobalsEvalFlag::encode(info()->is_eval()) |
DeclareGlobalsNativeFlag::encode(info()->is_native()) |
DeclareGlobalsStrictMode::encode(strict_mode());
@@ -1652,7 +1653,7 @@ void
AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) {
Node* pairs = jsgraph()->Constant(data);
const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals,
3);
NewNode(op, current_context(), pairs, flags);
- globals()->Rewind(0);
+ globals()->clear();
}
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
dfa4b93e59a5d4c944a8323d555e21bd3f235017..5979197957ab454413392e7744b6449fd3a0b972
100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -126,7 +126,7 @@ class AstGraphBuilder : public StructuredGraphBuilder,
public AstVisitor {
JSGraph* jsgraph_;
// List of global declarations for functions and variables.
- ZoneList<Handle<Object> > globals_;
+ ZoneVector<Handle<Object> > globals_;
// Stack of breakable statements entered by the visitor.
BreakableScope* breakable_;
@@ -145,7 +145,7 @@ class AstGraphBuilder : public StructuredGraphBuilder,
public AstVisitor {
inline StrictMode strict_mode() const;
JSGraph* jsgraph() { return jsgraph_; }
JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
- ZoneList<Handle<Object> >* globals() { return &globals_; }
+ ZoneVector<Handle<Object> >* globals() { return &globals_; }
// Current scope during visitation.
inline Scope* current_scope() const;
Index: src/compiler/control-builders.cc
diff --git a/src/compiler/control-builders.cc
b/src/compiler/control-builders.cc
index
be24a8865cdba84b4713ccf6439052d11ac08587..8725244ebda11ef4cdf2e6b5e658844efffe364c
100644
--- a/src/compiler/control-builders.cc
+++ b/src/compiler/control-builders.cc
@@ -78,7 +78,6 @@ void SwitchBuilder::BeginSwitch() {
body_environment_ = environment()->CopyAsUnreachable();
label_environment_ = environment()->CopyAsUnreachable();
break_environment_ = environment()->CopyAsUnreachable();
- body_environments_.AddBlock(NULL, case_count(), zone());
}
Index: src/compiler/control-builders.h
diff --git a/src/compiler/control-builders.h
b/src/compiler/control-builders.h
index
4b5fc3ab1d3fe83e4016ee3fe5315df44afad0e1..1349cbac1e962bc132dc430f28d9cfa0bc4cc06e
100644
--- a/src/compiler/control-builders.h
+++ b/src/compiler/control-builders.h
@@ -110,13 +110,13 @@ class SwitchBuilder : public ControlBuilder {
virtual void Break();
// The number of cases within a switch is statically known.
- int case_count() const { return body_environments_.capacity(); }
+ size_t case_count() const { return body_environments_.size(); }
private:
Environment* body_environment_; // Environment after last case body.
Environment* label_environment_; // Environment for next label
condition.
Environment* break_environment_; // Environment after the switch exits.
- ZoneList<Environment*> body_environments_;
+ ZoneVector<Environment*> body_environments_;
};
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index
820e1494e5711d0914d6acdefbe96168821c82ea..e28ffb511f70b8d513e9554f97618a241bae623d
100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -23,8 +23,6 @@ class ParserLog;
class PositionStack;
class Target;
-template <typename T> class ZoneListWrapper;
-
class FunctionEntry BASE_EMBEDDED {
public:
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.