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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 7
8 class OldEmitter implements Emitter { 8 class OldEmitter implements Emitter {
9 final Compiler compiler; 9 final Compiler compiler;
10 final CodeEmitterTask task; 10 final CodeEmitterTask task;
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 }""", 1406 }""",
1407 { 'helper': js('this.#', [namer.incrementalHelperName]), 1407 { 'helper': js('this.#', [namer.incrementalHelperName]),
1408 'schemaChange': buildSchemaChangeFunction(), 1408 'schemaChange': buildSchemaChangeFunction(),
1409 'addMethod': buildIncrementalAddMethod() }), compiler)); 1409 'addMethod': buildIncrementalAddMethod() }), compiler));
1410 } 1410 }
1411 if (isProgramSplit) { 1411 if (isProgramSplit) {
1412 /// We collect all the global state of the, so it can be passed to the 1412 /// We collect all the global state of the, so it can be passed to the
1413 /// initializer of deferred files. 1413 /// initializer of deferred files.
1414 mainBuffer.write('var ${globalsHolder}$_=${_}Object.create(null)$N'); 1414 mainBuffer.write('var ${globalsHolder}$_=${_}Object.create(null)$N');
1415 } 1415 }
1416 mainBuffer.write('function dart()$_{$n' 1416
1417 '${_}${_}this.x$_=${_}0$N' 1417 jsAst.Statement mapFunction = js.statement('''
1418 '${_}${_}delete this.x$N' 1418 // [map] returns an object that V8 shouldn't try to optimize with a hidden
1419 '}$n'); 1419 // class. This prevents a potential performance problem where V8 tries to build
1420 // a hidden class for an object used as a hashMap.
1421 // It requires fewer characters to declare a variable as a parameter than
1422 // with `var`.
1423 function map(x) {
1424 x = Object.create(null);
1425 x.x = 0;
1426 delete x.x;
1427 return x;
1428 }
1429 ''');
1430 mainBuffer.write(jsAst.prettyPrint(mapFunction, compiler));
1420 for (String globalObject in Namer.reservedGlobalObjectNames) { 1431 for (String globalObject in Namer.reservedGlobalObjectNames) {
1421 // The global objects start as so-called "slow objects". For V8, this 1432 // The global objects start as so-called "slow objects". For V8, this
1422 // means that it won't try to make map transitions as we add properties 1433 // means that it won't try to make map transitions as we add properties
1423 // to these objects. Later on, we attempt to turn these objects into 1434 // to these objects. Later on, we attempt to turn these objects into
1424 // fast objects by calling "convertToFastObject" (see 1435 // fast objects by calling "convertToFastObject" (see
1425 // [emitConvertToFastObjectFunction]). 1436 // [emitConvertToFastObjectFunction]).
1426 mainBuffer.write('var ${globalObject}$_=${_}'); 1437 mainBuffer.write('var ${globalObject}$_=${_}');
1427 if(isProgramSplit) { 1438 if(isProgramSplit) {
1428 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}'); 1439 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}');
1429 } 1440 }
1430 mainBuffer.write('new dart$N'); 1441 mainBuffer.write('map()$N');
1431 } 1442 }
1432 1443
1433 mainBuffer.write('function ${namer.isolateName}()$_{}\n'); 1444 mainBuffer.write('function ${namer.isolateName}()$_{}\n');
1434 if (isProgramSplit) { 1445 if (isProgramSplit) {
1435 mainBuffer.write( 1446 mainBuffer.write(
1436 '${globalsHolder}.${namer.isolateName}$_=$_${namer.isolateName}$N' 1447 '${globalsHolder}.${namer.isolateName}$_=$_${namer.isolateName}$N'
1437 '${globalsHolder}.$initName$_=${_}$initName$N' 1448 '${globalsHolder}.$initName$_=${_}$initName$N'
1438 '${globalsHolder}.$parseReflectionDataName$_=$_' 1449 '${globalsHolder}.$parseReflectionDataName$_=$_'
1439 '$parseReflectionDataName$N'); 1450 '$parseReflectionDataName$N');
1440 } 1451 }
(...skipping 29 matching lines...) Expand all
1470 elementDescriptors.remove(library); 1481 elementDescriptors.remove(library);
1471 } 1482 }
1472 1483
1473 mainBuffer 1484 mainBuffer
1474 ..write( 1485 ..write(
1475 jsAst.prettyPrint( 1486 jsAst.prettyPrint(
1476 getReflectionDataParser(this, backend), 1487 getReflectionDataParser(this, backend),
1477 compiler)) 1488 compiler))
1478 ..write(n); 1489 ..write(n);
1479 1490
1480 mainBuffer..write('$parseReflectionDataName([$n') 1491 // The argument to reflectionDataParser is assigned to a temporary 'dart'
1492 // so that 'dart.' will appear as the prefix to dart methods in stack
1493 // traces and profile entries.
ahe 2015/01/07 14:19:11 (on V8).
1494 mainBuffer..write('var dart = [$n')
1481 ..write(libraryBuffer) 1495 ..write(libraryBuffer)
1482 ..write('])$N'); 1496 ..write(']$N')
1497 ..write('$parseReflectionDataName(dart)$N');
1483 } 1498 }
1484 1499
1485 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); 1500 interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
1486 interceptorEmitter.emitOneShotInterceptors(mainBuffer); 1501 interceptorEmitter.emitOneShotInterceptors(mainBuffer);
1487 1502
1488 if (task.outputContainsConstantList) { 1503 if (task.outputContainsConstantList) {
1489 emitMakeConstantList(mainBuffer); 1504 emitMakeConstantList(mainBuffer);
1490 } 1505 }
1491 1506
1492 // Constants in checked mode call into RTI code to set type information 1507 // Constants in checked mode call into RTI code to set type information
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 '$globalsHolder.$parseReflectionDataName$N') 1932 '$globalsHolder.$parseReflectionDataName$N')
1918 ..write('var ${namer.isolateName}$_=$_' 1933 ..write('var ${namer.isolateName}$_=$_'
1919 '${globalsHolder}.${namer.isolateName}$N'); 1934 '${globalsHolder}.${namer.isolateName}$N');
1920 if (libraryDescriptorBuffer != null) { 1935 if (libraryDescriptorBuffer != null) {
1921 // TODO(ahe): This defines a lot of properties on the 1936 // TODO(ahe): This defines a lot of properties on the
1922 // Isolate.prototype object. We know this will turn it into a 1937 // Isolate.prototype object. We know this will turn it into a
1923 // slow object in V8, so instead we should do something similar 1938 // slow object in V8, so instead we should do something similar
1924 // to Isolate.$finishIsolateConstructor. 1939 // to Isolate.$finishIsolateConstructor.
1925 outputBuffer 1940 outputBuffer
1926 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') 1941 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
1927 ..write('$parseReflectionDataName([$n') 1942 // The argument to reflectionDataParser is assigned to a temporary
1943 // 'dart' so that 'dart.' will appear as the prefix to dart methods
1944 // in stack traces and profile entries.
ahe 2015/01/07 14:19:11 Refactor code so you don't need to duplicate the c
1945 ..write('var dart = [$n ')
1928 ..addBuffer(libraryDescriptorBuffer) 1946 ..addBuffer(libraryDescriptorBuffer)
1929 ..write('])$N'); 1947 ..write(']$N')
1948 ..write('$parseReflectionDataName(dart)$N');
1930 1949
1931 } 1950 }
1932 1951
1933 // Set the currentIsolate variable to the current isolate (which is 1952 // Set the currentIsolate variable to the current isolate (which is
1934 // provided as second argument). 1953 // provided as second argument).
1935 // We need to do this, because we use the same variable for setting up 1954 // We need to do this, because we use the same variable for setting up
1936 // the isolate-properties and for storing the current isolate. During 1955 // the isolate-properties and for storing the current isolate. During
1937 // the setup (the code above this lines) we must set the variable to 1956 // the setup (the code above this lines) we must set the variable to
1938 // the isolate-properties. 1957 // the isolate-properties.
1939 // After we have done the setup it must point to the current Isolate. 1958 // After we have done the setup it must point to the current Isolate.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2047 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2029 if (element.isInstanceMember) { 2048 if (element.isInstanceMember) {
2030 cachedClassBuilders.remove(element.enclosingClass); 2049 cachedClassBuilders.remove(element.enclosingClass);
2031 2050
2032 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2051 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2033 2052
2034 } 2053 }
2035 } 2054 }
2036 } 2055 }
2037 } 2056 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698