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

Side by Side Diff: src/parsing/parse-info.cc

Issue 2683733002: Revert of Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parse-info.h ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parse-info.h" 5 #include "src/parsing/parse-info.h"
6 6
7 #include "src/ast/ast-value-factory.h" 7 #include "src/ast/ast-value-factory.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/heap/heap-inl.h" 9 #include "src/heap/heap-inl.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
11 #include "src/objects/scope-info.h" 11 #include "src/objects/scope-info.h"
12 #include "src/zone/zone.h"
13 12
14 namespace v8 { 13 namespace v8 {
15 namespace internal { 14 namespace internal {
16 15
17 ParseInfo::ParseInfo(AccountingAllocator* zone_allocator) 16 ParseInfo::ParseInfo(Zone* zone)
18 : zone_(std::make_shared<Zone>(zone_allocator, ZONE_NAME)), 17 : zone_(zone),
19 flags_(0), 18 flags_(0),
20 source_stream_(nullptr), 19 source_stream_(nullptr),
21 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE), 20 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
22 character_stream_(nullptr), 21 character_stream_(nullptr),
23 extension_(nullptr), 22 extension_(nullptr),
24 compile_options_(ScriptCompiler::kNoCompileOptions), 23 compile_options_(ScriptCompiler::kNoCompileOptions),
25 script_scope_(nullptr), 24 script_scope_(nullptr),
26 asm_function_scope_(nullptr), 25 asm_function_scope_(nullptr),
27 unicode_cache_(nullptr), 26 unicode_cache_(nullptr),
28 stack_limit_(0), 27 stack_limit_(0),
29 hash_seed_(0), 28 hash_seed_(0),
30 compiler_hints_(0), 29 compiler_hints_(0),
31 start_position_(0), 30 start_position_(0),
32 end_position_(0), 31 end_position_(0),
33 function_literal_id_(FunctionLiteral::kIdTypeInvalid), 32 function_literal_id_(FunctionLiteral::kIdTypeInvalid),
34 max_function_literal_id_(FunctionLiteral::kIdTypeInvalid), 33 max_function_literal_id_(FunctionLiteral::kIdTypeInvalid),
35 isolate_(nullptr), 34 isolate_(nullptr),
36 cached_data_(nullptr), 35 cached_data_(nullptr),
37 ast_value_factory_(nullptr), 36 ast_value_factory_(nullptr),
38 function_name_(nullptr), 37 function_name_(nullptr),
39 literal_(nullptr) {} 38 literal_(nullptr) {}
40 39
41 ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared) 40 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
42 : ParseInfo(shared->GetIsolate()->allocator()) { 41 : ParseInfo(zone) {
43 isolate_ = shared->GetIsolate(); 42 isolate_ = shared->GetIsolate();
44 43
45 set_toplevel(shared->is_toplevel()); 44 set_toplevel(shared->is_toplevel());
46 set_allow_lazy_parsing(FLAG_lazy_inner_functions); 45 set_allow_lazy_parsing(FLAG_lazy_inner_functions);
47 set_hash_seed(isolate_->heap()->HashSeed()); 46 set_hash_seed(isolate_->heap()->HashSeed());
48 set_is_named_expression(shared->is_named_expression()); 47 set_is_named_expression(shared->is_named_expression());
49 set_calls_eval(shared->scope_info()->CallsEval()); 48 set_calls_eval(shared->scope_info()->CallsEval());
50 set_compiler_hints(shared->compiler_hints()); 49 set_compiler_hints(shared->compiler_hints());
51 set_start_position(shared->start_position()); 50 set_start_position(shared->start_position());
52 set_end_position(shared->end_position()); 51 set_end_position(shared->end_position());
53 function_literal_id_ = shared->function_literal_id(); 52 function_literal_id_ = shared->function_literal_id();
54 set_stack_limit(isolate_->stack_guard()->real_climit()); 53 set_stack_limit(isolate_->stack_guard()->real_climit());
55 set_unicode_cache(isolate_->unicode_cache()); 54 set_unicode_cache(isolate_->unicode_cache());
56 set_language_mode(shared->language_mode()); 55 set_language_mode(shared->language_mode());
57 set_shared_info(shared); 56 set_shared_info(shared);
58 set_module(shared->kind() == FunctionKind::kModule); 57 set_module(shared->kind() == FunctionKind::kModule);
59 58
60 Handle<Script> script(Script::cast(shared->script())); 59 Handle<Script> script(Script::cast(shared->script()));
61 set_script(script); 60 set_script(script);
62 set_native(script->type() == Script::TYPE_NATIVE); 61 set_native(script->type() == Script::TYPE_NATIVE);
63 set_eval(script->compilation_type() == Script::COMPILATION_TYPE_EVAL); 62 set_eval(script->compilation_type() == Script::COMPILATION_TYPE_EVAL);
64 63
65 Handle<HeapObject> scope_info(shared->outer_scope_info()); 64 Handle<HeapObject> scope_info(shared->outer_scope_info());
66 if (!scope_info->IsTheHole(isolate()) && 65 if (!scope_info->IsTheHole(isolate()) &&
67 Handle<ScopeInfo>::cast(scope_info)->length() > 0) { 66 Handle<ScopeInfo>::cast(scope_info)->length() > 0) {
68 set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info)); 67 set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info));
69 } 68 }
70 } 69 }
71 70
72 ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared, 71 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
73 std::shared_ptr<Zone> zone)
74 : ParseInfo(shared) {
75 zone_.swap(zone);
76 }
77
78 ParseInfo::ParseInfo(Handle<Script> script)
79 : ParseInfo(script->GetIsolate()->allocator()) {
80 isolate_ = script->GetIsolate(); 72 isolate_ = script->GetIsolate();
81 73
82 set_allow_lazy_parsing(); 74 set_allow_lazy_parsing();
83 set_toplevel(); 75 set_toplevel();
84 set_hash_seed(isolate_->heap()->HashSeed()); 76 set_hash_seed(isolate_->heap()->HashSeed());
85 set_stack_limit(isolate_->stack_guard()->real_climit()); 77 set_stack_limit(isolate_->stack_guard()->real_climit());
86 set_unicode_cache(isolate_->unicode_cache()); 78 set_unicode_cache(isolate_->unicode_cache());
87 set_script(script); 79 set_script(script);
88 80
89 set_native(script->type() == Script::TYPE_NATIVE); 81 set_native(script->type() == Script::TYPE_NATIVE);
(...skipping 19 matching lines...) Expand all
109 } 101 }
110 102
111 #ifdef DEBUG 103 #ifdef DEBUG
112 bool ParseInfo::script_is_native() const { 104 bool ParseInfo::script_is_native() const {
113 return script_->type() == Script::TYPE_NATIVE; 105 return script_->type() == Script::TYPE_NATIVE;
114 } 106 }
115 #endif // DEBUG 107 #endif // DEBUG
116 108
117 } // namespace internal 109 } // namespace internal
118 } // namespace v8 110 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parse-info.h ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698