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

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

Issue 816113005: Revert "dart2js OldEmitter: inline FinishClasses." (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
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Startup code that loops over the method names and puts handlers on the 279 // Startup code that loops over the method names and puts handlers on the
280 // Object class to catch noSuchMethod invocations. 280 // Object class to catch noSuchMethod invocations.
281 ClassElement objectClass = compiler.objectClass; 281 ClassElement objectClass = compiler.objectClass;
282 jsAst.Expression createInvocationMirror = backend.emitter 282 jsAst.Expression createInvocationMirror = backend.emitter
283 .staticFunctionAccess(backend.getCreateInvocationMirror()); 283 .staticFunctionAccess(backend.getCreateInvocationMirror());
284 String noSuchMethodName = namer.publicInstanceMethodNameByArity( 284 String noSuchMethodName = namer.publicInstanceMethodNameByArity(
285 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT); 285 Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
286 var type = 0; 286 var type = 0;
287 if (useDiffEncoding) { 287 if (useDiffEncoding) {
288 statements.add(js.statement('''{ 288 statements.add(js.statement('''{
289 var objectClassObject = processedClasses.collected[#objectClass], 289 var objectClassObject = collectedClasses[#objectClass],
290 shortNames = #diffEncoding.split(","), 290 shortNames = #diffEncoding.split(","),
291 nameNumber = 0, 291 nameNumber = 0,
292 diffEncodedString = shortNames[0], 292 diffEncodedString = shortNames[0],
293 calculatedShortNames = [0, 1]; // 0, 1 are args for splice. 293 calculatedShortNames = [0, 1]; // 0, 1 are args for splice.
294 // If we are loading a deferred library the object class will not be i n 294 // If we are loading a deferred library the object class will not be i n
295 // the collectedClasses so objectClassObject is undefined, and we skip 295 // the collectedClasses so objectClassObject is undefined, and we skip
296 // setting up the names. 296 // setting up the names.
297 297
298 if (objectClassObject) { 298 if (objectClassObject) {
299 if (objectClassObject instanceof Array) 299 if (objectClassObject instanceof Array)
(...skipping 24 matching lines...) Expand all
324 } 324 }
325 shortNames.splice.apply(shortNames, calculatedShortNames); 325 shortNames.splice.apply(shortNames, calculatedShortNames);
326 } 326 }
327 }''', {'objectClass': js.string(namer.getNameOfClass(objectClass)), 327 }''', {'objectClass': js.string(namer.getNameOfClass(objectClass)),
328 'diffEncoding': js.string('$diffEncoding')})); 328 'diffEncoding': js.string('$diffEncoding')}));
329 } else { 329 } else {
330 // No useDiffEncoding version. 330 // No useDiffEncoding version.
331 Iterable<String> longs = trivialNsmHandlers.map((selector) => 331 Iterable<String> longs = trivialNsmHandlers.map((selector) =>
332 selector.invocationMirrorMemberName); 332 selector.invocationMirrorMemberName);
333 statements.add(js.statement( 333 statements.add(js.statement(
334 'var objectClassObject = processedClasses.collected[#objectClass],' 334 'var objectClassObject = collectedClasses[#objectClass],'
335 ' shortNames = #diffEncoding.split(",")', 335 ' shortNames = #diffEncoding.split(",")',
336 {'objectClass': js.string(namer.getNameOfClass(objectClass)), 336 {'objectClass': js.string(namer.getNameOfClass(objectClass)),
337 'diffEncoding': js.string('$diffEncoding')})); 337 'diffEncoding': js.string('$diffEncoding')}));
338 if (!minify) { 338 if (!minify) {
339 statements.add(js.statement('var longNames = #longs.split(",")', 339 statements.add(js.statement('var longNames = #longs.split(",")',
340 {'longs': js.string(longs.join(','))})); 340 {'longs': js.string(longs.join(','))}));
341 } 341 }
342 statements.add(js.statement( 342 statements.add(js.statement(
343 'if (objectClassObject instanceof Array)' 343 'if (objectClassObject instanceof Array)'
344 ' objectClassObject = objectClassObject[1];')); 344 ' objectClassObject = objectClassObject[1];'));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 }''', { 387 }''', {
388 'sliceOffsetParams': sliceOffsetParams, 388 'sliceOffsetParams': sliceOffsetParams,
389 'noSuchMethodName': noSuchMethodName, 389 'noSuchMethodName': noSuchMethodName,
390 'createInvocationMirror': createInvocationMirror, 390 'createInvocationMirror': createInvocationMirror,
391 'names': minify ? 'shortNames' : 'longNames', 391 'names': minify ? 'shortNames' : 'longNames',
392 'sliceOffsetArguments': sliceOffsetArguments})); 392 'sliceOffsetArguments': sliceOffsetArguments}));
393 393
394 return statements; 394 return statements;
395 } 395 }
396 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698