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

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: 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 | « 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 mainBuffer..write('var dart = [$n')
floitsch 2015/01/07 13:07:39 Add a comment why you assign to a temporary first.
zarah 2015/01/07 13:45:17 Done.
1481 ..write(libraryBuffer) 1492 ..write(libraryBuffer)
1482 ..write('])$N'); 1493 ..write(']$N')
1494 ..write('$parseReflectionDataName(dart)$N');
1483 } 1495 }
1484 1496
1485 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); 1497 interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
1486 interceptorEmitter.emitOneShotInterceptors(mainBuffer); 1498 interceptorEmitter.emitOneShotInterceptors(mainBuffer);
1487 1499
1488 if (task.outputContainsConstantList) { 1500 if (task.outputContainsConstantList) {
1489 emitMakeConstantList(mainBuffer); 1501 emitMakeConstantList(mainBuffer);
1490 } 1502 }
1491 1503
1492 // Constants in checked mode call into RTI code to set type information 1504 // 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') 1929 '$globalsHolder.$parseReflectionDataName$N')
1918 ..write('var ${namer.isolateName}$_=$_' 1930 ..write('var ${namer.isolateName}$_=$_'
1919 '${globalsHolder}.${namer.isolateName}$N'); 1931 '${globalsHolder}.${namer.isolateName}$N');
1920 if (libraryDescriptorBuffer != null) { 1932 if (libraryDescriptorBuffer != null) {
1921 // TODO(ahe): This defines a lot of properties on the 1933 // TODO(ahe): This defines a lot of properties on the
1922 // Isolate.prototype object. We know this will turn it into a 1934 // Isolate.prototype object. We know this will turn it into a
1923 // slow object in V8, so instead we should do something similar 1935 // slow object in V8, so instead we should do something similar
1924 // to Isolate.$finishIsolateConstructor. 1936 // to Isolate.$finishIsolateConstructor.
1925 outputBuffer 1937 outputBuffer
1926 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') 1938 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
1927 ..write('$parseReflectionDataName([$n') 1939 ..write('var dart = [$n ')
floitsch 2015/01/07 13:07:39 ditto.
zarah 2015/01/07 13:45:17 Done.
1928 ..addBuffer(libraryDescriptorBuffer) 1940 ..addBuffer(libraryDescriptorBuffer)
1929 ..write('])$N'); 1941 ..write(']$N')
1942 ..write('$parseReflectionDataName(dart)$N');
1930 1943
1931 } 1944 }
1932 1945
1933 // Set the currentIsolate variable to the current isolate (which is 1946 // Set the currentIsolate variable to the current isolate (which is
1934 // provided as second argument). 1947 // provided as second argument).
1935 // We need to do this, because we use the same variable for setting up 1948 // 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 1949 // the isolate-properties and for storing the current isolate. During
1937 // the setup (the code above this lines) we must set the variable to 1950 // the setup (the code above this lines) we must set the variable to
1938 // the isolate-properties. 1951 // the isolate-properties.
1939 // After we have done the setup it must point to the current Isolate. 1952 // 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) { 2041 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2029 if (element.isInstanceMember) { 2042 if (element.isInstanceMember) {
2030 cachedClassBuilders.remove(element.enclosingClass); 2043 cachedClassBuilders.remove(element.enclosingClass);
2031 2044
2032 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2045 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2033 2046
2034 } 2047 }
2035 } 2048 }
2036 } 2049 }
2037 } 2050 }
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