Chromium Code Reviews
Descriptiondart2js: Allow to encode side-effects in the spec-string of JS and similar built-ins.
This patch prepares a shift towards two builtins. We currently have ~20 foreign functions that must be caught by the resolver, type-inferrer, builder, ...
In the future there will be only two:
JS(...), and JS_BUILTIN(...)
The JS_BUILTIN function would take a string or enum as second argument (after the spec-string) which would be shared between the runtime and the compiler.
This makes it easier to ensure that no builtin is forgotten in the places where they need to be handled.
This patch also gives more flexibility to the implementor.
For example `JS('bool', 'typeof self["foo"] != "undefined"')` would currently trigger a "depends on index store". With this patch the developer could override the automatic side-effect analysis and force the dependency to be empty.
Note: in theory we could make "JS" a BUILTIN itself, but, given its importance, I prefer to keep it separate.
Note2: with the "ForceInline" CL [0] we can keep the old functions (like "JS_GET_FLAG") and just forward to JS_BUILTIN:
@ForceInline()
bool JS_GET_FLAG(String name) {
// Given: a shared enum `Builtin`.
return JS_BUILTIN('bool', Builtin.getFlag, name);
}
[0] https://chromiumcodereview.appspot.com/962703004/
R=herhut@google.com, sra@google.com
Committed: https://code.google.com/p/dart/source/detail?r=44229
Patch Set 1 #Patch Set 2 : Fix long lines. #
Total comments: 8
Patch Set 3 : Fix type annotations #
Total comments: 16
Patch Set 4 : Fix type-annotation (again). #Patch Set 5 : Address comments. #Patch Set 6 : Fix another bad type annotation. #
Messages
Total messages: 10 (1 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||