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

Side by Side Diff: src/compiler.cc

Issue 2413673002: Mark ParseInfo as eval in the constructors (Closed)
Patch Set: fix Created 4 years, 2 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 | « no previous file | src/parsing/parse-info.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 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 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 AddWeakObjectToCodeDependency(isolate, object, code); 244 AddWeakObjectToCodeDependency(isolate, object, code);
245 } 245 }
246 code->set_can_have_weak_objects(true); 246 code->set_can_have_weak_objects(true);
247 } 247 }
248 248
249 // ---------------------------------------------------------------------------- 249 // ----------------------------------------------------------------------------
250 // Local helper methods that make up the compilation pipeline. 250 // Local helper methods that make up the compilation pipeline.
251 251
252 namespace { 252 namespace {
253 253
254 bool IsEvalToplevel(Handle<SharedFunctionInfo> shared) {
255 return shared->is_toplevel() && shared->script()->IsScript() &&
256 Script::cast(shared->script())->compilation_type() ==
257 Script::COMPILATION_TYPE_EVAL;
258 }
259
260 bool Parse(ParseInfo* info) { 254 bool Parse(ParseInfo* info) {
261 // Create a canonical handle scope if compiling ignition bytecode. This is 255 // Create a canonical handle scope if compiling ignition bytecode. This is
262 // required by the constant array builder to de-duplicate objects without 256 // required by the constant array builder to de-duplicate objects without
263 // dereferencing handles. 257 // dereferencing handles.
264 std::unique_ptr<CanonicalHandleScope> canonical; 258 std::unique_ptr<CanonicalHandleScope> canonical;
265 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info->isolate())); 259 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info->isolate()));
266 260
267 return Parser::ParseStatic(info); 261 return Parser::ParseStatic(info);
268 } 262 }
269 263
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // TurboFan can optimize directly from existing bytecode. 692 // TurboFan can optimize directly from existing bytecode.
699 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { 693 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) {
700 if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>(); 694 if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>();
701 if (!Compiler::EnsureBytecode(info)) { 695 if (!Compiler::EnsureBytecode(info)) {
702 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); 696 if (isolate->has_pending_exception()) isolate->clear_pending_exception();
703 return MaybeHandle<Code>(); 697 return MaybeHandle<Code>();
704 } 698 }
705 info->MarkAsOptimizeFromBytecode(); 699 info->MarkAsOptimizeFromBytecode();
706 } 700 }
707 701
708 if (IsEvalToplevel(shared)) {
709 parse_info->set_eval();
710 parse_info->set_allow_lazy_parsing(false);
711 }
712
713 // Verify that OSR compilations are delegated to the correct graph builder. 702 // Verify that OSR compilations are delegated to the correct graph builder.
714 // Depending on the underlying frame the semantics of the {BailoutId} differ 703 // Depending on the underlying frame the semantics of the {BailoutId} differ
715 // and the various graph builders hard-code a certain semantic: 704 // and the various graph builders hard-code a certain semantic:
716 // - Interpreter : The BailoutId represents a bytecode offset. 705 // - Interpreter : The BailoutId represents a bytecode offset.
717 // - FullCodegen : The BailoutId represents the id of an AST node. 706 // - FullCodegen : The BailoutId represents the id of an AST node.
718 DCHECK_IMPLIES(info->is_osr() && ignition_osr, 707 DCHECK_IMPLIES(info->is_osr() && ignition_osr,
719 info->is_optimizing_from_bytecode()); 708 info->is_optimizing_from_bytecode());
720 DCHECK_IMPLIES(info->is_osr() && !ignition_osr, 709 DCHECK_IMPLIES(info->is_osr() && !ignition_osr,
721 !info->is_optimizing_from_bytecode()); 710 !info->is_optimizing_from_bytecode());
722 711
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 } 1216 }
1228 1217
1229 bool Compiler::CompileDebugCode(Handle<JSFunction> function) { 1218 bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
1230 Isolate* isolate = function->GetIsolate(); 1219 Isolate* isolate = function->GetIsolate();
1231 DCHECK(AllowCompilation::IsAllowed(isolate)); 1220 DCHECK(AllowCompilation::IsAllowed(isolate));
1232 1221
1233 // Start a compilation. 1222 // Start a compilation.
1234 Zone zone(isolate->allocator()); 1223 Zone zone(isolate->allocator());
1235 ParseInfo parse_info(&zone, function); 1224 ParseInfo parse_info(&zone, function);
1236 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1225 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1237 if (IsEvalToplevel(handle(function->shared()))) {
1238 parse_info.set_eval();
1239 parse_info.set_allow_lazy_parsing(false);
1240 }
1241 info.MarkAsDebug(); 1226 info.MarkAsDebug();
1242 if (GetUnoptimizedCode(&info).is_null()) { 1227 if (GetUnoptimizedCode(&info).is_null()) {
1243 isolate->clear_pending_exception(); 1228 isolate->clear_pending_exception();
1244 return false; 1229 return false;
1245 } 1230 }
1246 1231
1247 // Check postconditions on success. 1232 // Check postconditions on success.
1248 DCHECK(!isolate->has_pending_exception()); 1233 DCHECK(!isolate->has_pending_exception());
1249 DCHECK(function->shared()->is_compiled()); 1234 DCHECK(function->shared()->is_compiled());
1250 DCHECK(function->shared()->HasDebugCode()); 1235 DCHECK(function->shared()->HasDebugCode());
1251 return true; 1236 return true;
1252 } 1237 }
1253 1238
1254 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { 1239 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) {
1255 Isolate* isolate = shared->GetIsolate(); 1240 Isolate* isolate = shared->GetIsolate();
1256 DCHECK(AllowCompilation::IsAllowed(isolate)); 1241 DCHECK(AllowCompilation::IsAllowed(isolate));
1257 1242
1258 // Start a compilation. 1243 // Start a compilation.
1259 Zone zone(isolate->allocator()); 1244 Zone zone(isolate->allocator());
1260 ParseInfo parse_info(&zone, shared); 1245 ParseInfo parse_info(&zone, shared);
1261 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1246 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1262 if (IsEvalToplevel(shared)) {
1263 parse_info.set_eval();
1264 parse_info.set_allow_lazy_parsing(false);
1265 }
1266 info.MarkAsDebug(); 1247 info.MarkAsDebug();
1267 if (GetUnoptimizedCode(&info).is_null()) { 1248 if (GetUnoptimizedCode(&info).is_null()) {
1268 isolate->clear_pending_exception(); 1249 isolate->clear_pending_exception();
1269 return false; 1250 return false;
1270 } 1251 }
1271 1252
1272 // Check postconditions on success. 1253 // Check postconditions on success.
1273 DCHECK(!isolate->has_pending_exception()); 1254 DCHECK(!isolate->has_pending_exception());
1274 DCHECK(shared->is_compiled()); 1255 DCHECK(shared->is_compiled());
1275 DCHECK(shared->HasDebugCode()); 1256 DCHECK(shared->HasDebugCode());
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 DCHECK(shared->is_compiled()); 1834 DCHECK(shared->is_compiled());
1854 function->set_literals(cached.literals); 1835 function->set_literals(cached.literals);
1855 } else if (shared->is_compiled()) { 1836 } else if (shared->is_compiled()) {
1856 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1837 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1857 JSFunction::EnsureLiterals(function); 1838 JSFunction::EnsureLiterals(function);
1858 } 1839 }
1859 } 1840 }
1860 1841
1861 } // namespace internal 1842 } // namespace internal
1862 } // namespace v8 1843 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parse-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698