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: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart

Issue 800903005: dart2js OldEmitter: name anonymous function so it does not need to be copied in deferred parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 // TODO(ahe): Share these with js_helper.dart. 7 // TODO(ahe): Share these with js_helper.dart.
8 const FUNCTION_INDEX = 0; 8 const FUNCTION_INDEX = 0;
9 const NAME_INDEX = 1; 9 const NAME_INDEX = 1;
10 const CALL_NAME_INDEX = 2; 10 const CALL_NAME_INDEX = 2;
11 const REQUIRED_PARAMETER_INDEX = 3; 11 const REQUIRED_PARAMETER_INDEX = 3;
12 const OPTIONAL_PARAMETER_INDEX = 4; 12 const OPTIONAL_PARAMETER_INDEX = 4;
13 const DEFAULT_ARGUMENTS_INDEX = 5; 13 const DEFAULT_ARGUMENTS_INDEX = 5;
14 14
15 const bool VALIDATE_DATA = false; 15 const bool VALIDATE_DATA = false;
16 16
17 // TODO(zarah): Rename this when renaming this file.
18 String get parseReflectionDataName => 'parseReflectionData';
19
17 jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter, 20 jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
18 JavaScriptBackend backend) { 21 JavaScriptBackend backend) {
19 Namer namer = backend.namer; 22 Namer namer = backend.namer;
20 Compiler compiler = backend.compiler; 23 Compiler compiler = backend.compiler;
21 CodeEmitterTask emitter = backend.emitter; 24 CodeEmitterTask emitter = backend.emitter;
22 25
23 String metadataField = '"${namer.metadataField}"'; 26 String metadataField = '"${namer.metadataField}"';
24 String reflectableField = namer.reflectableField; 27 String reflectableField = namer.reflectableField;
25 String reflectionInfoField = namer.reflectionInfoField; 28 String reflectionInfoField = namer.reflectionInfoField;
26 String reflectionNameField = namer.reflectionNameField; 29 String reflectionNameField = namer.reflectionNameField;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 'notInCspMode': !compiler.useContentSecurityPolicy}); 415 'notInCspMode': !compiler.useContentSecurityPolicy});
413 416
414 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; 417 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[];
415 if (compiler.hasIncrementalSupport) { 418 if (compiler.hasIncrementalSupport) {
416 incrementalSupport.add( 419 incrementalSupport.add(
417 js.statement( 420 js.statement(
418 r'self.$dart_unsafe_eval.addStubs = addStubs;')); 421 r'self.$dart_unsafe_eval.addStubs = addStubs;'));
419 } 422 }
420 423
421 return js(''' 424 return js('''
422 (function (reflectionData) { 425 function $parseReflectionDataName(reflectionData) {
423 "use strict"; 426 "use strict";
424 #header; 427 #header;
425 if (#needsClassSupport) { 428 if (#needsClassSupport) {
426 #defineClass; 429 #defineClass;
427 #inheritFrom; 430 #inheritFrom;
428 #finishClasses; 431 #finishClasses;
429 #processClassData; 432 #processClassData;
430 } 433 }
431 #processStatics; 434 #processStatics;
432 #addStubs; 435 #addStubs;
433 #tearOffCode; 436 #tearOffCode;
434 #incrementalSupport; 437 #incrementalSupport;
435 #init; 438 #init;
436 })''', { 439 }''', {
437 'header': header, 440 'header': header,
438 'defineClass': oldEmitter.defineClassFunction, 441 'defineClass': oldEmitter.defineClassFunction,
439 'inheritFrom': oldEmitter.buildInheritFrom(), 442 'inheritFrom': oldEmitter.buildInheritFrom(),
440 'processClassData': processClassData, 443 'processClassData': processClassData,
441 'processStatics': processStatics, 444 'processStatics': processStatics,
442 'incrementalSupport': incrementalSupport, 445 'incrementalSupport': incrementalSupport,
443 'addStubs': addStubs, 446 'addStubs': addStubs,
444 'tearOffCode': tearOffCode, 447 'tearOffCode': tearOffCode,
445 'init': init, 448 'init': init,
446 'finishClasses': finishClasses, 449 'finishClasses': finishClasses,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 (function() { 562 (function() {
560 var result = $array[$index]; 563 var result = $array[$index];
561 if ($check) { 564 if ($check) {
562 throw new Error( 565 throw new Error(
563 name + ": expected value of type \'$type\' at index " + ($index) + 566 name + ": expected value of type \'$type\' at index " + ($index) +
564 " but got " + (typeof result)); 567 " but got " + (typeof result));
565 } 568 }
566 return result; 569 return result;
567 })()'''; 570 })()''';
568 } 571 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698