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

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

Issue 1212513002: sdk files reorganization to make dart2js a proper package (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 /// Contains the names of globals that are embedded into the output by the
6 /// compiler.
7 ///
8 /// Variables embedded this way should be access with `JS_EMBEDDED_GLOBAL` from
9 /// the `_foreign_helper` library.
10 ///
11 /// This library is shared between the compiler and the runtime system.
12 library dart2js._embedded_names;
13
14 const DISPATCH_PROPERTY_NAME = "dispatchPropertyName";
15 const TYPE_INFORMATION = 'typeInformation';
16 const GLOBAL_FUNCTIONS = 'globalFunctions';
17 const STATICS = 'statics';
18
19 /// If [JSInvocationMirror._invokeOn] is being used, this embedded global
20 /// contains a JavaScript map with the names of methods that are
21 /// intercepted.
22 const INTERCEPTED_NAMES = 'interceptedNames';
23
24 /// A JS map from mangled global names to their unmangled names.
25 ///
26 /// If the program does not use reflection may be empty (but not null or
27 /// undefined).
28 const MANGLED_GLOBAL_NAMES = 'mangledGlobalNames';
29
30 const MANGLED_NAMES = 'mangledNames';
31 const LIBRARIES = 'libraries';
32 const FINISHED_CLASSES = 'finishedClasses';
33 const ALL_CLASSES = 'allClasses';
34 const INTERCEPTORS_BY_TAG = 'interceptorsByTag';
35 const LEAF_TAGS = 'leafTags';
36 const LAZIES = 'lazies';
37 const GET_ISOLATE_TAG = 'getIsolateTag';
38 const ISOLATE_TAG = 'isolateTag';
39 const CURRENT_SCRIPT = 'currentScript';
40 const DEFERRED_LIBRARY_URIS = 'deferredLibraryUris';
41 const DEFERRED_LIBRARY_HASHES = 'deferredLibraryHashes';
42 const INITIALIZE_LOADED_HUNK = 'initializeLoadedHunk';
43 const IS_HUNK_LOADED = 'isHunkLoaded';
44 const IS_HUNK_INITIALIZED = 'isHunkInitialized';
45 const DEFERRED_INITIALIZED = 'deferredInitialized';
46 const PRECOMPILED = 'precompiled';
47
48 /// The name of the embedded global for metadata.
49 ///
50 /// Use [JsBuiltin.getMetadata] instead of directly accessing this embedded
51 /// global.
52 const METADATA = 'metadata';
53
54 /// A list of types used in the program e.g. for reflection or encoding of
55 /// function types.
56 ///
57 /// Use [JsBuiltin.getType] instead of directly accessing this embedded global.
58 const TYPES = 'types';
59
60 /// Returns a function that creates a new Isolate (its static state).
61 ///
62 /// (floitsch): Note that this will probably go away, since one JS heap will
63 /// only contain one Dart isolate.
64 const CREATE_NEW_ISOLATE = 'createNewIsolate';
65
66 const CLASS_ID_EXTRACTOR = 'classIdExtractor';
67 const CLASS_FIELDS_EXTRACTOR = 'classFieldsExtractor';
68 const INSTANCE_FROM_CLASS_ID = "instanceFromClassId";
69 const INITIALIZE_EMPTY_INSTANCE = "initializeEmptyInstance";
70 const TYPEDEF_TYPE_PROPERTY_NAME = r"$typedefType";
71 const TYPEDEF_PREDICATE_PROPERTY_NAME = r"$$isTypedef";
72 const NATIVE_SUPERCLASS_TAG_NAME = r"$nativeSuperclassTag";
73
74 /// Returns the type given the name of a class.
75 /// This function is called by the runtime when computing rti.
76 const GET_TYPE_FROM_NAME = 'getTypeFromName';
77 const TYPE_TO_INTERCEPTOR_MAP = "typeToInterceptorMap";
78
79 /// Names that are supported by [JS_GET_NAME].
80 // TODO(herhut): Make entries lower case (as in fields) and find a better name.
81 enum JsGetName {
82 GETTER_PREFIX,
83 SETTER_PREFIX,
84 CALL_PREFIX,
85 CALL_PREFIX0,
86 CALL_PREFIX1,
87 CALL_PREFIX2,
88 CALL_PREFIX3,
89 CALL_CATCH_ALL,
90 REFLECTABLE,
91 CLASS_DESCRIPTOR_PROPERTY,
92 REQUIRED_PARAMETER_PROPERTY,
93 DEFAULT_VALUES_PROPERTY,
94 CALL_NAME_PROPERTY,
95 DEFERRED_ACTION_PROPERTY,
96 /// Prefix used for generated type argument substitutions on classes.
97 OPERATOR_AS_PREFIX,
98 /// Name used for generated function types on classes and methods.
99 SIGNATURE_NAME,
100 /// Name used to tag typedefs.
101 TYPEDEF_TAG,
102 /// Name used to tag void return in function type representations in
103 /// JavaScript.
104 FUNCTION_TYPE_VOID_RETURN_TAG,
105 /// Name used to tag return types in function type representations in
106 /// JavaScript.
107 FUNCTION_TYPE_RETURN_TYPE_TAG,
108 /// Name used to tag required parameters in function type representations
109 /// in JavaScript.
110 FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG,
111 /// Name used to tag optional parameters in function type representations
112 /// in JavaScript.
113 FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG,
114 /// Name used to tag named parameters in function type representations in
115 /// JavaScript.
116 FUNCTION_TYPE_NAMED_PARAMETERS_TAG,
117 /// Field name used for determining if an object or its interceptor has
118 /// JavaScript indexing behavior.
119 IS_INDEXABLE_FIELD_NAME,
120 }
121
122 enum JsBuiltin {
123 /// Returns the JavaScript constructor function for Dart's Object class.
124 /// This can be used for type tests, as in
125 ///
126 /// var constructor = JS_BUILTIN('', JsBuiltin.dartObjectContructor);
127 /// if (JS('bool', '# instanceof #', obj, constructor))
128 /// ...
129 dartObjectConstructor,
130
131 /// Returns the JavaScript-constructor name given an [isCheckProperty].
132 ///
133 /// This relies on a deterministic encoding of is-check properties (for
134 /// example `$isFoo` for a class `Foo`). In minified code the returned
135 /// classname is the minified name of the class.
136 ///
137 /// JS_BUILTIN('returns:String;depends:none;effects:none',
138 /// JsBuiltin.isCheckPropertyToJsConstructorName,
139 /// isCheckProperty);
140 isCheckPropertyToJsConstructorName,
141
142 /// Returns true if the given type is a function type. Returns false for
143 /// the one `Function` type singleton. (See [isFunctionTypeSingleton]).
144 ///
145 /// JS_BUILTIN('bool', JsBuiltin.isFunctionType, o)
146 isFunctionType,
147
148 /// Returns a new function type object.
149 ///
150 /// JS_BUILTIN('=Object', JsBuiltin.createFunctionType)
151 createFunctionTypeRti,
152
153 /// Returns the JavaScript-constructor name given an rti encoding.
154 ///
155 /// JS_BUILTIN('String', JsBuiltin.rawRtiToJsConstructorName, rti)
156 rawRtiToJsConstructorName,
157
158 /// Returns the raw runtime type of the given object. The given argument
159 /// [o] should be the interceptor (for non-Dart objects).
160 ///
161 /// JS_BUILTIN('', JsBuiltin.rawRuntimeType, o)
162 rawRuntimeType,
163
164 /// Returns whether the given type is a subtype of other.
165 ///
166 /// The argument `other` is the name of the potential supertype. It is
167 /// computed by `runtimeTypeToString`;
168 ///
169 /// *The `other` name must be passed in before the `type`.*
170 ///
171 /// JS_BUILTIN('returns:bool;effects:none;depends:none',
172 /// JsBuiltin.isSubtype, other, type);
173 isSubtype,
174
175 /// Returns true if the given type is _the_ `Function` type.
176 /// That is, it returns true if the given [type] is exactly the `Function`
177 /// type rti-encoding.
178 ///
179 /// JS_BUILTIN('returns:bool;effects:none;depends:none',
180 /// JsBuiltin.isFunctionTypeLiteral, type);
181 isFunctionTypeRti,
182
183 /// Returns whether the given type is _the_ null-type..
184 ///
185 /// JS_BUILTIN('returns:bool;effects:none;depends:none',
186 /// JsBuiltin.isNullType, type);
187 isNullTypeRti,
188
189 /// Returns whether the given type is _the_ Dart Object type.
190 ///
191 /// JS_BUILTIN('returns:bool;effects:none;depends:none',
192 /// JsBuiltin.isDartObjectType, type);
193 isDartObjectTypeRti,
194
195 /// Returns the metadata of the given [index].
196 ///
197 /// JS_BUILTIN('returns:var;effects:none;depends:none',
198 /// JsBuiltin.getMetadata, index);
199 getMetadata,
200
201 /// Returns the type of the given [index].
202 ///
203 /// JS_BUILTIN('returns:var;effects:none;depends:none',
204 /// JsBuiltin.getType, index);
205 getType,
206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698