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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/interceptors.dart

Issue 813873008: dart2js: Store mapTypeToInterceptor in embedded global. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove "dynamic" type. Created 5 years, 11 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 _interceptors; 5 library _interceptors;
6 6
7 import 'dart:_js_embedded_names' show 7 import 'dart:_js_embedded_names' show
8 DISPATCH_PROPERTY_NAME; 8 DISPATCH_PROPERTY_NAME,
9 MAP_TYPE_TO_INTERCEPTOR;
9 10
10 import 'dart:collection'; 11 import 'dart:collection';
11 import 'dart:_internal' hide Symbol; 12 import 'dart:_internal' hide Symbol;
12 import "dart:_internal" as _symbol_dev show Symbol; 13 import "dart:_internal" as _symbol_dev show Symbol;
13 import 'dart:_js_helper' show allMatchesInStringUnchecked, 14 import 'dart:_js_helper' show allMatchesInStringUnchecked,
14 Null, 15 Null,
15 JSSyntaxRegExp, 16 JSSyntaxRegExp,
16 Primitives, 17 Primitives,
17 checkInt, 18 checkInt,
18 checkNull, 19 checkNull,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 * JavaScript object map for the constructors. 190 * JavaScript object map for the constructors.
190 * 191 *
191 * The value of this variable is set by the compiler and contains only types 192 * The value of this variable is set by the compiler and contains only types
192 * that are user extensions of native classes where the type occurs as a 193 * that are user extensions of native classes where the type occurs as a
193 * constant in the program. 194 * constant in the program.
194 * 195 *
195 * The compiler, in CustomElementsAnalysis, assumes that [mapTypeToInterceptor] 196 * The compiler, in CustomElementsAnalysis, assumes that [mapTypeToInterceptor]
196 * is accessed only by code that also calls [findIndexForWebComponentType]. If 197 * is accessed only by code that also calls [findIndexForWebComponentType]. If
197 * this assumption is invalidated, the compiler will have to be updated. 198 * this assumption is invalidated, the compiler will have to be updated.
198 */ 199 */
199 // TODO(sra): Mark this as initialized to a constant with unknown value. 200 get mapTypeToInterceptor {
200 var mapTypeToInterceptor; 201 return JS_EMBEDDED_GLOBAL('', MAP_TYPE_TO_INTERCEPTOR);
202 }
201 203
202 int findIndexForNativeSubclassType(Type type) { 204 int findIndexForNativeSubclassType(Type type) {
203 if (JS('bool', '# == null', mapTypeToInterceptor)) return null; 205 if (JS('bool', '# == null', mapTypeToInterceptor)) return null;
204 List map = JS('JSFixedArray', '#', mapTypeToInterceptor); 206 List map = JS('JSFixedArray', '#', mapTypeToInterceptor);
205 for (int i = 0; i + 1 < map.length; i += 3) { 207 for (int i = 0; i + 1 < map.length; i += 3) {
206 if (type == map[i]) { 208 if (type == map[i]) {
207 return i; 209 return i;
208 } 210 }
209 } 211 }
210 return null; 212 return null;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 * Interceptor for unclassified JavaScript objects, typically objects with a 405 * Interceptor for unclassified JavaScript objects, typically objects with a
404 * non-trivial prototype chain. 406 * non-trivial prototype chain.
405 * 407 *
406 * This class also serves as a fallback for unknown JavaScript exceptions. 408 * This class also serves as a fallback for unknown JavaScript exceptions.
407 */ 409 */
408 class UnknownJavaScriptObject extends JavaScriptObject { 410 class UnknownJavaScriptObject extends JavaScriptObject {
409 const UnknownJavaScriptObject(); 411 const UnknownJavaScriptObject();
410 412
411 String toString() => JS('String', 'String(#)', this); 413 String toString() => JS('String', 'String(#)', this);
412 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698