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

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: 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 literal that V8 shouldn not try to optimize with a
ahe 2015/01/07 12:20:16 shouldn't (remove "not"). map doesn't return an "
zarah 2015/01/07 13:45:17 Done.
1419 '}$n'); 1419 // hidden class. This prevents a potential performance problem where V8 tries
1420 // to build 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){x=Object.create(null);x.x=0;delete x.x;return x}
ahe 2015/01/07 12:20:16 Now that this is parsed, I suggest you reformat it
zarah 2015/01/07 13:45:17 Done.
1424 ''');
1425 mainBuffer.write(jsAst.prettyPrint(mapFunction, compiler));
1420 for (String globalObject in Namer.reservedGlobalObjectNames) { 1426 for (String globalObject in Namer.reservedGlobalObjectNames) {
1421 // The global objects start as so-called "slow objects". For V8, this 1427 // 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 1428 // 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 1429 // to these objects. Later on, we attempt to turn these objects into
1424 // fast objects by calling "convertToFastObject" (see 1430 // fast objects by calling "convertToFastObject" (see
1425 // [emitConvertToFastObjectFunction]). 1431 // [emitConvertToFastObjectFunction]).
1426 mainBuffer.write('var ${globalObject}$_=${_}'); 1432 mainBuffer.write('var ${globalObject}$_=${_}');
1427 if(isProgramSplit) { 1433 if(isProgramSplit) {
1428 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}'); 1434 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}');
1429 } 1435 }
1430 mainBuffer.write('new dart$N'); 1436 mainBuffer.write('map()$N');
1431 } 1437 }
1432 1438
1433 mainBuffer.write('function ${namer.isolateName}()$_{}\n'); 1439 mainBuffer.write('function ${namer.isolateName}()$_{}\n');
1434 if (isProgramSplit) { 1440 if (isProgramSplit) {
1435 mainBuffer.write( 1441 mainBuffer.write(
1436 '${globalsHolder}.${namer.isolateName}$_=$_${namer.isolateName}$N' 1442 '${globalsHolder}.${namer.isolateName}$_=$_${namer.isolateName}$N'
1437 '${globalsHolder}.$initName$_=${_}$initName$N' 1443 '${globalsHolder}.$initName$_=${_}$initName$N'
1438 '${globalsHolder}.$parseReflectionDataName$_=$_' 1444 '${globalsHolder}.$parseReflectionDataName$_=$_'
1439 '$parseReflectionDataName$N'); 1445 '$parseReflectionDataName$N');
1440 } 1446 }
(...skipping 29 matching lines...) Expand all
1470 elementDescriptors.remove(library); 1476 elementDescriptors.remove(library);
1471 } 1477 }
1472 1478
1473 mainBuffer 1479 mainBuffer
1474 ..write( 1480 ..write(
1475 jsAst.prettyPrint( 1481 jsAst.prettyPrint(
1476 getReflectionDataParser(this, backend), 1482 getReflectionDataParser(this, backend),
1477 compiler)) 1483 compiler))
1478 ..write(n); 1484 ..write(n);
1479 1485
1480 mainBuffer..write('$parseReflectionDataName([$n') 1486 mainBuffer..write('var dart = [$n')
1481 ..write(libraryBuffer) 1487 ..write(libraryBuffer)
1482 ..write('])$N'); 1488 ..write(']$N')
1489 ..write('$parseReflectionDataName(dart)$N');
1483 } 1490 }
1484 1491
1485 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); 1492 interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
1486 interceptorEmitter.emitOneShotInterceptors(mainBuffer); 1493 interceptorEmitter.emitOneShotInterceptors(mainBuffer);
1487 1494
1488 if (task.outputContainsConstantList) { 1495 if (task.outputContainsConstantList) {
1489 emitMakeConstantList(mainBuffer); 1496 emitMakeConstantList(mainBuffer);
1490 } 1497 }
1491 1498
1492 // Constants in checked mode call into RTI code to set type information 1499 // 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') 1924 '$globalsHolder.$parseReflectionDataName$N')
1918 ..write('var ${namer.isolateName}$_=$_' 1925 ..write('var ${namer.isolateName}$_=$_'
1919 '${globalsHolder}.${namer.isolateName}$N'); 1926 '${globalsHolder}.${namer.isolateName}$N');
1920 if (libraryDescriptorBuffer != null) { 1927 if (libraryDescriptorBuffer != null) {
1921 // TODO(ahe): This defines a lot of properties on the 1928 // TODO(ahe): This defines a lot of properties on the
1922 // Isolate.prototype object. We know this will turn it into a 1929 // Isolate.prototype object. We know this will turn it into a
1923 // slow object in V8, so instead we should do something similar 1930 // slow object in V8, so instead we should do something similar
1924 // to Isolate.$finishIsolateConstructor. 1931 // to Isolate.$finishIsolateConstructor.
1925 outputBuffer 1932 outputBuffer
1926 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') 1933 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
1927 ..write('$parseReflectionDataName([$n') 1934 ..write('var dart = [$n ')
1928 ..addBuffer(libraryDescriptorBuffer) 1935 ..addBuffer(libraryDescriptorBuffer)
1929 ..write('])$N'); 1936 ..write(']$N')
1937 ..write('$parseReflectionDataName(dart)$N');
1930 1938
1931 } 1939 }
1932 1940
1933 // Set the currentIsolate variable to the current isolate (which is 1941 // Set the currentIsolate variable to the current isolate (which is
1934 // provided as second argument). 1942 // provided as second argument).
1935 // We need to do this, because we use the same variable for setting up 1943 // 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 1944 // the isolate-properties and for storing the current isolate. During
1937 // the setup (the code above this lines) we must set the variable to 1945 // the setup (the code above this lines) we must set the variable to
1938 // the isolate-properties. 1946 // the isolate-properties.
1939 // After we have done the setup it must point to the current Isolate. 1947 // 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) { 2036 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2029 if (element.isInstanceMember) { 2037 if (element.isInstanceMember) {
2030 cachedClassBuilders.remove(element.enclosingClass); 2038 cachedClassBuilders.remove(element.enclosingClass);
2031 2039
2032 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2040 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2033 2041
2034 } 2042 }
2035 } 2043 }
2036 } 2044 }
2037 } 2045 }
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