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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 11348133: Add JSNull, JSBool and JSFunction, and move toString into the new interceptor scheme. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (revision 15139)
+++ sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (working copy)
@@ -651,6 +651,9 @@
ClassElement jsNumberClass;
ClassElement jsIntClass;
ClassElement jsDoubleClass;
+ ClassElement jsFunctionClass;
+ ClassElement jsNullClass;
+ ClassElement jsBoolClass;
ClassElement objectInterceptorClass;
Element getInterceptorMethod;
bool _interceptorsAreInitialized = false;
@@ -725,6 +728,9 @@
|| element == jsArrayClass
|| element == jsIntClass
|| element == jsDoubleClass
+ || element == jsNullClass
+ || element == jsFunctionClass
+ || element == jsBoolClass
|| element == jsNumberClass;
}
@@ -756,6 +762,12 @@
compiler.findInterceptor(const SourceString('JSInt'));
jsDoubleClass =
compiler.findInterceptor(const SourceString('JSDouble'));
+ jsNullClass =
+ compiler.findInterceptor(const SourceString('JSNull'));
+ jsFunctionClass =
+ compiler.findInterceptor(const SourceString('JSFunction'));
+ jsBoolClass =
+ compiler.findInterceptor(const SourceString('JSBool'));
}
void addInterceptors(ClassElement cls) {
@@ -774,6 +786,18 @@
if (!_interceptorsAreInitialized) {
initializeInterceptorElements();
_interceptorsAreInitialized = true;
+ // The null interceptor and the function interceptor are
+ // currently always instantiated if a new class is instantiated.
+ // TODO(ngeoffray): do this elsewhere for the function
+ // interceptor?
+ if (jsNullClass != null) {
+ addInterceptors(jsNullClass);
+ enqueuer.registerInstantiatedClass(jsNullClass);
+ }
+ if (jsFunctionClass != null) {
+ addInterceptors(jsFunctionClass);
+ enqueuer.registerInstantiatedClass(jsFunctionClass);
+ }
}
if (cls == compiler.stringClass) {
result = jsStringClass;
@@ -783,6 +807,10 @@
result = jsIntClass;
} else if (cls == compiler.doubleClass) {
result = jsDoubleClass;
+ } else if (cls == compiler.functionClass) {
+ result = jsFunctionClass;
+ } else if (cls == compiler.boolClass) {
+ result = jsBoolClass;
}
if (result == null) return;

Powered by Google App Engine
This is Rietveld 408576698