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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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 | « pkg/compiler/lib/src/js_emitter/metadata_collector.dart ('k') | pkg/js_ast/lib/src/nodes.dart » ('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 (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.js_emitter.startup_emitter.model_emitter; 5 library dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 import 'dart:convert' show JsonEncoder; 7 import 'dart:convert' show JsonEncoder;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show 9 import 'package:js_runtime/shared/embedded_names.dart' show
10 CLASS_FIELDS_EXTRACTOR, 10 CLASS_FIELDS_EXTRACTOR,
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 compiler.outputProvider('', 'js'), 274 compiler.outputProvider('', 'js'),
275 codeOutputListeners); 275 codeOutputListeners);
276 outputBuffers[fragment] = mainOutput; 276 outputBuffers[fragment] = mainOutput;
277 277
278 js.Program program = new js.Program([ 278 js.Program program = new js.Program([
279 buildGeneratedBy(), 279 buildGeneratedBy(),
280 new js.Comment(HOOKS_API_USAGE), 280 new js.Comment(HOOKS_API_USAGE),
281 isSplit ? buildDeferredInitializerGlobal() : new js.Block.empty(), 281 isSplit ? buildDeferredInitializerGlobal() : new js.Block.empty(),
282 code]); 282 code]);
283 283
284 mainOutput.addBuffer(js.prettyPrint(program, compiler, 284 mainOutput.addBuffer(js.createCodeBuffer(program, compiler,
285 monitor: compiler.dumpInfoTask)); 285 monitor: compiler.dumpInfoTask));
286 286
287 if (shouldGenerateSourceMap) { 287 if (shouldGenerateSourceMap) {
288 mainOutput.add( 288 mainOutput.add(
289 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri)); 289 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri));
290 } 290 }
291 291
292 mainOutput.close(); 292 mainOutput.close();
293 293
294 if (shouldGenerateSourceMap) { 294 if (shouldGenerateSourceMap) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // function in a temporary field first: 328 // function in a temporary field first:
329 // 329 //
330 // deferredInitializer.current = <pretty-printed code>; 330 // deferredInitializer.current = <pretty-printed code>;
331 // deferredInitializer[<hash>] = deferredInitializer.current; 331 // deferredInitializer[<hash>] = deferredInitializer.current;
332 332
333 js.Program program = new js.Program([ 333 js.Program program = new js.Program([
334 buildGeneratedBy(), 334 buildGeneratedBy(),
335 buildDeferredInitializerGlobal(), 335 buildDeferredInitializerGlobal(),
336 js.js.statement('$deferredInitializersGlobal.current = #', code)]); 336 js.js.statement('$deferredInitializersGlobal.current = #', code)]);
337 337
338 output.addBuffer(js.prettyPrint(program, compiler, 338 output.addBuffer(js.createCodeBuffer(program, compiler,
339 monitor: compiler.dumpInfoTask)); 339 monitor: compiler.dumpInfoTask));
340 340
341 // Make a unique hash of the code (before the sourcemaps are added) 341 // Make a unique hash of the code (before the sourcemaps are added)
342 // This will be used to retrieve the initializing function from the global 342 // This will be used to retrieve the initializing function from the global
343 // variable. 343 // variable.
344 String hash = hasher.getHash(); 344 String hash = hasher.getHash();
345 345
346 // Now we copy the deferredInitializer.current into its correct hash. 346 // Now we copy the deferredInitializer.current into its correct hash.
347 output.add('\n${deferredInitializersGlobal}["$hash"] = ' 347 output.add('\n${deferredInitializersGlobal}["$hash"] = '
348 '${deferredInitializersGlobal}.current'); 348 '${deferredInitializersGlobal}.current');
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // Json does not support comments, so we embed the explanation in the 415 // Json does not support comments, so we embed the explanation in the
416 // data. 416 // data.
417 mapping["_comment"] = "This mapping shows which compiled `.js` files are " 417 mapping["_comment"] = "This mapping shows which compiled `.js` files are "
418 "needed for a given deferred library import."; 418 "needed for a given deferred library import.";
419 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); 419 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap());
420 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map') 420 compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map')
421 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) 421 ..add(const JsonEncoder.withIndent(" ").convert(mapping))
422 ..close(); 422 ..close();
423 } 423 }
424 } 424 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/metadata_collector.dart ('k') | pkg/js_ast/lib/src/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698