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

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

Issue 890583003: dart2js: move recording of interceptorInvocationNames from addParameterStub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// This class should morph into something that makes it easy to build 7 /// This class should morph into something that makes it easy to build
8 /// JavaScript representations of libraries, class-sides, and instance-sides. 8 /// JavaScript representations of libraries, class-sides, and instance-sides.
9 /// Initially, it is just a placeholder for code that is moved from 9 /// Initially, it is just a placeholder for code that is moved from
10 /// [CodeEmitterTask]. 10 /// [CodeEmitterTask].
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 List<jsAst.Expression> argumentsBuffer = 55 List<jsAst.Expression> argumentsBuffer =
56 new List<jsAst.Expression>( 56 new List<jsAst.Expression>(
57 parameters.parameterCount + extraArgumentCount); 57 parameters.parameterCount + extraArgumentCount);
58 String invocationName = namer.invocationName(selector); 58 String invocationName = namer.invocationName(selector);
59 59
60 int count = 0; 60 int count = 0;
61 if (isInterceptedMethod) { 61 if (isInterceptedMethod) {
62 count++; 62 count++;
63 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); 63 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName);
64 argumentsBuffer[0] = js('#', receiverArgumentName); 64 argumentsBuffer[0] = js('#', receiverArgumentName);
65 emitter.interceptorEmitter.interceptorInvocationNames.add(invocationName);
66 } 65 }
67 66
68 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; 67 int optionalParameterStart = positionalArgumentCount + extraArgumentCount;
69 // Includes extra receiver argument when using interceptor convention 68 // Includes extra receiver argument when using interceptor convention
70 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; 69 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1;
71 70
72 int parameterIndex = 0; 71 int parameterIndex = 0;
73 parameters.orderedForEachParameter((ParameterElement element) { 72 parameters.orderedForEachParameter((ParameterElement element) {
74 String jsName = backend.namer.safeName(element.name); 73 String jsName = backend.namer.safeName(element.name);
75 assert(jsName != receiverArgumentName); 74 assert(jsName != receiverArgumentName);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 251
253 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); 252 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name);
254 253
255 if (!needStructuredInfo) { 254 if (!needStructuredInfo) {
256 compiler.dumpInfoTask.registerElementAst(member, 255 compiler.dumpInfoTask.registerElementAst(member,
257 builder.addProperty(name, code)); 256 builder.addProperty(name, code));
258 if (needsStubs) { 257 if (needsStubs) {
259 addParameterStubs( 258 addParameterStubs(
260 member, 259 member,
261 (Selector selector, jsAst.Fun function) { 260 (Selector selector, jsAst.Fun function) {
261 String invocationName = namer.invocationName(selector);
262 emitter.interceptorEmitter.
floitsch 2015/01/29 17:27:10 You seem to be missing the test that the member is
zarah 2015/01/29 18:24:18 The check is done in recordMangledNameOfMemberMeth
floitsch 2015/01/29 18:38:09 Acknowledged.
263 recordMangledNameOfMemberMethod(member, invocationName);
262 compiler.dumpInfoTask.registerElementAst(member, 264 compiler.dumpInfoTask.registerElementAst(member,
263 builder.addProperty(namer.invocationName(selector), 265 builder.addProperty(namer.invocationName(selector),
floitsch 2015/01/29 17:27:10 reuse invocationName local.
zarah 2015/01/29 18:24:18 Done.
264 function)); 266 function));
265 }); 267 });
266 } 268 }
267 return; 269 return;
268 } 270 }
269 emitter.needsStructuredMemberInfo = true; 271 emitter.needsStructuredMemberInfo = true;
270 272
271 // This element is needed for reflection or needs additional stubs or has a 273 // This element is needed for reflection or needs additional stubs or has a
272 // super alias. So we need to retain additional information. 274 // super alias. So we need to retain additional information.
273 275
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (member.isAccessor) requiredParameterCount++; 331 if (member.isAccessor) requiredParameterCount++;
330 332
331 int optionalParameterCount = parameters.optionalParameterCount << 1; 333 int optionalParameterCount = parameters.optionalParameterCount << 1;
332 if (parameters.optionalParametersAreNamed) optionalParameterCount++; 334 if (parameters.optionalParametersAreNamed) optionalParameterCount++;
333 335
334 // TODO(sra): Don't use LiteralString for non-strings. 336 // TODO(sra): Don't use LiteralString for non-strings.
335 List tearOffInfo = [new jsAst.LiteralString(callSelectorString)]; 337 List tearOffInfo = [new jsAst.LiteralString(callSelectorString)];
336 338
337 if (needsStubs || canTearOff) { 339 if (needsStubs || canTearOff) {
338 addParameterStubs(member, (Selector selector, jsAst.Fun function) { 340 addParameterStubs(member, (Selector selector, jsAst.Fun function) {
341
342 String invocationName = namer.invocationName(selector);
343 emitter.interceptorEmitter.
floitsch 2015/01/29 17:27:10 ditto: missing the check that it is an interceptor
zarah 2015/01/29 18:24:18 Same as above.
344 recordMangledNameOfMemberMethod(member, invocationName);
339 expressions.add(function); 345 expressions.add(function);
340 if (member.isInstanceMember) { 346 if (member.isInstanceMember) {
341 Set invokedSelectors = 347 Set invokedSelectors =
342 compiler.codegenWorld.invokedNames[member.name]; 348 compiler.codegenWorld.invokedNames[member.name];
343 expressions.add(js.string(namer.invocationName(selector))); 349 expressions.add(js.string(invocationName));
344 } else { 350 } else {
345 expressions.add(js('null')); 351 expressions.add(js('null'));
346 // TOOD(ahe): Since we know when reading static data versus instance 352 // TOOD(ahe): Since we know when reading static data versus instance
347 // data, we can eliminate this element. 353 // data, we can eliminate this element.
348 } 354 }
349 Set<Selector> callSelectors = compiler.codegenWorld.invokedNames[ 355 Set<Selector> callSelectors = compiler.codegenWorld.invokedNames[
350 namer.closureInvocationSelectorName]; 356 namer.closureInvocationSelectorName];
351 Selector callSelector = selector.toCallSelector(); 357 Selector callSelector = selector.toCallSelector();
352 String callSelectorString = 'null'; 358 String callSelectorString = 'null';
353 if (canTearOff && callSelectors != null && 359 if (canTearOff && callSelectors != null &&
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 jsAst.ArrayInitializer arrayInit = 435 jsAst.ArrayInitializer arrayInit =
430 new jsAst.ArrayInitializer(expressions.toList()); 436 new jsAst.ArrayInitializer(expressions.toList());
431 compiler.dumpInfoTask.registerElementAst(member, 437 compiler.dumpInfoTask.registerElementAst(member,
432 builder.addProperty(name, arrayInit)); 438 builder.addProperty(name, arrayInit));
433 } 439 }
434 440
435 void addMemberField(Field field, ClassBuilder builder) { 441 void addMemberField(Field field, ClassBuilder builder) {
436 // For now, do nothing. 442 // For now, do nothing.
437 } 443 }
438 } 444 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698