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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart

Issue 798873004: dart2js: change output so that in stack traces, dart method names get prefixed with 'dart.' instead… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added comment. 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
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;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 emitter.generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTED_NAMES); 46 emitter.generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTED_NAMES);
47 jsAst.Expression mangledGlobalNamesAccess = 47 jsAst.Expression mangledGlobalNamesAccess =
48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES); 48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES);
49 jsAst.Expression mangledNamesAccess = 49 jsAst.Expression mangledNamesAccess =
50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES); 50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES);
51 jsAst.Expression librariesAccess = 51 jsAst.Expression librariesAccess =
52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES); 52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES);
53 jsAst.Expression metadataAccess = 53 jsAst.Expression metadataAccess =
54 emitter.generateEmbeddedGlobalAccess(embeddedNames.METADATA); 54 emitter.generateEmbeddedGlobalAccess(embeddedNames.METADATA);
55 55
56 jsAst.Statement header = js.statement('''
57 // [map] returns an object literal that V8 shouldn not try to optimize with a
58 // hidden class. This prevents a potential performance problem where V8 tries
59 // to build a hidden class for an object used as a hashMap.
60 // It requires fewer characters to declare a variable as a parameter than
61 // with `var`.
62 function map(x){x=Object.create(null);x.x=0;delete x.x;return x}
63 ''');
64
65 jsAst.Statement processClassData = js.statement('''{ 56 jsAst.Statement processClassData = js.statement('''{
66 function processClassData(cls, descriptor, processedClasses) { 57 function processClassData(cls, descriptor, processedClasses) {
67 var newDesc = {}; 58 var newDesc = {};
68 var previousProperty; 59 var previousProperty;
69 for (var property in descriptor) { 60 for (var property in descriptor) {
70 if (!hasOwnProperty.call(descriptor, property)) continue; 61 if (!hasOwnProperty.call(descriptor, property)) continue;
71 var firstChar = property.substring(0, 1); 62 var firstChar = property.substring(0, 1);
72 if (property === "static") { 63 if (property === "static") {
73 processStatics(#embeddedStatics[cls] = descriptor[property], 64 processStatics(#embeddedStatics[cls] = descriptor[property],
74 processedClasses); 65 processedClasses);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; 413 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[];
423 if (compiler.hasIncrementalSupport) { 414 if (compiler.hasIncrementalSupport) {
424 incrementalSupport.add( 415 incrementalSupport.add(
425 js.statement( 416 js.statement(
426 r'self.$dart_unsafe_eval.addStubs = addStubs;')); 417 r'self.$dart_unsafe_eval.addStubs = addStubs;'));
427 } 418 }
428 419
429 return js(''' 420 return js('''
430 function $parseReflectionDataName(reflectionData) { 421 function $parseReflectionDataName(reflectionData) {
431 "use strict"; 422 "use strict";
432 #header;
433 if (#needsClassSupport) { 423 if (#needsClassSupport) {
434 #defineClass; 424 #defineClass;
435 #inheritFrom; 425 #inheritFrom;
436 #finishClasses; 426 #finishClasses;
437 #processClassData; 427 #processClassData;
438 } 428 }
439 #processStatics; 429 #processStatics;
440 #addStubs; 430 #addStubs;
441 #tearOffCode; 431 #tearOffCode;
442 #incrementalSupport; 432 #incrementalSupport;
443 #init; 433 #init;
444 }''', { 434 }''', {
445 'header': header,
446 'defineClass': oldEmitter.defineClassFunction, 435 'defineClass': oldEmitter.defineClassFunction,
447 'inheritFrom': oldEmitter.buildInheritFrom(), 436 'inheritFrom': oldEmitter.buildInheritFrom(),
448 'processClassData': processClassData, 437 'processClassData': processClassData,
449 'processStatics': processStatics, 438 'processStatics': processStatics,
450 'incrementalSupport': incrementalSupport, 439 'incrementalSupport': incrementalSupport,
451 'addStubs': addStubs, 440 'addStubs': addStubs,
452 'tearOffCode': tearOffCode, 441 'tearOffCode': tearOffCode,
453 'init': init, 442 'init': init,
454 'finishClasses': finishClasses, 443 'finishClasses': finishClasses,
455 'needsClassSupport': oldEmitter.needsClassSupport}); 444 'needsClassSupport': oldEmitter.needsClassSupport});
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 (function() { 556 (function() {
568 var result = $array[$index]; 557 var result = $array[$index];
569 if ($check) { 558 if ($check) {
570 throw new Error( 559 throw new Error(
571 name + ": expected value of type \'$type\' at index " + ($index) + 560 name + ": expected value of type \'$type\' at index " + ($index) +
572 " but got " + (typeof result)); 561 " but got " + (typeof result));
573 } 562 }
574 return result; 563 return result;
575 })()'''; 564 })()''';
576 } 565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698