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

Side by Side Diff: src/compiler.cc

Issue 1900613002: [compiler] Let CompileForLiveEdit use common pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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
« no previous file with comments | « src/compiler.h ('k') | src/debug/liveedit.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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 return false; 1171 return false;
1172 } 1172 }
1173 1173
1174 // Check postconditions on success. 1174 // Check postconditions on success.
1175 DCHECK(!isolate->has_pending_exception()); 1175 DCHECK(!isolate->has_pending_exception());
1176 DCHECK(shared->is_compiled()); 1176 DCHECK(shared->is_compiled());
1177 DCHECK(shared->HasDebugCode()); 1177 DCHECK(shared->HasDebugCode());
1178 return true; 1178 return true;
1179 } 1179 }
1180 1180
1181 void Compiler::CompileForLiveEdit(Handle<Script> script) { 1181 bool Compiler::CompileForLiveEdit(Handle<Script> script) {
1182 Isolate* isolate = script->GetIsolate(); 1182 Isolate* isolate = script->GetIsolate();
1183 DCHECK(AllowCompilation::IsAllowed(isolate)); 1183 DCHECK(AllowCompilation::IsAllowed(isolate));
1184 1184
1185 // Start a compilation. 1185 // Start a compilation.
1186 // TODO(635): support extensions.
1187 Zone zone(isolate->allocator()); 1186 Zone zone(isolate->allocator());
1188 ParseInfo parse_info(&zone, script); 1187 ParseInfo parse_info(&zone, script);
1189 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1188 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1190 PostponeInterruptsScope postpone(isolate); 1189 parse_info.set_global();
1191 VMState<COMPILER> state(isolate); 1190 info.MarkAsDebug();
1191 // TODO(635): support extensions.
1192 if (CompileToplevel(&info).is_null()) {
1193 return false;
1194 }
1192 1195
1193 info.MarkAsDebug(); 1196 // Check postconditions on success.
1194 info.parse_info()->set_global(); 1197 DCHECK(!isolate->has_pending_exception());
1195 if (!Parser::ParseStatic(info.parse_info())) return; 1198 return true;
1196
1197 LiveEditFunctionTracker tracker(isolate, parse_info.literal());
1198 if (!CompileBaselineCode(&info)) return;
1199 tracker.RecordRootFunctionInfo(info.code());
1200 } 1199 }
1201 1200
1202 // TODO(turbofan): In the future, unoptimized code with deopt support could 1201 // TODO(turbofan): In the future, unoptimized code with deopt support could
1203 // be generated lazily once deopt is triggered. 1202 // be generated lazily once deopt is triggered.
1204 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { 1203 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
1205 DCHECK_NOT_NULL(info->literal()); 1204 DCHECK_NOT_NULL(info->literal());
1206 DCHECK_NOT_NULL(info->scope()); 1205 DCHECK_NOT_NULL(info->scope());
1207 Handle<SharedFunctionInfo> shared = info->shared_info(); 1206 Handle<SharedFunctionInfo> shared = info->shared_info();
1208 if (!shared->has_deoptimization_support()) { 1207 if (!shared->has_deoptimization_support()) {
1209 // TODO(titzer): just reuse the ParseInfo for the unoptimized compile. 1208 // TODO(titzer): just reuse the ParseInfo for the unoptimized compile.
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 MaybeHandle<Code> code; 1703 MaybeHandle<Code> code;
1705 if (cached.code != nullptr) code = handle(cached.code); 1704 if (cached.code != nullptr) code = handle(cached.code);
1706 Handle<Context> native_context(function->context()->native_context()); 1705 Handle<Context> native_context(function->context()->native_context());
1707 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1706 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1708 literals, BailoutId::None()); 1707 literals, BailoutId::None());
1709 } 1708 }
1710 } 1709 }
1711 1710
1712 } // namespace internal 1711 } // namespace internal
1713 } // namespace v8 1712 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/debug/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698