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

Side by Side Diff: src/parsing/parser.cc

Issue 1863083002: [parser] Remove ParseInfo::closure field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-compiler-internal-9
Patch Set: Actually remove field. Created 4 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 21 matching lines...) Expand all
32 : owns_data_(false), rejected_(false), data_(data), length_(length) { 32 : owns_data_(false), rejected_(false), data_(data), length_(length) {
33 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { 33 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) {
34 byte* copy = NewArray<byte>(length); 34 byte* copy = NewArray<byte>(length);
35 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); 35 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment));
36 CopyBytes(copy, data, length); 36 CopyBytes(copy, data, length);
37 data_ = copy; 37 data_ = copy;
38 AcquireDataOwnership(); 38 AcquireDataOwnership();
39 } 39 }
40 } 40 }
41 41
42
43 ParseInfo::ParseInfo(Zone* zone) 42 ParseInfo::ParseInfo(Zone* zone)
44 : zone_(zone), 43 : zone_(zone),
45 flags_(0), 44 flags_(0),
46 source_stream_(nullptr), 45 source_stream_(nullptr),
47 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE), 46 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
48 extension_(nullptr), 47 extension_(nullptr),
49 compile_options_(ScriptCompiler::kNoCompileOptions), 48 compile_options_(ScriptCompiler::kNoCompileOptions),
50 script_scope_(nullptr), 49 script_scope_(nullptr),
51 unicode_cache_(nullptr), 50 unicode_cache_(nullptr),
52 stack_limit_(0), 51 stack_limit_(0),
53 hash_seed_(0), 52 hash_seed_(0),
53 isolate_(nullptr),
54 cached_data_(nullptr), 54 cached_data_(nullptr),
55 ast_value_factory_(nullptr), 55 ast_value_factory_(nullptr),
56 literal_(nullptr), 56 literal_(nullptr),
57 scope_(nullptr) {} 57 scope_(nullptr) {}
58 58
59
60 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function) 59 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
61 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) { 60 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {
62 set_closure(function);
63 set_context(Handle<Context>(function->context())); 61 set_context(Handle<Context>(function->context()));
64 } 62 }
65 63
66 64
67 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) 65 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
68 : ParseInfo(zone) { 66 : ParseInfo(zone) {
69 isolate_ = shared->GetIsolate(); 67 isolate_ = shared->GetIsolate();
70 68
71 set_lazy(); 69 set_lazy();
72 set_hash_seed(isolate_->heap()->HashSeed()); 70 set_hash_seed(isolate_->heap()->HashSeed());
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1042
1045 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); 1043 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
1046 1044
1047 // Place holder for the result. 1045 // Place holder for the result.
1048 FunctionLiteral* result = NULL; 1046 FunctionLiteral* result = NULL;
1049 1047
1050 { 1048 {
1051 // Parse the function literal. 1049 // Parse the function literal.
1052 Scope* scope = NewScope(scope_, SCRIPT_SCOPE); 1050 Scope* scope = NewScope(scope_, SCRIPT_SCOPE);
1053 info->set_script_scope(scope); 1051 info->set_script_scope(scope);
1054 if (!info->closure().is_null()) { 1052 if (!info->context().is_null()) {
1055 // Ok to use Isolate here, since lazy function parsing is only done in the 1053 // Ok to use Isolate here, since lazy function parsing is only done in the
1056 // main thread. 1054 // main thread.
1057 DCHECK(parsing_on_main_thread_); 1055 DCHECK(parsing_on_main_thread_);
1058 scope = Scope::DeserializeScopeChain(isolate, zone(), 1056 scope = Scope::DeserializeScopeChain(isolate, zone(), *info->context(),
1059 info->closure()->context(), scope); 1057 scope);
1060 } 1058 }
1061 original_scope_ = scope; 1059 original_scope_ = scope;
1062 AstNodeFactory function_factory(ast_value_factory()); 1060 AstNodeFactory function_factory(ast_value_factory());
1063 FunctionState function_state(&function_state_, &scope_, scope, 1061 FunctionState function_state(&function_state_, &scope_, scope,
1064 shared_info->kind(), &function_factory); 1062 shared_info->kind(), &function_factory);
1065 DCHECK(is_sloppy(scope->language_mode()) || 1063 DCHECK(is_sloppy(scope->language_mode()) ||
1066 is_strict(info->language_mode())); 1064 is_strict(info->language_mode()));
1067 DCHECK(info->language_mode() == shared_info->language_mode()); 1065 DCHECK(info->language_mode() == shared_info->language_mode());
1068 FunctionLiteral::FunctionType function_type = 1066 FunctionLiteral::FunctionType function_type =
1069 ComputeFunctionType(shared_info); 1067 ComputeFunctionType(shared_info);
(...skipping 5799 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 try_block, target); 6867 try_block, target);
6870 final_loop = target; 6868 final_loop = target;
6871 } 6869 }
6872 6870
6873 return final_loop; 6871 return final_loop;
6874 } 6872 }
6875 6873
6876 6874
6877 } // namespace internal 6875 } // namespace internal
6878 } // namespace v8 6876 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698