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

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

Issue 1039223002: Revert "Clean up naming scheme for reflection names." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 // 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 f.\$callName = null; 676 f.\$callName = null;
677 // Update the interceptedNames map (which only exists if `invokeOn` was 677 // Update the interceptedNames map (which only exists if `invokeOn` was
678 // enabled). 678 // enabled).
679 if (#enabledInvokeOn) 679 if (#enabledInvokeOn)
680 if (isIntercepted) #interceptedNames[getterStubName] = 1; 680 if (isIntercepted) #interceptedNames[getterStubName] = 1;
681 } 681 }
682 682
683 if (#usesMangledNames) { 683 if (#usesMangledNames) {
684 var isReflectable = array.length > unmangledNameIndex; 684 var isReflectable = array.length > unmangledNameIndex;
685 if (isReflectable) { 685 if (isReflectable) {
686 funcs[0].$reflectableField = 1; 686 for (var i = 0; i < funcs.length; i++) {
687 funcs[0].$reflectionInfoField = array; 687 funcs[i].$reflectableField = 1;
688 for (var i = 1; i < funcs.length; i++) {
689 funcs[i].$reflectableField = 2;
690 funcs[i].$reflectionInfoField = array; 688 funcs[i].$reflectionInfoField = array;
691 } 689 }
692 var mangledNames = isStatic ? #mangledGlobalNames : #mangledNames; 690 var mangledNames = isStatic ? #mangledGlobalNames : #mangledNames;
693 var unmangledName = ${readString("array", "unmangledNameIndex")}; 691 var unmangledName = ${readString("array", "unmangledNameIndex")};
694 // The function is either a getter, a setter, or a method. 692 // The function is either a getter, a setter, or a method.
695 // If it is a method, it might also have a tear-off closure. 693 // If it is a method, it might also have a tear-off closure.
696 // The unmangledName is the same as the getter-name. 694 // The unmangledName is the same as the getter-name.
697 var reflectionName = unmangledName; 695 var reflectionName = unmangledName;
698 if (getterStubName) mangledNames[getterStubName] = reflectionName; 696 if (getterStubName) mangledNames[getterStubName] = reflectionName;
699 if (isSetter) { 697 if (isSetter) {
700 reflectionName += "="; 698 reflectionName += "=";
701 } else if (!isGetter) { 699 } else if (!isGetter) {
702 reflectionName += ":" + 700 reflectionName += ":" + requiredParameterCount +
703 (requiredParameterCount + optionalParameterCount); 701 ":" + optionalParameterCount;
704 } 702 }
705 mangledNames[name] = reflectionName; 703 mangledNames[name] = reflectionName;
706 funcs[0].$reflectionNameField = reflectionName; 704 funcs[0].$reflectionNameField = reflectionName;
707 funcs[0].$metadataIndexField = unmangledNameIndex + 1; 705 funcs[0].$metadataIndexField = unmangledNameIndex + 1;
708 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0]; 706 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0];
709 } 707 }
710 } 708 }
711 } 709 }
712 710
713 #tearOffCode; 711 #tearOffCode;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 (function() { 802 (function() {
805 var result = $array[$index]; 803 var result = $array[$index];
806 if ($check) { 804 if ($check) {
807 throw new Error( 805 throw new Error(
808 name + ": expected value of type \'$type\' at index " + ($index) + 806 name + ": expected value of type \'$type\' at index " + ($index) +
809 " but got " + (typeof result)); 807 " but got " + (typeof result));
810 } 808 }
811 return result; 809 return result;
812 })()'''; 810 })()''';
813 } 811 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698