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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_system_javascript.dart

Issue 1091443003: Move constant systems into their own libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix try/poi/forget_element_test Created 5 years, 8 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) 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 part of js_backend; 5 library dart2js.constant_system.js;
6
7 import '../constants/constant_system.dart';
8 import '../constants/values.dart';
9 import '../constant_system_dart.dart';
10 import '../dart_types.dart';
11 import '../dart2jslib.dart' show Compiler;
12 import '../elements/elements.dart' show ClassElement;
13 import '../tree/tree.dart' show DartString, LiteralDartString;
14 import 'js_backend.dart';
6 15
7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); 16 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem();
8 17
9 class JavaScriptBitNotOperation extends BitNotOperation { 18 class JavaScriptBitNotOperation extends BitNotOperation {
10 const JavaScriptBitNotOperation(); 19 const JavaScriptBitNotOperation();
11 20
12 ConstantValue fold(ConstantValue constant) { 21 ConstantValue fold(ConstantValue constant) {
13 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) { 22 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) {
14 // In JavaScript we don't check for -0 and treat it as if it was zero. 23 // In JavaScript we don't check for -0 and treat it as if it was zero.
15 if (constant.isMinusZero) constant = DART_CONSTANT_SYSTEM.createInt(0); 24 if (constant.isMinusZero) constant = DART_CONSTANT_SYSTEM.createInt(0);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 345
337 JavaScriptMapConstant(InterfaceType type, 346 JavaScriptMapConstant(InterfaceType type,
338 ListConstantValue keyList, 347 ListConstantValue keyList,
339 List<ConstantValue> values, 348 List<ConstantValue> values,
340 this.protoValue, 349 this.protoValue,
341 this.onlyStringKeys) 350 this.onlyStringKeys)
342 : this.keyList = keyList, 351 : this.keyList = keyList,
343 super(type, keyList.entries, values); 352 super(type, keyList.entries, values);
344 bool get isMap => true; 353 bool get isMap => true;
345 354
346 TypeMask computeMask(Compiler compiler) {
347 return compiler.typesTask.constMapType;
348 }
349
350 List<ConstantValue> getDependencies() { 355 List<ConstantValue> getDependencies() {
351 List<ConstantValue> result = <ConstantValue>[]; 356 List<ConstantValue> result = <ConstantValue>[];
352 if (onlyStringKeys) { 357 if (onlyStringKeys) {
353 result.add(keyList); 358 result.add(keyList);
354 } else { 359 } else {
355 // Add the keys individually to avoid generating an unused list constant 360 // Add the keys individually to avoid generating an unused list constant
356 // for the keys. 361 // for the keys.
357 result.addAll(keys); 362 result.addAll(keys);
358 } 363 }
359 result.addAll(values); 364 result.addAll(values);
360 return result; 365 return result;
361 } 366 }
362 } 367 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698