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

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

Issue 125033003: Version 1.1.0-dev.5.1 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 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) 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // N+2. (Optional parameter count << 1) + 384 // N+2. (Optional parameter count << 1) +
385 // (parameters.optionalParametersAreNamed ? 1 : 0). 385 // (parameters.optionalParametersAreNamed ? 1 : 0).
386 // N+3. Index to function type in constant pool. 386 // N+3. Index to function type in constant pool.
387 // N+4. First default argument. 387 // N+4. First default argument.
388 // ... 388 // ...
389 // O. First parameter name (if needed for reflection or Function.apply). 389 // O. First parameter name (if needed for reflection or Function.apply).
390 // ... 390 // ...
391 // P. Unmangled name (if reflectable). 391 // P. Unmangled name (if reflectable).
392 // P+1. First metadata (if reflectable). 392 // P+1. First metadata (if reflectable).
393 // ... 393 // ...
394 // TODO(ahe): Consider one of the parameter counts can be replaced by the
395 // length property of the JavaScript function object.
394 396
395 List expressions = []; 397 List expressions = [];
396 398
397 String callSelectorString = 'null'; 399 String callSelectorString = 'null';
398 if (member.isFunction()) { 400 if (member.isFunction()) {
399 Selector callSelector = 401 Selector callSelector =
400 new Selector.fromElement(member, compiler).toCallSelector(); 402 new Selector.fromElement(member, compiler).toCallSelector();
401 callSelectorString = '"${namer.invocationName(callSelector)}"'; 403 callSelectorString = '"${namer.invocationName(callSelector)}"';
402 } 404 }
403 405
(...skipping 10 matching lines...) Expand all
414 // TODO(ahe): Remove comments from output. 416 // TODO(ahe): Remove comments from output.
415 List tearOffInfo = 417 List tearOffInfo =
416 [new jsAst.LiteralString('$callSelectorString /* tearOffInfo */')]; 418 [new jsAst.LiteralString('$callSelectorString /* tearOffInfo */')];
417 419
418 if (needsStubs || canTearOff) { 420 if (needsStubs || canTearOff) {
419 addParameterStubs(member, (Selector selector, jsAst.Fun function) { 421 addParameterStubs(member, (Selector selector, jsAst.Fun function) {
420 expressions.add(function); 422 expressions.add(function);
421 if (member.isInstanceMember()) { 423 if (member.isInstanceMember()) {
422 Set invokedSelectors = 424 Set invokedSelectors =
423 compiler.codegenWorld.invokedNames[member.name]; 425 compiler.codegenWorld.invokedNames[member.name];
424 if (invokedSelectors != null && invokedSelectors.contains(selector)) { 426 //if (invokedSelectors != null && invokedSelectors.contains(selector)) {
425 expressions.add(js.string(namer.invocationName(selector))); 427 expressions.add(js.string(namer.invocationName(selector)));
426 } else { 428 //} else {
427 // Don't add a stub for calling this as a regular instance method, 429 // // Don't add a stub for calling this as a regular instance method,
428 // we only need the "call" stub for implicit closures of this 430 // // we only need the "call" stub for implicit closures of this
429 // method. 431 // // method.
430 expressions.add("null"); 432 // expressions.add("null");
431 } 433 //}
432 } else { 434 } else {
433 // Static methods don't need "named" stubs as the default arguments 435 // Static methods don't need "named" stubs as the default arguments
434 // are inlined at call sites. But static methods might need "call" 436 // are inlined at call sites. But static methods might need "call"
435 // stubs for implicit closures. 437 // stubs for implicit closures.
436 expressions.add("null"); 438 expressions.add("null");
437 // TOOD(ahe): Since we know when reading static data versus instance 439 // TOOD(ahe): Since we know when reading static data versus instance
438 // data, we can eliminate this element. 440 // data, we can eliminate this element.
439 } 441 }
440 Set<Selector> callSelectors = compiler.codegenWorld.invokedNames[ 442 Set<Selector> callSelectors = compiler.codegenWorld.invokedNames[
441 namer.closureInvocationSelectorName]; 443 namer.closureInvocationSelectorName];
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 expressions.add(js.string(member.name)); 505 expressions.add(js.string(member.name));
504 } 506 }
505 507
506 builder.addProperty(name, js.toExpression(expressions)); 508 builder.addProperty(name, js.toExpression(expressions));
507 } 509 }
508 510
509 void addMemberField(VariableElement member, ClassBuilder builder) { 511 void addMemberField(VariableElement member, ClassBuilder builder) {
510 // For now, do nothing. 512 // For now, do nothing.
511 } 513 }
512 } 514 }
OLDNEW
« no previous file with comments | « dart/runtime/vm/parser.cc ('k') | dart/sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698