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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart

Issue 743383002: Redo "Revert "Encode super calls via extra properties on prototypes."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 // TODO(ahe): Share these with js_helper.dart. 7 // TODO(ahe): Share these with js_helper.dart.
8 const FUNCTION_INDEX = 0; 8 const FUNCTION_INDEX = 0;
9 const NAME_INDEX = 1; 9 const NAME_INDEX = 1;
10 const CALL_NAME_INDEX = 2; 10 const CALL_NAME_INDEX = 2;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 } 135 }
136 ''', [typeInformationAccess, globalFunctionsAccess, staticsAccess]); 136 ''', [typeInformationAccess, globalFunctionsAccess, staticsAccess]);
137 137
138 138
139 /** 139 /**
140 * See [dart2js.js_emitter.ContainerBuilder.addMemberMethod] for format of 140 * See [dart2js.js_emitter.ContainerBuilder.addMemberMethod] for format of
141 * [array]. 141 * [array].
142 */ 142 */
143 jsAst.Statement addStubs = js.statement(''' 143 jsAst.Statement addStubs = js.statement('''
144 function addStubs(descriptor, array, nameTag, isStatic, 144 function addStubs(descriptor, array, name, isStatic,
145 originalDescriptor, functions) { 145 originalDescriptor, functions) {
146 // The name could be an aliased method, which is only resolved later in
147 // finishClasses. We need to use the actual name for the generated stubs.
148 // Note that no getter for the alias is needed, as getter sends via super
149 // are handled via the prototype chain and not using the alias.
150 var name = nameTag.split(':')[0];
151 var f, funcs = 146 var f, funcs =
152 [originalDescriptor[nameTag] = 147 [originalDescriptor[name] =
153 descriptor[nameTag] = f = ${readFunction("array", "$FUNCTION_INDEX")}]; 148 descriptor[name] = f = ${readFunction("array", "$FUNCTION_INDEX")}];
154 f.\$stubName = name; 149 f.\$stubName = name;
155 functions.push(name); 150 functions.push(name);
156 for (var index = $FUNCTION_INDEX; index < array.length; index += 2) { 151 for (var index = $FUNCTION_INDEX; index < array.length; index += 2) {
157 f = array[index + 1]; 152 f = array[index + 1];
158 if (typeof f != "function") break; 153 if (typeof f != "function") break;
159 f.\$stubName = ${readString("array", "index + 2")}; 154 f.\$stubName = ${readString("array", "index + 2")};
160 funcs.push(f); 155 funcs.push(f);
161 if (f.\$stubName) { 156 if (f.\$stubName) {
162 originalDescriptor[f.\$stubName] = descriptor[f.\$stubName] = f; 157 originalDescriptor[f.\$stubName] = descriptor[f.\$stubName] = f;
163 functions.push(f.\$stubName); 158 functions.push(f.\$stubName);
(...skipping 13 matching lines...) Expand all
177 var optionalParameterCount = optionalParameterInfo >> 1; 172 var optionalParameterCount = optionalParameterInfo >> 1;
178 var optionalParametersAreNamed = (optionalParameterInfo & 1) === 1; 173 var optionalParametersAreNamed = (optionalParameterInfo & 1) === 1;
179 var isIntercepted = 174 var isIntercepted =
180 requiredParameterCount + optionalParameterCount != funcs[0].length; 175 requiredParameterCount + optionalParameterCount != funcs[0].length;
181 var functionTypeIndex = ${readFunctionType("array", "2")}; 176 var functionTypeIndex = ${readFunctionType("array", "2")};
182 var unmangledNameIndex = $unmangledNameIndex; 177 var unmangledNameIndex = $unmangledNameIndex;
183 var isReflectable = array.length > unmangledNameIndex; 178 var isReflectable = array.length > unmangledNameIndex;
184 179
185 if (getterStubName) { 180 if (getterStubName) {
186 f = tearOff(funcs, array, isStatic, name, isIntercepted); 181 f = tearOff(funcs, array, isStatic, name, isIntercepted);
187 descriptor[nameTag].\$getter = f; 182 descriptor[name].\$getter = f;
188 f.\$getterStub = true; 183 f.\$getterStub = true;
189 // Used to create an isolate using spawnFunction. 184 // Used to create an isolate using spawnFunction.
190 if (isStatic) #[name] = f; // embedded globalFunctions. 185 if (isStatic) #[name] = f; // embedded globalFunctions.
191 originalDescriptor[getterStubName] = descriptor[getterStubName] = f; 186 originalDescriptor[getterStubName] = descriptor[getterStubName] = f;
192 funcs.push(f); 187 funcs.push(f);
193 if (getterStubName) functions.push(getterStubName); 188 if (getterStubName) functions.push(getterStubName);
194 f.\$stubName = getterStubName; 189 f.\$stubName = getterStubName;
195 f.\$callName = null; 190 f.\$callName = null;
196 if (isIntercepted) #[getterStubName] = true; // embedded interceptedNames. 191 if (isIntercepted) #[getterStubName] = true; // embedded interceptedNames.
197 } 192 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 (function() { 400 (function() {
406 var result = $array[$index]; 401 var result = $array[$index];
407 if ($check) { 402 if ($check) {
408 throw new Error( 403 throw new Error(
409 name + ": expected value of type \'$type\' at index " + ($index) + 404 name + ": expected value of type \'$type\' at index " + ($index) +
410 " but got " + (typeof result)); 405 " but got " + (typeof result));
411 } 406 }
412 return result; 407 return result;
413 })()'''; 408 })()''';
414 } 409 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698