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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 12042003: Move relational operators to the new interceptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 if (identical(classElement, compiler.objectClass) 758 if (identical(classElement, compiler.objectClass)
759 && compiler.enabledNoSuchMethod) { 759 && compiler.enabledNoSuchMethod) {
760 // Emit the noSuchMethod handlers on the Object prototype now, 760 // Emit the noSuchMethod handlers on the Object prototype now,
761 // so that the code in the dynamicFunction helper can find 761 // so that the code in the dynamicFunction helper can find
762 // them. Note that this helper is invoked before analyzing the 762 // them. Note that this helper is invoked before analyzing the
763 // full JS script. 763 // full JS script.
764 if (!nativeEmitter.handleNoSuchMethod) { 764 if (!nativeEmitter.handleNoSuchMethod) {
765 emitNoSuchMethodHandlers(builder.addProperty); 765 emitNoSuchMethodHandlers(builder.addProperty);
766 } 766 }
767 } 767 }
768
769 if (backend.isInterceptorClass(classElement)) {
770 // The operator== method in [:Object:] does not take the same
771 // number of arguments as an intercepted method, therefore we
772 // explicitely add one to all interceptor classes. Note that we
773 // would not have do do that if all intercepted methods had
774 // a calling convention where the receiver is the first
775 // parameter.
776 String name = backend.namer.publicInstanceMethodNameByArity(
777 const SourceString('=='), 1);
778 Function kind = classElement == backend.jsNullClass
kasperl 2013/01/21 09:45:11 Maybe add ( ) around the == expression.
ngeoffray 2013/01/21 10:41:44 Done.
779 ? js.equals
780 : js.identity;
781 builder.addProperty(name, js.fun(['receiver', 'a'],
782 js.block1(js.return_(kind(js.use('receiver'), js.use('a'))))));
783 }
768 } 784 }
769 785
770 void emitRuntimeClassesAndTests(CodeBuffer buffer) { 786 void emitRuntimeClassesAndTests(CodeBuffer buffer) {
771 JavaScriptBackend backend = compiler.backend; 787 JavaScriptBackend backend = compiler.backend;
772 RuntimeTypeInformation rti = backend.rti; 788 RuntimeTypeInformation rti = backend.rti;
773 789
774 TypeChecks typeChecks = rti.computeRequiredChecks(); 790 TypeChecks typeChecks = rti.computeRequiredChecks();
775 791
776 bool needsHolder(ClassElement cls) { 792 bool needsHolder(ClassElement cls) {
777 return !neededClasses.contains(cls) || cls.isNative() || 793 return !neededClasses.contains(cls) || cls.isNative() ||
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 """; 2176 """;
2161 const String HOOKS_API_USAGE = """ 2177 const String HOOKS_API_USAGE = """
2162 // The code supports the following hooks: 2178 // The code supports the following hooks:
2163 // dartPrint(message) - if this function is defined it is called 2179 // dartPrint(message) - if this function is defined it is called
2164 // instead of the Dart [print] method. 2180 // instead of the Dart [print] method.
2165 // dartMainRunner(main) - if this function is defined, the Dart [main] 2181 // dartMainRunner(main) - if this function is defined, the Dart [main]
2166 // method will not be invoked directly. 2182 // method will not be invoked directly.
2167 // Instead, a closure that will invoke [main] is 2183 // Instead, a closure that will invoke [main] is
2168 // passed to [dartMainRunner]. 2184 // passed to [dartMainRunner].
2169 """; 2185 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698