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

Unified Diff: src/parsing/parse-info.cc

Issue 2632123006: Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 11 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
Index: src/parsing/parse-info.cc
diff --git a/src/parsing/parse-info.cc b/src/parsing/parse-info.cc
index b703d3e92459435b52ba2793f514c11339c356f6..09daa00ccb615b02e686e2c659da3594f63430b3 100644
--- a/src/parsing/parse-info.cc
+++ b/src/parsing/parse-info.cc
@@ -7,12 +7,13 @@
#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
#include "src/objects-inl.h"
+#include "src/zone/zone.h"
namespace v8 {
namespace internal {
-ParseInfo::ParseInfo(Zone* zone)
- : zone_(zone),
+ParseInfo::ParseInfo(AccountingAllocator* zone_allocator)
+ : zone_(std::make_shared<Zone>(zone_allocator, ZONE_NAME)),
flags_(0),
source_stream_(nullptr),
source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
@@ -35,8 +36,8 @@ ParseInfo::ParseInfo(Zone* zone)
function_name_(nullptr),
literal_(nullptr) {}
-ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
- : ParseInfo(zone) {
+ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared)
+ : ParseInfo(shared->GetIsolate()->allocator()) {
isolate_ = shared->GetIsolate();
set_toplevel(shared->is_toplevel());
@@ -66,7 +67,14 @@ ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
}
}
-ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
+ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared,
+ std::shared_ptr<Zone> zone)
+ : ParseInfo(shared) {
+ zone_.swap(zone);
+}
+
+ParseInfo::ParseInfo(Handle<Script> script)
+ : ParseInfo(script->GetIsolate()->allocator()) {
isolate_ = script->GetIsolate();
set_allow_lazy_parsing();

Powered by Google App Engine
This is Rietveld 408576698