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

Unified Diff: src/parser.cc

Issue 1002673002: Remove funky 2-stage initialization of ParserInfo and an adventurous memset. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed TODOs Created 5 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 | « src/parser.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index b57a545ffe0c6940f3d1fcc6dc6bfc71221081e9..255fd288862e9f5e3fcec38e070c969f77e62d8e 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -35,17 +35,32 @@ ScriptData::ScriptData(const byte* data, int length)
}
-ParseInfo* ParseInfo::InitializeFromJSFunction(Handle<JSFunction> function) {
- Handle<SharedFunctionInfo> shared(function->shared());
- InitializeFromSharedFunctionInfo(shared);
+ParseInfo::ParseInfo(Zone* zone)
+ : zone_(zone),
+ flags_(0),
+ source_stream_(nullptr),
+ source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
+ extension_(nullptr),
+ compile_options_(ScriptCompiler::kNoCompileOptions),
+ script_scope_(nullptr),
+ unicode_cache_(nullptr),
+ stack_limit_(0),
+ hash_seed_(0),
+ cached_data_(nullptr),
+ ast_value_factory_(nullptr),
+ literal_(nullptr),
+ scope_(nullptr) {}
+
+
+ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
+ : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {
set_closure(function);
set_context(Handle<Context>(function->context()));
- return this;
}
-ParseInfo* ParseInfo::InitializeFromSharedFunctionInfo(
- Handle<SharedFunctionInfo> shared) {
+ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
+ : ParseInfo(zone) {
isolate_ = shared->GetIsolate();
set_lazy();
@@ -61,11 +76,10 @@ ParseInfo* ParseInfo::InitializeFromSharedFunctionInfo(
if (!script.is_null() && script->type()->value() == Script::TYPE_NATIVE) {
set_native();
}
- return this;
}
-ParseInfo* ParseInfo::InitializeFromScript(Handle<Script> script) {
+ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
isolate_ = script->GetIsolate();
set_this_has_uses();
@@ -77,7 +91,6 @@ ParseInfo* ParseInfo::InitializeFromScript(Handle<Script> script) {
if (script->type()->value() == Script::TYPE_NATIVE) {
set_native();
}
- return this;
}
« no previous file with comments | « src/parser.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698