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

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

Issue 719443002: Incremental compilation: set up inheritance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Stephan's suggestions. Created 6 years, 1 month 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) 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // defineClassFunction (it's a local declaration in init()). 297 // defineClassFunction (it's a local declaration in init()).
298 return [ 298 return [
299 generateAccessorFunction, 299 generateAccessorFunction,
300 js('$generateAccessorHolder = generateAccessor'), 300 js('$generateAccessorHolder = generateAccessor'),
301 new jsAst.FunctionDeclaration( 301 new jsAst.FunctionDeclaration(
302 new jsAst.VariableDeclaration('defineClass'), defineClass) ]; 302 new jsAst.VariableDeclaration('defineClass'), defineClass) ];
303 } 303 }
304 304
305 /** Needs defineClass to be defined. */ 305 /** Needs defineClass to be defined. */
306 jsAst.Expression buildInheritFrom() { 306 jsAst.Expression buildInheritFrom() {
307 return js(r''' 307 jsAst.Expression result = js(r'''
308 var inheritFrom = function() { 308 function() {
309 function tmp() {} 309 function tmp() {}
310 var hasOwnProperty = Object.prototype.hasOwnProperty; 310 var hasOwnProperty = Object.prototype.hasOwnProperty;
311 return function (constructor, superConstructor) { 311 return function (constructor, superConstructor) {
312 tmp.prototype = superConstructor.prototype; 312 tmp.prototype = superConstructor.prototype;
313 var object = new tmp(); 313 var object = new tmp();
314 var properties = constructor.prototype; 314 var properties = constructor.prototype;
315 for (var member in properties) { 315 for (var member in properties) {
316 if (hasOwnProperty.call(properties, member)) { 316 if (hasOwnProperty.call(properties, member)) {
317 object[member] = properties[member]; 317 object[member] = properties[member];
318 } 318 }
319 } 319 }
320 object.constructor = constructor; 320 object.constructor = constructor;
321 constructor.prototype = object; 321 constructor.prototype = object;
322 return object; 322 return object;
323 }; 323 };
324 }() 324 }()
325 '''); 325 ''');
326 if (compiler.hasIncrementalSupport) {
327 result = js(r'self.$dart_unsafe_eval.inheritFrom = #', [result]);
328 }
329 return js(r'var inheritFrom = #', [result]);
326 } 330 }
327 331
328 /// Code that needs to be run before first invocation of 332 /// Code that needs to be run before first invocation of
329 /// [finishClassesFunction], but should only be run once. 333 /// [finishClassesFunction], but should only be run once.
330 jsAst.Expression get initFinishClasses { 334 jsAst.Expression get initFinishClasses {
331 jsAst.Expression allClassesAccess = 335 jsAst.Expression allClassesAccess =
332 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES); 336 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES);
333 jsAst.Expression interceptorsByTagAccess = 337 jsAst.Expression interceptorsByTagAccess =
334 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG); 338 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG);
335 jsAst.Expression leafTagsAccess = 339 jsAst.Expression leafTagsAccess =
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2037 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2034 if (element.isInstanceMember) { 2038 if (element.isInstanceMember) {
2035 cachedClassBuilders.remove(element.enclosingClass); 2039 cachedClassBuilders.remove(element.enclosingClass);
2036 2040
2037 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2041 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2038 2042
2039 } 2043 }
2040 } 2044 }
2041 } 2045 }
2042 } 2046 }
OLDNEW
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/universe/universe.dart » ('j') | dart/pkg/compiler/lib/src/world.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698