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

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

Issue 819993003: dart2js OldEmitter: inline FinishClasses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 class NsmEmitter extends CodeEmitterHelper { 7 class NsmEmitter extends CodeEmitterHelper {
8 final List<Selector> trivialNsmHandlers = <Selector>[]; 8 final List<Selector> trivialNsmHandlers = <Selector>[];
9 9
10 /// If this is true then we can generate the noSuchMethod handlers at startup 10 /// If this is true then we can generate the noSuchMethod handlers at startup
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // Object class to catch noSuchMethod invocations. 271 // Object class to catch noSuchMethod invocations.
272 ClassElement objectClass = compiler.objectClass; 272 ClassElement objectClass = compiler.objectClass;
273 jsAst.Expression createInvocationMirror = backend.emitter 273 jsAst.Expression createInvocationMirror = backend.emitter
274 .staticFunctionAccess(backend.getCreateInvocationMirror()); 274 .staticFunctionAccess(backend.getCreateInvocationMirror());
275 String noSuchMethodName = namer.publicInstanceMethodNameByArity( 275 String noSuchMethodName = namer.publicInstanceMethodNameByArity(
276 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT); 276 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
277 var type = 0; 277 var type = 0;
278 if (useDiffEncoding) { 278 if (useDiffEncoding) {
279 statements.add(js.statement('''{ 279 statements.add(js.statement('''{
280 var objectClassObject = 280 var objectClassObject =
281 collectedClasses[#], // # is name of class Object. 281 processedClasses.collected[#], // # is name of class Object .
floitsch 2014/12/29 18:00:22 long line. The indentation was to align it with th
zarah 2014/12/30 14:02:44 Done.
282 shortNames = #.split(","), // # is diffEncoding. 282 shortNames = #.split(","), // # is diffEncoding.
283 nameNumber = 0, 283 nameNumber = 0,
284 diffEncodedString = shortNames[0], 284 diffEncodedString = shortNames[0],
285 calculatedShortNames = [0, 1]; // 0, 1 are args for splice. 285 calculatedShortNames = [0, 1]; // 0, 1 are args for splice.
286 // If we are loading a deferred library the object class will not be i n 286 // If we are loading a deferred library the object class will not be i n
floitsch 2014/12/29 18:00:22 long line.
zarah 2014/12/30 14:02:43 Done.
287 // the collectedClasses so objectClassObject is undefined, and we skip 287 // the collectedClasses so objectClassObject is undefined, and we skip
288 // setting up the names. 288 // setting up the names.
289 289
290 if (objectClassObject) { 290 if (objectClassObject) {
291 if (objectClassObject instanceof Array) 291 if (objectClassObject instanceof Array)
292 objectClassObject = objectClassObject[1]; 292 objectClassObject = objectClassObject[1];
293 for (var i = 0; i < diffEncodedString.length; i++) { 293 for (var i = 0; i < diffEncodedString.length; i++) {
294 var codes = [], 294 var codes = [],
295 diff = 0, 295 diff = 0,
296 digit = diffEncodedString.charCodeAt(i); 296 digit = diffEncodedString.charCodeAt(i);
(...skipping 20 matching lines...) Expand all
317 shortNames.splice.apply(shortNames, calculatedShortNames); 317 shortNames.splice.apply(shortNames, calculatedShortNames);
318 } 318 }
319 }''', [ 319 }''', [
320 js.string(namer.getNameOfClass(objectClass)), 320 js.string(namer.getNameOfClass(objectClass)),
321 js.string('$diffEncoding')])); 321 js.string('$diffEncoding')]));
322 } else { 322 } else {
323 // No useDiffEncoding version. 323 // No useDiffEncoding version.
324 Iterable<String> longs = trivialNsmHandlers.map((selector) => 324 Iterable<String> longs = trivialNsmHandlers.map((selector) =>
325 selector.invocationMirrorMemberName); 325 selector.invocationMirrorMemberName);
326 statements.add(js.statement( 326 statements.add(js.statement(
327 'var objectClassObject = collectedClasses[#],' 327 'var objectClassObject = processedClasses.collected[#],'
328 ' shortNames = #.split(",")', [ 328 ' shortNames = #.split(",")', [
329 js.string(namer.getNameOfClass(objectClass)), 329 js.string(namer.getNameOfClass(objectClass)),
330 js.string('$diffEncoding')])); 330 js.string('$diffEncoding')]));
331 if (!minify) { 331 if (!minify) {
332 statements.add(js.statement('var longNames = #.split(",")', 332 statements.add(js.statement('var longNames = #.split(",")',
333 js.string(longs.join(',')))); 333 js.string(longs.join(','))));
334 } 334 }
335 statements.add(js.statement( 335 statements.add(js.statement(
336 'if (objectClassObject instanceof Array)' 336 'if (objectClassObject instanceof Array)'
337 ' objectClassObject = objectClassObject[1];')); 337 ' objectClassObject = objectClassObject[1];'));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 noSuchMethodName, 380 noSuchMethodName,
381 createInvocationMirror, 381 createInvocationMirror,
382 sliceOffsetParams, // argument to slice 382 sliceOffsetParams, // argument to slice
383 minify ? 'shortNames' : 'longNames', 383 minify ? 'shortNames' : 'longNames',
384 sliceOffsetArguments 384 sliceOffsetArguments
385 ])); 385 ]));
386 386
387 return statements; 387 return statements;
388 } 388 }
389 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698