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

Side by Side Diff: lib/compiler/implementation/js_backend/constant_system_javascript.dart

Issue 11262032: Add 'part of' in dart2js code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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) 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;
6
5 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem();
6 8
7 class JavaScriptBitNotOperation extends BitNotOperation { 9 class JavaScriptBitNotOperation extends BitNotOperation {
8 const JavaScriptBitNotOperation(); 10 const JavaScriptBitNotOperation();
9 11
10 Constant fold(Constant constant) { 12 Constant fold(Constant constant) {
11 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) { 13 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) {
12 // In JavaScript we don't check for -0 and treat it as if it was zero. 14 // In JavaScript we don't check for -0 and treat it as if it was zero.
13 if (constant.isMinusZero()) constant = DART_CONSTANT_SYSTEM.createInt(0); 15 if (constant.isMinusZero()) constant = DART_CONSTANT_SYSTEM.createInt(0);
14 IntConstant intConstant = constant; 16 IntConstant intConstant = constant;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // At runtime, an integer is both an integer and a double: the 231 // At runtime, an integer is both an integer and a double: the
230 // integer type check is Math.floor, which will return true only 232 // integer type check is Math.floor, which will return true only
231 // for real integers, and our double type check is 'typeof number' 233 // for real integers, and our double type check is 'typeof number'
232 // which will return true for both integers and doubles. 234 // which will return true for both integers and doubles.
233 if (s.element == compiler.intClass && t.element == compiler.doubleClass) { 235 if (s.element == compiler.intClass && t.element == compiler.doubleClass) {
234 return true; 236 return true;
235 } 237 }
236 return compiler.types.isSubtype(s, t); 238 return compiler.types.isSubtype(s, t);
237 } 239 }
238 } 240 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/constant_emitter.dart ('k') | lib/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698