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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 16135004: Rename JS_CURRENT_ISOLATE to JS_CURRENT_ISOLATE_CONTEXT. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 library _js_helper; 5 library _js_helper;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS, 8 import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS,
9 JS, 9 JS,
10 JS_CALL_IN_ISOLATE, 10 JS_CALL_IN_ISOLATE,
11 JS_CURRENT_ISOLATE, 11 JS_CURRENT_ISOLATE,
12 JS_CURRENT_ISOLATE_CONTEXT,
12 JS_DART_OBJECT_CONSTRUCTOR, 13 JS_DART_OBJECT_CONSTRUCTOR,
14 JS_OPERATOR_AS_PREFIX,
13 JS_OPERATOR_IS_PREFIX, 15 JS_OPERATOR_IS_PREFIX,
14 JS_OPERATOR_AS_PREFIX,
15 RAW_DART_FUNCTION_REF; 16 RAW_DART_FUNCTION_REF;
16 import 'dart:_interceptors'; 17 import 'dart:_interceptors';
17 import "dart:_collection-dev" as _symbol_dev; 18 import "dart:_collection-dev" as _symbol_dev;
18 19
19 part 'constant_map.dart'; 20 part 'constant_map.dart';
20 part 'native_helper.dart'; 21 part 'native_helper.dart';
21 part 'regexp_helper.dart'; 22 part 'regexp_helper.dart';
22 part 'string_helper.dart'; 23 part 'string_helper.dart';
23 part 'js_rti.dart'; 24 part 'js_rti.dart';
24 25
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 582
582 static getConstructor(String className) { 583 static getConstructor(String className) {
583 // TODO(ahe): Generalize this and improve test coverage of 584 // TODO(ahe): Generalize this and improve test coverage of
584 // reflecting on intercepted classes. 585 // reflecting on intercepted classes.
585 if (JS('bool', '# == "String"', className)) return const JSString(); 586 if (JS('bool', '# == "String"', className)) return const JSString();
586 if (JS('bool', '# == "int"', int)) return const JSInt(); 587 if (JS('bool', '# == "int"', int)) return const JSInt();
587 if (JS('bool', '# == "double"', int)) return const JSDouble(); 588 if (JS('bool', '# == "double"', int)) return const JSDouble();
588 if (JS('bool', '# == "num"', int)) return const JSNumber(); 589 if (JS('bool', '# == "num"', int)) return const JSNumber();
589 if (JS('bool', '# == "bool"', int)) return const JSBool(); 590 if (JS('bool', '# == "bool"', int)) return const JSBool();
590 if (JS('bool', '# == "List"', int)) return const JSArray(); 591 if (JS('bool', '# == "List"', int)) return const JSArray();
591 // TODO(ahe): How to safely access $? 592 return JS('var', '#[#]', JS_CURRENT_ISOLATE(), className);
592 return JS('var', r'$[#]', className);
593 } 593 }
594 594
595 static bool identicalImplementation(a, b) { 595 static bool identicalImplementation(a, b) {
596 return JS('bool', '# == null', a) 596 return JS('bool', '# == null', a)
597 ? JS('bool', '# == null', b) 597 ? JS('bool', '# == null', b)
598 : JS('bool', '# === #', a, b); 598 : JS('bool', '# === #', a, b);
599 } 599 }
600 } 600 }
601 601
602 /** 602 /**
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 // compiler and/or minifier. 937 // compiler and/or minifier.
938 function = JS('var', 938 function = JS('var',
939 r'(function ($2, $3) {' 939 r'(function ($2, $3) {'
940 r' return function($0, $1) { ' 940 r' return function($0, $1) { '
941 r'return $3(#, $2, #, $0, $1) }})(#, #)', 941 r'return $3(#, $2, #, $0, $1) }})(#, #)',
942 closure, 942 closure,
943 arity, 943 arity,
944 // Capture the current isolate now. Remember that "#" 944 // Capture the current isolate now. Remember that "#"
945 // in JS is simply textual substitution of compiled 945 // in JS is simply textual substitution of compiled
946 // expressions. 946 // expressions.
947 JS_CURRENT_ISOLATE(), 947 JS_CURRENT_ISOLATE_CONTEXT(),
948 DART_CLOSURE_TO_JS(invokeClosure)); 948 DART_CLOSURE_TO_JS(invokeClosure));
949 949
950 JS('void', r'#.$identity = #', closure, function); 950 JS('void', r'#.$identity = #', closure, function);
951 return function; 951 return function;
952 } 952 }
953 953
954 /** 954 /**
955 * Super class for Dart closures. 955 * Super class for Dart closures.
956 */ 956 */
957 class Closure implements Function { 957 class Closure implements Function {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 expectedArgumentNames); 1416 expectedArgumentNames);
1417 } 1417 }
1418 1418
1419 /** 1419 /**
1420 * Called by generated code when a static field's initializer references the 1420 * Called by generated code when a static field's initializer references the
1421 * field that is currently being initialized. 1421 * field that is currently being initialized.
1422 */ 1422 */
1423 void throwCyclicInit(String staticName) { 1423 void throwCyclicInit(String staticName) {
1424 throw new RuntimeError("Cyclic initialization for static $staticName"); 1424 throw new RuntimeError("Cyclic initialization for static $staticName");
1425 } 1425 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698