Use ZoneVector instead of ZoneList in the graph builder.
R=titzer@chromium.org Review URL: https://codereview.chromium.org/742433002 Cr-Commit-Position: refs/heads/master@{#25403}
This commit is contained in:
parent
cfccf397d0
commit
0518a68bac
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,8 +23,6 @@ class ParserLog;
|
||||
class PositionStack;
|
||||
class Target;
|
||||
|
||||
template <typename T> class ZoneListWrapper;
|
||||
|
||||
|
||||
class FunctionEntry BASE_EMBEDDED {
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user