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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index 95ea5d973d6a6062230a42196ffc443c6c052dfd..e3a0fcba1e8fca76d9054e34e8adc2408fde717d 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -1413,10 +1413,21 @@ class OldEmitter implements Emitter {
/// initializer of deferred files.
mainBuffer.write('var ${globalsHolder}$_=${_}Object.create(null)$N');
}
- mainBuffer.write('function dart()$_{$n'
- '${_}${_}this.x$_=${_}0$N'
- '${_}${_}delete this.x$N'
- '}$n');
+
+ jsAst.Statement mapFunction = js.statement('''
+// [map] returns an object that V8 shouldn't try to optimize with a hidden
+// class. This prevents a potential performance problem where V8 tries to build
+// a hidden class for an object used as a hashMap.
+// It requires fewer characters to declare a variable as a parameter than
+// with `var`.
+ function map(x) {
+ x = Object.create(null);
+ x.x = 0;
+ delete x.x;
+ return x;
+ }
+''');
+ mainBuffer.write(jsAst.prettyPrint(mapFunction, compiler));
for (String globalObject in Namer.reservedGlobalObjectNames) {
// The global objects start as so-called "slow objects". For V8, this
// means that it won't try to make map transitions as we add properties
@@ -1427,7 +1438,7 @@ class OldEmitter implements Emitter {
if(isProgramSplit) {
mainBuffer.write('${globalsHolder}.$globalObject$_=${_}');
}
- mainBuffer.write('new dart$N');
+ mainBuffer.write('map()$N');
}
mainBuffer.write('function ${namer.isolateName}()$_{}\n');
@@ -1477,9 +1488,10 @@ class OldEmitter implements Emitter {
compiler))
..write(n);
- mainBuffer..write('$parseReflectionDataName([$n')
+ 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.
..write(libraryBuffer)
- ..write('])$N');
+ ..write(']$N')
+ ..write('$parseReflectionDataName(dart)$N');
}
interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
@@ -1924,9 +1936,10 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
// to Isolate.$finishIsolateConstructor.
outputBuffer
..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
- ..write('$parseReflectionDataName([$n')
+ ..write('var dart = [$n ')
floitsch 2015/01/07 13:07:39 ditto.
zarah 2015/01/07 13:45:17 Done.
..addBuffer(libraryDescriptorBuffer)
- ..write('])$N');
+ ..write(']$N')
+ ..write('$parseReflectionDataName(dart)$N');
}
« 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