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

Side by Side Diff: lib/compiler/implementation/compile_time_constants.dart

Issue 10915306: Put functions used in compile-time constants in the worklist of codegen. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | tests/co19/co19-dart2js.status » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * The [ConstantHandler] keeps track of compile-time constants, 6 * The [ConstantHandler] keeps track of compile-time constants,
7 * initializations of global and static fields, and default values of 7 * initializations of global and static fields, and default values of
8 * optional parameters. 8 * optional parameters.
9 */ 9 */
10 class ConstantHandler extends CompilerTask { 10 class ConstantHandler extends CompilerTask {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 result = compiler.compileVariable(element); 398 result = compiler.compileVariable(element);
399 } 399 }
400 } 400 }
401 if (result == null) return signalNotCompileTimeConstant(send); 401 if (result == null) return signalNotCompileTimeConstant(send);
402 return result; 402 return result;
403 } else if (Elements.isStaticOrTopLevelFunction(element) 403 } else if (Elements.isStaticOrTopLevelFunction(element)
404 && send.isPropertyAccess) { 404 && send.isPropertyAccess) {
405 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element); 405 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element);
406 Constant constant = new FunctionConstant(element); 406 Constant constant = new FunctionConstant(element);
407 compiler.constantHandler.registerCompileTimeConstant(constant); 407 compiler.constantHandler.registerCompileTimeConstant(constant);
408 compiler.enqueuer.codegen.registerStaticUse(element);
408 return constant; 409 return constant;
409 } else if (send.isPrefix) { 410 } else if (send.isPrefix) {
410 assert(send.isOperator); 411 assert(send.isOperator);
411 Constant receiverConstant = evaluate(send.receiver); 412 Constant receiverConstant = evaluate(send.receiver);
412 if (receiverConstant == null) return null; 413 if (receiverConstant == null) return null;
413 Operator op = send.selector; 414 Operator op = send.selector;
414 Constant folded; 415 Constant folded;
415 switch (op.source.stringValue) { 416 switch (op.source.stringValue) {
416 case "!": 417 case "!":
417 folded = constantSystem.not.fold(receiverConstant); 418 folded = constantSystem.not.fold(receiverConstant);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 Constant fieldValue = fieldValues[field]; 778 Constant fieldValue = fieldValues[field];
778 if (fieldValue === null) { 779 if (fieldValue === null) {
779 // Use the default value. 780 // Use the default value.
780 fieldValue = compiler.compileConstant(field); 781 fieldValue = compiler.compileConstant(field);
781 } 782 }
782 jsNewArguments.add(fieldValue); 783 jsNewArguments.add(fieldValue);
783 }); 784 });
784 return jsNewArguments; 785 return jsNewArguments;
785 } 786 }
786 } 787 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698