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

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

Issue 1071133002: dart2js: create a 'types' table for each deferred unit. (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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 'objectClassName': js.string(namer.runtimeTypeName(compiler.objectClass)), 135 'objectClassName': js.string(namer.runtimeTypeName(compiler.objectClass)),
136 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, 136 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo,
137 'usesMangledNames': 137 'usesMangledNames':
138 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply, 138 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply,
139 'tearOffCode': buildTearOffCode(backend), 139 'tearOffCode': buildTearOffCode(backend),
140 'nativeInfoHandler': nativeInfoHandler, 140 'nativeInfoHandler': nativeInfoHandler,
141 'operatorIsPrefix' : js.string(namer.operatorIsPrefix), 141 'operatorIsPrefix' : js.string(namer.operatorIsPrefix),
142 'deferredActionString': js.string(namer.deferredAction)}; 142 'deferredActionString': js.string(namer.deferredAction)};
143 143
144 String skeleton = ''' 144 String skeleton = '''
145 function $setupProgramName(programData) { 145 function $setupProgramName(programData, typesOffset) {
146 "use strict"; 146 "use strict";
147 if (#needsClassSupport) { 147 if (#needsClassSupport) {
148 148
149 function generateAccessor(fieldDescriptor, accessors, cls) { 149 function generateAccessor(fieldDescriptor, accessors, cls) {
150 var fieldInformation = fieldDescriptor.split("-"); 150 var fieldInformation = fieldDescriptor.split("-");
151 var field = fieldInformation[0]; 151 var field = fieldInformation[0];
152 var len = field.length; 152 var len = field.length;
153 var code = field.charCodeAt(len - 1); 153 var code = field.charCodeAt(len - 1);
154 var reflectable; 154 var reflectable;
155 if (fieldInformation.length > 1) reflectable = true; 155 if (fieldInformation.length > 1) reflectable = true;
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 var requiredParameterCount = requiredParameterInfo >> 1; 652 var requiredParameterCount = requiredParameterInfo >> 1;
653 var isAccessor = (requiredParameterInfo & 1) === 1; 653 var isAccessor = (requiredParameterInfo & 1) === 1;
654 var isSetter = requiredParameterInfo === 3; 654 var isSetter = requiredParameterInfo === 3;
655 var isGetter = requiredParameterInfo === 1; 655 var isGetter = requiredParameterInfo === 1;
656 var optionalParameterInfo = ${readInt("array", "1")}; 656 var optionalParameterInfo = ${readInt("array", "1")};
657 var optionalParameterCount = optionalParameterInfo >> 1; 657 var optionalParameterCount = optionalParameterInfo >> 1;
658 var optionalParametersAreNamed = (optionalParameterInfo & 1) === 1; 658 var optionalParametersAreNamed = (optionalParameterInfo & 1) === 1;
659 var isIntercepted = 659 var isIntercepted =
660 requiredParameterCount + optionalParameterCount != funcs[0].length; 660 requiredParameterCount + optionalParameterCount != funcs[0].length;
661 var functionTypeIndex = ${readFunctionType("array", "2")}; 661 var functionTypeIndex = ${readFunctionType("array", "2")};
662 if (typeof functionTypeIndex == "number")
663 ${readFunctionType("array", "2")} = functionTypeIndex + typesOffset;
662 var unmangledNameIndex = $unmangledNameIndex; 664 var unmangledNameIndex = $unmangledNameIndex;
663 665
664 if (getterStubName) { 666 if (getterStubName) {
665 f = tearOff(funcs, array, isStatic, name, isIntercepted); 667 f = tearOff(funcs, array, isStatic, name, isIntercepted);
666 prototype[name].\$getter = f; 668 prototype[name].\$getter = f;
667 f.\$getterStub = true; 669 f.\$getterStub = true;
668 // Used to create an isolate using spawnFunction. 670 // Used to create an isolate using spawnFunction.
669 if (isStatic) { 671 if (isStatic) {
670 #globalFunctions[name] = f; 672 #globalFunctions[name] = f;
671 functions.push(getterStubName); 673 functions.push(getterStubName);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 (function() { 806 (function() {
805 var result = $array[$index]; 807 var result = $array[$index];
806 if ($check) { 808 if ($check) {
807 throw new Error( 809 throw new Error(
808 name + ": expected value of type \'$type\' at index " + ($index) + 810 name + ": expected value of type \'$type\' at index " + ($index) +
809 " but got " + (typeof result)); 811 " but got " + (typeof result));
810 } 812 }
811 return result; 813 return result;
812 })()'''; 814 })()''';
813 } 815 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698