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

Side by Side Diff: src/compiler.cc

Issue 1604543002: [compiler] Remove CodeStub from CompilationInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 4 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 unified diff | Download patch
« no previous file with comments | « src/compiler.h ('k') | src/compiler/code-stub-assembler.h » ('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 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/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return parse_info_ && parse_info_->literal() != nullptr; 103 return parse_info_ && parse_info_->literal() != nullptr;
104 } 104 }
105 105
106 106
107 bool CompilationInfo::has_scope() const { 107 bool CompilationInfo::has_scope() const {
108 return parse_info_ && parse_info_->scope() != nullptr; 108 return parse_info_ && parse_info_->scope() != nullptr;
109 } 109 }
110 110
111 111
112 CompilationInfo::CompilationInfo(ParseInfo* parse_info) 112 CompilationInfo::CompilationInfo(ParseInfo* parse_info)
113 : CompilationInfo(parse_info, nullptr, nullptr, BASE, parse_info->isolate(), 113 : CompilationInfo(parse_info, nullptr, Code::ComputeFlags(Code::FUNCTION),
114 parse_info->zone()) { 114 BASE, parse_info->isolate(), parse_info->zone()) {
115 // Compiling for the snapshot typically results in different code than 115 // Compiling for the snapshot typically results in different code than
116 // compiling later on. This means that code recompiled with deoptimization 116 // compiling later on. This means that code recompiled with deoptimization
117 // support won't be "equivalent" (as defined by SharedFunctionInfo:: 117 // support won't be "equivalent" (as defined by SharedFunctionInfo::
118 // EnableDeoptimizationSupport), so it will replace the old code and all 118 // EnableDeoptimizationSupport), so it will replace the old code and all
119 // its type feedback. To avoid this, always compile functions in the snapshot 119 // its type feedback. To avoid this, always compile functions in the snapshot
120 // with deoptimization support. 120 // with deoptimization support.
121 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport(); 121 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport();
122 122
123 if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing(); 123 if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing();
124 if (FLAG_turbo_inlining) MarkAsInliningEnabled(); 124 if (FLAG_turbo_inlining) MarkAsInliningEnabled();
125 if (FLAG_turbo_source_positions) MarkAsSourcePositionsEnabled(); 125 if (FLAG_turbo_source_positions) MarkAsSourcePositionsEnabled();
126 if (FLAG_turbo_splitting) MarkAsSplittingEnabled(); 126 if (FLAG_turbo_splitting) MarkAsSplittingEnabled();
127 if (FLAG_turbo_types) MarkAsTypingEnabled(); 127 if (FLAG_turbo_types) MarkAsTypingEnabled();
128 128
129 if (has_shared_info()) { 129 if (has_shared_info()) {
130 if (shared_info()->is_compiled()) { 130 if (shared_info()->is_compiled()) {
131 // We should initialize the CompilationInfo feedback vector from the 131 // We should initialize the CompilationInfo feedback vector from the
132 // passed in shared info, rather than creating a new one. 132 // passed in shared info, rather than creating a new one.
133 feedback_vector_ = Handle<TypeFeedbackVector>( 133 feedback_vector_ = Handle<TypeFeedbackVector>(
134 shared_info()->feedback_vector(), parse_info->isolate()); 134 shared_info()->feedback_vector(), parse_info->isolate());
135 } 135 }
136 if (shared_info()->never_compiled()) MarkAsFirstCompile(); 136 if (shared_info()->never_compiled()) MarkAsFirstCompile();
137 } 137 }
138 } 138 }
139 139
140 140
141 CompilationInfo::CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone) 141 CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate,
142 : CompilationInfo(nullptr, stub, CodeStub::MajorName(stub->MajorKey()), 142 Zone* zone, Code::Flags code_flags)
143 STUB, isolate, zone) {} 143 : CompilationInfo(nullptr, debug_name, code_flags, STUB, isolate, zone) {}
144 144
145 CompilationInfo::CompilationInfo(const char* debug_name, Isolate* isolate, 145 CompilationInfo::CompilationInfo(ParseInfo* parse_info, const char* debug_name,
146 Zone* zone) 146 Code::Flags code_flags, Mode mode,
147 : CompilationInfo(nullptr, nullptr, debug_name, STUB, isolate, zone) {
148 set_output_code_kind(Code::STUB);
149 }
150
151 CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
152 const char* debug_name, Mode mode,
153 Isolate* isolate, Zone* zone) 147 Isolate* isolate, Zone* zone)
154 : parse_info_(parse_info), 148 : parse_info_(parse_info),
155 isolate_(isolate), 149 isolate_(isolate),
156 flags_(0), 150 flags_(0),
157 code_stub_(code_stub), 151 code_flags_(code_flags),
158 mode_(mode), 152 mode_(mode),
159 osr_ast_id_(BailoutId::None()), 153 osr_ast_id_(BailoutId::None()),
160 zone_(zone), 154 zone_(zone),
161 deferred_handles_(nullptr), 155 deferred_handles_(nullptr),
162 dependencies_(isolate, zone), 156 dependencies_(isolate, zone),
163 bailout_reason_(kNoReason), 157 bailout_reason_(kNoReason),
164 prologue_offset_(Code::kPrologueOffsetNotSet), 158 prologue_offset_(Code::kPrologueOffsetNotSet),
165 track_positions_(FLAG_hydrogen_track_positions || 159 track_positions_(FLAG_hydrogen_track_positions ||
166 isolate->cpu_profiler()->is_profiling()), 160 isolate->cpu_profiler()->is_profiling()),
167 opt_count_(has_shared_info() ? shared_info()->opt_count() : 0), 161 opt_count_(has_shared_info() ? shared_info()->opt_count() : 0),
168 parameter_count_(0), 162 parameter_count_(0),
169 optimization_id_(-1), 163 optimization_id_(-1),
170 osr_expr_stack_height_(0), 164 osr_expr_stack_height_(0),
171 debug_name_(debug_name) { 165 debug_name_(debug_name) {}
172 // Parameter count is number of stack parameters.
173 if (code_stub_ != NULL) {
174 CodeStubDescriptor descriptor(code_stub_);
175 parameter_count_ = descriptor.GetStackParameterCount();
176 if (descriptor.function_mode() == NOT_JS_FUNCTION_STUB_MODE) {
177 parameter_count_--;
178 }
179 set_output_code_kind(code_stub->GetCodeKind());
180 } else {
181 set_output_code_kind(Code::FUNCTION);
182 }
183 }
184 166
185 167
186 CompilationInfo::~CompilationInfo() { 168 CompilationInfo::~CompilationInfo() {
187 DisableFutureOptimization(); 169 DisableFutureOptimization();
188 delete deferred_handles_; 170 delete deferred_handles_;
189 #ifdef DEBUG 171 #ifdef DEBUG
190 // Check that no dependent maps have been added or added dependent maps have 172 // Check that no dependent maps have been added or added dependent maps have
191 // been rolled back or committed. 173 // been rolled back or committed.
192 DCHECK(dependencies()->IsEmpty()); 174 DCHECK(dependencies()->IsEmpty());
193 #endif // DEBUG 175 #endif // DEBUG
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 } 1827 }
1846 1828
1847 #if DEBUG 1829 #if DEBUG
1848 void CompilationInfo::PrintAstForTesting() { 1830 void CompilationInfo::PrintAstForTesting() {
1849 PrintF("--- Source from AST ---\n%s\n", 1831 PrintF("--- Source from AST ---\n%s\n",
1850 PrettyPrinter(isolate()).PrintProgram(literal())); 1832 PrettyPrinter(isolate()).PrintProgram(literal()));
1851 } 1833 }
1852 #endif 1834 #endif
1853 } // namespace internal 1835 } // namespace internal
1854 } // namespace v8 1836 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698