Version 0.7.5.3 .
svn merge -c 27744 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 27745 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@27776 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 57a28b4..adbdf3b 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -100,13 +100,6 @@
[ $compiler == dart2js && $csp ]
unittest/test/mirror_matchers_test: Skip # Issue 12151
-observe/test/observe_test: Fail # Issue 11970
-observe/test/path_observer_test: Fail # Issue 11970
-mdv/test/binding_syntax_test: Fail # Issue 11970
-polymer_expressions/test/eval_test: Fail # Issue 12578
-polymer_expressions/test/syntax_test: Fail # Issue 12578
-serialization/test/serialization_test: Fail # Issue 6490
-serialization/test/no_library_test: Fail # Issue 6490
# This test cannot run under CSP because it is injecting a JavaScript polyfill
mutation_observer: Skip
@@ -211,7 +204,7 @@
# Skip serialization test that explicitly has no library declaration in the
# test on Dartium, which requires all tests to have a library.
-[ $runtime == dartium || $runtime == drt ]
+[ $compiler == none && ( $runtime == dartium || $runtime == drt ) ]
serialization/test/no_library_test: Skip # Expected Failure
# Skip tests on the VM if the package depends on dart:html
diff --git a/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index 6986414..2b56ac0 100644
--- a/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -43,7 +43,6 @@
enableNativeLiveTypeAnalysis:
!hasOption(options, '--disable-native-live-type-analysis'),
emitJavaScript: !hasOption(options, '--output-type=dart'),
- disallowUnsafeEval: hasOption(options, '--disallow-unsafe-eval'),
analyzeAllFlag: hasOption(options, '--analyze-all'),
analyzeOnly: hasOption(options, '--analyze-only'),
analyzeSignaturesOnly:
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index ea110ef..2b51ade 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -597,7 +597,6 @@
this.enableNativeLiveTypeAnalysis: false,
bool emitJavaScript: true,
bool generateSourceMap: true,
- bool disallowUnsafeEval: false,
this.analyzeAllFlag: false,
bool analyzeOnly: false,
bool analyzeSignaturesOnly: false,
@@ -619,8 +618,7 @@
closureMapping.ClosureNamer closureNamer;
if (emitJavaScript) {
js_backend.JavaScriptBackend jsBackend =
- new js_backend.JavaScriptBackend(this, generateSourceMap,
- disallowUnsafeEval);
+ new js_backend.JavaScriptBackend(this, generateSourceMap);
closureNamer = jsBackend.namer;
backend = jsBackend;
} else {
diff --git a/sdk/lib/_internal/compiler/implementation/dart2js.dart b/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 55f167b..68f7358 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -253,7 +253,6 @@
(_) => passThrough('--trust-type-annotations')),
new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true),
new OptionHandler('--package-root=.+|-p.+', setPackageRoot),
- new OptionHandler('--disallow-unsafe-eval', passThrough),
new OptionHandler('--analyze-all', passThrough),
new OptionHandler('--analyze-only', setAnalyzeOnly),
new OptionHandler('--analyze-signatures-only', passThrough),
@@ -485,10 +484,6 @@
--minify
Generate minified output.
- --disallow-unsafe-eval
- Disable dynamic generation of code in the generated output. This is
- necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).
-
--suppress-warnings
Do not display any warnings.
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 376fdfc..cbdb7ab 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -417,16 +417,14 @@
/// Number of methods compiled before considering reflection.
int preMirrorsMethodCount = 0;
- JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval)
+ JavaScriptBackend(Compiler compiler, bool generateSourceMap)
: namer = determineNamer(compiler),
oneShotInterceptors = new Map<String, Selector>(),
interceptedElements = new Map<SourceString, Set<Element>>(),
rti = new RuntimeTypes(compiler),
specializedGetInterceptors = new Map<String, Set<ClassElement>>(),
super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) {
- emitter = disableEval
- ? new CodeEmitterNoEvalTask(compiler, namer, generateSourceMap)
- : new CodeEmitterTask(compiler, namer, generateSourceMap);
+ emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
builder = new SsaBuilderTask(this);
optimizer = new SsaOptimizerTask(this);
generator = new SsaCodeGeneratorTask(this);
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index ba51d89..180542a 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -90,7 +90,6 @@
* The code for the containing (used) methods must exist in the [:universe:].
*/
class CodeEmitterTask extends CompilerTask {
- bool needsInheritFunction = false;
bool needsDefineClass = false;
bool needsMixinSupport = false;
bool needsLazyInitializer = false;
@@ -168,6 +167,22 @@
new Set<FunctionType>();
/**
+ * List of expressions and statements that will be included in the
+ * precompiled function.
+ *
+ * To save space, dart2js normally generates constructors and accessors
+ * dynamically. This doesn't work in CSP mode, and may impact startup time
+ * negatively. So dart2js will emit these functions to a separate file that
+ * can be optionally included to support CSP mode or for faster startup.
+ */
+ List<jsAst.Node> precompiledFunction = <jsAst.Node>[];
+
+ List<jsAst.Expression> precompiledConstructorNames = <jsAst.Expression>[];
+
+ // True if Isolate.makeConstantList is needed.
+ bool hasMakeConstantList = false;
+
+ /**
* For classes and libraries, record code for static/top-level members.
* Later, this code is emitted when the class or library is emitted.
* See [bufferForElement].
@@ -263,8 +278,6 @@
=> '${namer.isolateName}.\$finishIsolateConstructor';
String get isolatePropertiesName
=> '${namer.isolateName}.${namer.isolatePropertiesName}';
- String get supportsProtoName
- => 'supportsProto';
String get lazyInitializerName
=> '${namer.isolateName}.\$lazy';
@@ -304,8 +317,8 @@
String valueParamName = compiler.enableMinification ? "v" : "value";
String reflectableField = namer.reflectableField;
- // function generateAccessor(field, prototype) {
- jsAst.Fun fun = js.fun(['field', 'prototype'], [
+ // function generateAccessor(field, prototype, cls) {
+ jsAst.Fun fun = js.fun(['field', 'accessors', 'cls'], [
js('var len = field.length'),
js('var code = field.charCodeAt(len - 1)'),
js('var reflectable = false'),
@@ -340,11 +353,13 @@
js('var args = (getterCode & 2) ? "$receiverParamName" : ""'),
js('var receiver = (getterCode & 1) ? "this" : "$receiverParamName"'),
js('var body = "return " + receiver + "." + field'),
- js('prototype["${namer.getterPrefix}" + accessorName] = '
- 'new Function(args, body)'),
- js.if_('reflectable', [
- js('prototype["${namer.getterPrefix}" + accessorName].'
- '$reflectableField = 1')])
+ js('var property ='
+ ' cls + ".prototype.${namer.getterPrefix}" + accessorName + "="'),
+ js('var fn = "function(" + args + "){" + body + "}"'),
+ js.if_(
+ 'reflectable',
+ js('accessors.push(property + "\$reflectable(" + fn + ");\\n")'),
+ js('accessors.push(property + fn + ";\\n")')),
]),
// if (needsSetter) {
@@ -354,11 +369,13 @@
' : "$valueParamName"'),
js('var receiver = (setterCode & 1) ? "this" : "$receiverParamName"'),
js('var body = receiver + "." + field + "$_=$_$valueParamName"'),
- js('prototype["${namer.setterPrefix}" + accessorName] = '
- 'new Function(args, body)'),
- js.if_('reflectable', [
- js('prototype["${namer.setterPrefix}" + accessorName].'
- '$reflectableField = 1')])
+ js('var property ='
+ ' cls + ".prototype.${namer.setterPrefix}" + accessorName + "="'),
+ js('var fn = "function(" + args + "){" + body + "}"'),
+ js.if_(
+ 'reflectable',
+ js('accessors.push(property + "\$reflectable(" + fn + ");\\n")'),
+ js('accessors.push(property + fn + ";\\n")')),
]),
]),
@@ -387,33 +404,31 @@
// },
// });
- var defineClass = js.fun(['name', 'cls', 'fields', 'prototype'], [
- js('var constructor'),
+ var defineClass = js.fun(['name', 'cls', 'fields'], [
+ js('var accessors = []'),
- js.if_(js('typeof fields == "function"'), [
- js('constructor = fields')
- ], /* else */ [
- js('var str = "function " + cls + "("'),
- js('var body = ""'),
+ js('var str = "function " + cls + "("'),
+ js('var body = ""'),
- js.for_('var i = 0', 'i < fields.length', 'i++', [
- js.if_('i != 0', js('str += ", "')),
+ js.for_('var i = 0', 'i < fields.length', 'i++', [
+ js.if_('i != 0', js('str += ", "')),
- js('var field = generateAccessor(fields[i], prototype)'),
- js('var parameter = "parameter_" + field'),
- js('str += parameter'),
- js('body += ("this." + field + " = " + parameter + ";\\n")')
- ]),
-
- js('str += (") {" + body + "}\\nreturn " + cls)'),
-
- js('constructor = new Function(str)()')
+ js('var field = generateAccessor(fields[i], accessors, cls)'),
+ js('var parameter = "parameter_" + field'),
+ js('str += parameter'),
+ js('body += ("this." + field + " = " + parameter + ";\\n")')
]),
+ js('str += ") {\\n" + body + "}\\n"'),
+ js('str += cls + ".builtin\$cls=\\"" + name + "\\";\\n"'),
+ js('str += "\$desc=\$collectedClasses." + cls + ";\\n"'),
+ js('str += "if(\$desc instanceof Array) \$desc = \$desc[1];\\n"'),
+ js('str += cls + ".prototype = \$desc;\\n"'),
+ js.if_(
+ 'typeof defineClass.name != "string"',
+ [js('str += cls + ".name=\\"" + cls + "\\";\\n"')]),
+ js('str += accessors.join("")'),
- js('constructor.prototype = prototype'),
- js(r'constructor.builtin$cls = name'),
-
- js.return_('constructor')
+ js.return_('str')
]);
// Declare a function called "generateAccessor". This is used in
// defineClassFunction (it's a local declaration in init()).
@@ -425,28 +440,24 @@
}
/** Needs defineClass to be defined. */
- List buildProtoSupportCheck() {
- // On Firefox and Webkit browsers we can manipulate the __proto__
- // directly. Opera claims to have __proto__ support, but it is buggy.
- // So we have to do more checks.
- // Opera bug was filed as DSK-370158, and fixed as CORE-47615
- // (http://my.opera.com/desktopteam/blog/2012/07/20/more-12-01-fixes).
- // If the browser does not support __proto__ we need to instantiate an
- // object with the correct (internal) prototype set up correctly, and then
- // copy the members.
- // TODO(8541): Remove this work around.
-
+ List buildInheritFrom() {
return [
- js('var $supportsProtoName = false'),
- js('var tmp = defineClass("c", "c", ["f<"], {}).prototype'),
-
- js.if_(js('tmp.__proto__'), [
- js('tmp.__proto__ = {}'),
- js.if_(js(r'typeof tmp.get$f != "undefined"'),
- js('$supportsProtoName = true'))
-
- ])
- ];
+ js('var inheritFrom = #',
+ js.fun([], [
+ new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration('tmp'), js.fun([], [])),
+ js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
+ js.return_(js.fun(['constructor', 'superConstructor'], [
+ js('tmp.prototype = superConstructor.prototype'),
+ js('var object = new tmp()'),
+ js('var properties = constructor.prototype'),
+ js.forIn('member', 'properties',
+ js.if_('hasOwnProperty.call(properties, member)',
+ js('object[member] = properties[member]'))),
+ js('object.constructor = constructor'),
+ js('constructor.prototype = object'),
+ js.return_('object')
+ ]))])())];
}
static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
@@ -695,26 +706,29 @@
// the object literal directly. For other engines we have to create a new
// object and copy over the members.
+ String reflectableField = namer.reflectableField;
List<jsAst.Node> statements = [
js('var pendingClasses = {}'),
js.if_('!init.allClasses', js('init.allClasses = {}')),
js('var allClasses = init.allClasses'),
- js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
-
optional(
DEBUG_FAST_OBJECTS,
js('print("Number of classes: "'
r' + Object.getOwnPropertyNames($$).length)')),
+ js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
+
+ js.if_('typeof dart_precompiled == "function"',
+ [js('var constructors = dart_precompiled(collectedClasses)')],
+
+ [js('var combinedConstructorFunction = "function \$reflectable(fn){'
+ 'fn.$reflectableField=1;return fn};\\n"+ "var \$desc;\\n"'),
+ js('var constructorsList = []')]),
js.forIn('cls', 'collectedClasses', [
js.if_('hasOwnProperty.call(collectedClasses, cls)', [
js('var desc = collectedClasses[cls]'),
- js('var globalObject = isolateProperties'),
- js.if_('desc instanceof Array', [
- js('globalObject = desc[0] || isolateProperties'),
- js('desc = desc[1]')
- ]),
+ js.if_('desc instanceof Array', js('desc = desc[1]')),
/* The 'fields' are either a constructor function or a
* string encoding fields, constructor and superclass. Get
@@ -740,14 +754,9 @@
])
]),
- js.if_('typeof fields == "string"', [
- js('var s = fields.split(";")'),
- js('fields = s[1] == "" ? [] : s[1].split(",")'),
- js('supr = s[0]'),
- ], /* else */ [
- js('supr = desc.super'),
- js.if_(r'!!desc.$name', js(r'name = desc.$name'))
- ]),
+ js('var s = fields.split(";")'),
+ js('fields = s[1] == "" ? [] : s[1].split(",")'),
+ js('supr = s[0]'),
optional(needsMixinSupport, js.if_('supr && supr.indexOf("+") > 0', [
js('s = supr.split("+")'),
@@ -761,14 +770,35 @@
]),
])),
- js('var constructor = defineClass(name, cls, fields, desc)'),
- optional(backend.isTreeShakingDisabled,
- js('constructor["${namer.metadataField}"] = desc')),
- js('allClasses[cls] = constructor'),
- js('globalObject[cls] = constructor'),
+ js.if_('typeof dart_precompiled != "function"',
+ [js('combinedConstructorFunction +='
+ ' defineClass(name, cls, fields)'),
+ js('constructorsList.push(cls)')]),
js.if_('supr', js('pendingClasses[cls] = supr'))
])
]),
+ js.if_('typeof dart_precompiled != "function"',
+ [js('combinedConstructorFunction +='
+ ' "return [\\n " + constructorsList.join(",\\n ") + "\\n]"'),
+ js('var constructors ='
+ ' new Function("\$collectedClasses", combinedConstructorFunction)'
+ '(collectedClasses)'),
+ js('combinedConstructorFunction = null')]),
+ js.for_('var i = 0', 'i < constructors.length', 'i++', [
+ js('var constructor = constructors[i]'),
+ js('var cls = constructor.name'),
+ js('var desc = collectedClasses[cls]'),
+ js('var globalObject = isolateProperties'),
+ js.if_('desc instanceof Array', [
+ js('globalObject = desc[0] || isolateProperties'),
+ js('desc = desc[1]')
+ ]),
+ optional(backend.isTreeShakingDisabled,
+ js('constructor["${namer.metadataField}"] = desc')),
+ js('allClasses[cls] = constructor'),
+ js('globalObject[cls] = constructor'),
+ ]),
+ js('constructors = null'),
js('var finishedClasses = {}'),
@@ -821,38 +851,7 @@
js('superConstructor ='
'existingIsolateProperties[superclass]')),
- js('var prototype = constructor.prototype'),
-
- // if ($supportsProtoName) {
- js.if_(supportsProtoName, [
- js('prototype.__proto__ = superConstructor.prototype'),
- js('prototype.constructor = constructor'),
-
- ], /* else */ [
- // function tmp() {};
- new jsAst.FunctionDeclaration(
- new jsAst.VariableDeclaration('tmp'),
- js.fun([], [])),
-
- js('tmp.prototype = superConstructor.prototype'),
- js('var newPrototype = new tmp()'),
-
- js('constructor.prototype = newPrototype'),
- js('newPrototype.constructor = constructor'),
-
- // for (var member in prototype) {
- js.forIn('member', 'prototype', [
- /* Short version of: if (member == '') */
- // if (!member) continue;
- js.if_('!member', new jsAst.Continue(null)),
-
- // if (hasOwnProperty.call(prototype, member)) {
- js.if_('hasOwnProperty.call(prototype, member)', [
- js('newPrototype[member] = prototype[member]')
- ])
- ])
-
- ])
+ js('prototype = inheritFrom(constructor, superConstructor)'),
]);
return new jsAst.FunctionDeclaration(
@@ -860,7 +859,7 @@
fun);
}
- jsAst.Fun get finishIsolateConstructorFunction {
+ jsAst.Fun get finishIsolateConstructorFunction_NO_CSP {
String isolate = namer.isolateName;
// We replace the old Isolate function with a new one that initializes
// all its field with the initial (and often final) value of all globals.
@@ -924,14 +923,45 @@
]));
}
+ jsAst.Fun get finishIsolateConstructorFunction {
+ // We replace the old Isolate function with a new one that initializes
+ // all its fields with the initial (and often final) value of all globals.
+ //
+ // We also copy over old values like the prototype, and the
+ // isolateProperties themselves.
+ return js.fun('oldIsolate', [
+ js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'),
+ new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration('Isolate'),
+ js.fun([], [
+ js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
+ js.forIn('staticName', 'isolateProperties',
+ js.if_('hasOwnProperty.call(isolateProperties, staticName)',
+ js('this[staticName] = isolateProperties[staticName]'))),
+ // Use the newly created object as prototype. In Chrome,
+ // this creates a hidden class for the object and makes
+ // sure it is fast to access.
+ new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration('ForceEfficientMap'),
+ js.fun([], [])),
+ js('ForceEfficientMap.prototype = this'),
+ js('new ForceEfficientMap()')])),
+ js('Isolate.prototype = oldIsolate.prototype'),
+ js('Isolate.prototype.constructor = Isolate'),
+ js('Isolate.${namer.isolatePropertiesName} = isolateProperties'),
+ optional(needsDefineClass,
+ js('Isolate.$finishClassesProperty ='
+ ' oldIsolate.$finishClassesProperty')),
+ optional(hasMakeConstantList,
+ js('Isolate.makeConstantList = oldIsolate.makeConstantList')),
+ js.return_('Isolate')]);
+ }
+
jsAst.Fun get lazyInitializerFunction {
// function(prototype, staticName, fieldName, getterName, lazyValue) {
var parameters = <String>['prototype', 'staticName', 'fieldName',
'getterName', 'lazyValue'];
- return js.fun(parameters, [
- js('var getter = new Function("{ return this." + fieldName + ";}")'),
- ]..addAll(addLazyInitializerLogic())
- );
+ return js.fun(parameters, addLazyInitializerLogic());
}
List addLazyInitializerLogic() {
@@ -984,7 +1014,8 @@
js.return_('result')
], finallyPart: [
- js('$isolate[getterName] = getter')
+ js('$isolate[getterName] = #',
+ js.fun([], [js.return_('this[fieldName]')]))
])
]))
]);
@@ -993,7 +1024,7 @@
List buildDefineClassAndFinishClassFunctionsIfNecessary() {
if (!needsDefineClass) return [];
return defineClassFunction
- ..addAll(buildProtoSupportCheck())
+ ..addAll(buildInheritFrom())
..addAll([
js('$finishClassesName = #', finishClassesFunction)
]);
@@ -1689,29 +1720,34 @@
void generateGetter(Element member, String fieldName, String accessorName,
ClassBuilder builder) {
String getterName = namer.getterNameFromAccessorName(accessorName);
- String receiver = backend.isInterceptorClass(member.getEnclosingClass())
- ? 'receiver' : 'this';
- List<String> args = backend.isInterceptedMethod(member)
- ? ['receiver']
- : [];
- builder.addProperty(getterName,
- js.fun(args, js.return_(js('$receiver.$fieldName'))));
- generateReflectionDataForFieldGetterOrSetter(
- member, getterName, builder, isGetter: true);
+ ClassElement cls = member.getEnclosingClass();
+ String className = namer.getNameOfClass(cls);
+ String receiver = backend.isInterceptorClass(cls) ? 'receiver' : 'this';
+ List<String> args = backend.isInterceptedMethod(member) ? ['receiver'] : [];
+ precompiledFunction.add(
+ js('$className.prototype.$getterName = #',
+ js.fun(args, js.return_(js('$receiver.$fieldName')))));
+ if (backend.isNeededForReflection(member)) {
+ precompiledFunction.add(
+ js('$className.prototype.$getterName.${namer.reflectableField} = 1'));
+ }
}
void generateSetter(Element member, String fieldName, String accessorName,
ClassBuilder builder) {
String setterName = namer.setterNameFromAccessorName(accessorName);
- String receiver = backend.isInterceptorClass(member.getEnclosingClass())
- ? 'receiver' : 'this';
- List<String> args = backend.isInterceptedMethod(member)
- ? ['receiver', 'v']
- : ['v'];
- builder.addProperty(setterName,
- js.fun(args, js('$receiver.$fieldName = v')));
- generateReflectionDataForFieldGetterOrSetter(
- member, setterName, builder, isGetter: false);
+ ClassElement cls = member.getEnclosingClass();
+ String className = namer.getNameOfClass(cls);
+ String receiver = backend.isInterceptorClass(cls) ? 'receiver' : 'this';
+ List<String> args =
+ backend.isInterceptedMethod(member) ? ['receiver', 'v'] : ['v'];
+ precompiledFunction.add(
+ js('$className.prototype.$setterName = #',
+ js.fun(args, js.return_(js('$receiver.$fieldName = v')))));
+ if (backend.isNeededForReflection(member)) {
+ precompiledFunction.add(
+ js('$className.prototype.$setterName.${namer.reflectableField} = 1'));
+ }
}
bool canGenerateCheckedSetter(VariableElement field) {
@@ -1761,8 +1797,52 @@
member, setterName, builder, isGetter: false);
}
- void emitClassConstructor(ClassElement classElement, ClassBuilder builder) {
- /* Do nothing. */
+ void emitClassConstructor(ClassElement classElement,
+ ClassBuilder builder,
+ String runtimeName) {
+ List<String> fields = <String>[];
+ if (!classElement.isNative()) {
+ visitFields(classElement, false,
+ (Element member,
+ String name,
+ String accessorName,
+ bool needsGetter,
+ bool needsSetter,
+ bool needsCheckedSetter) {
+ fields.add(name);
+ });
+ }
+ String constructorName = namer.getNameOfClass(classElement);
+ precompiledFunction.add(new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration(constructorName),
+ js.fun(fields, fields.map(
+ (name) => js('this.$name = $name')).toList())));
+ if (runtimeName == null) {
+ runtimeName = constructorName;
+ }
+ precompiledFunction.addAll([
+ js('$constructorName.builtin\$cls = "$runtimeName"'),
+ js.if_('!"name" in $constructorName',
+ js('$constructorName.name = "$constructorName"')),
+ js('\$desc=\$collectedClasses.$constructorName'),
+ js.if_('\$desc instanceof Array', js('\$desc = \$desc[1]')),
+ js('$constructorName.prototype = \$desc'),
+ ]);
+
+ precompiledConstructorNames.add(js(constructorName));
+ }
+
+ jsAst.FunctionDeclaration buildPrecompiledFunction() {
+ // TODO(ahe): Compute a hash code.
+ String name = 'dart_precompiled';
+
+ precompiledFunction.add(
+ js.return_(
+ new jsAst.ArrayInitializer.from(precompiledConstructorNames)));
+ precompiledFunction.insert(0, js(r'var $desc'));
+ return new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration(name),
+ js.fun([r'$collectedClasses'], precompiledFunction));
}
void emitSuper(String superName, ClassBuilder builder) {
@@ -1946,13 +2026,11 @@
assert(!needsSetter);
generateCheckedSetter(member, name, accessorName, builder);
}
- if (!getterAndSetterCanBeImplementedByFieldSpec) {
- if (needsGetter) {
- generateGetter(member, name, accessorName, builder);
- }
- if (needsSetter) {
- generateSetter(member, name, accessorName, builder);
- }
+ if (needsGetter) {
+ generateGetter(member, name, accessorName, builder);
+ }
+ if (needsSetter) {
+ generateSetter(member, name, accessorName, builder);
}
});
});
@@ -1987,7 +2065,7 @@
}
ClassBuilder builder = new ClassBuilder();
- emitClassConstructor(classElement, builder);
+ emitClassConstructor(classElement, builder, runtimeName);
emitSuper(superName, builder);
emitRuntimeName(runtimeName, builder);
emitFields(classElement, builder, superName, onlyForRti: onlyForRti);
@@ -2055,8 +2133,6 @@
}
}
- bool get getterAndSetterCanBeImplementedByFieldSpec => true;
-
/// If this is true then we can generate the noSuchMethod handlers at startup
/// time, instead of them being emitted as part of the Object class.
bool get generateTrivialNsmHandlers => true;
@@ -2473,6 +2549,21 @@
ClassBuilder builder) {
builder.addProperty('',
js.string("$superName;${fieldNames.join(',')}"));
+
+ List<String> fields = fieldNames;
+ String constructorName = mangledName;
+ precompiledFunction.add(new jsAst.FunctionDeclaration(
+ new jsAst.VariableDeclaration(constructorName),
+ js.fun(fields, fields.map(
+ (name) => js('this.$name = $name')).toList())));
+ precompiledFunction.addAll([
+ js('$constructorName.builtin\$cls = "$constructorName"'),
+ js('\$desc=\$collectedClasses.$constructorName'),
+ js.if_('\$desc instanceof Array', js('\$desc = \$desc[1]')),
+ js('$constructorName.prototype = \$desc'),
+ ]);
+
+ precompiledConstructorNames.add(js(constructorName));
}
/**
@@ -2772,14 +2863,10 @@
ConstantHandler handler = compiler.constantHandler;
List<Constant> constants = handler.getConstantsForEmission(
compareConstants);
- bool addedMakeConstantList = false;
for (Constant constant in constants) {
if (isConstantInlinedOrAlreadyEmitted(constant)) continue;
String name = namer.constantName(constant);
- if (!addedMakeConstantList && constant.isList()) {
- addedMakeConstantList = true;
- emitMakeConstantList(eagerBuffer);
- }
+ if (constant.isList()) emitMakeConstantListIfNotEmitted(eagerBuffer);
CodeBuffer buffer = bufferForConstant(constant, eagerBuffer);
jsAst.Expression init = js(
'${namer.globalObjectForConstant(constant)}.$name = #',
@@ -2814,9 +2901,12 @@
return namer.constantName(a).compareTo(namer.constantName(b));
}
- void emitMakeConstantList(CodeBuffer buffer) {
- buffer.write(namer.isolateName);
- buffer.write(r'''.makeConstantList = function(list) {
+ void emitMakeConstantListIfNotEmitted(CodeBuffer buffer) {
+ if (hasMakeConstantList) return;
+ hasMakeConstantList = true;
+ buffer
+ ..write(namer.isolateName)
+ ..write(r'''.makeConstantList = function(list) {
list.immutable$list = true;
list.fixed$length = true;
return list;
@@ -3737,7 +3827,7 @@
buffer.write('];$n');
}
- void emitConvertToFastObjectFunction() {
+ void emitConvertToFastObjectFunction_NO_CSP() {
mainBuffer.add(r'''
function convertToFastObject(properties) {
function makeConstructor() {
@@ -3757,6 +3847,37 @@
''');
}
+ void emitConvertToFastObjectFunction() {
+ // Create an instance that uses 'properties' as prototype. This should make
+ // 'properties' a fast object.
+ mainBuffer.add(r'''function convertToFastObject(properties) {
+ function MyClass() {};
+ MyClass.prototype = properties;
+ new MyClass();
+''');
+ if (DEBUG_FAST_OBJECTS) {
+ ClassElement primitives =
+ compiler.findHelper(const SourceString('Primitives'));
+ FunctionElement printHelper =
+ compiler.lookupElementIn(
+ primitives, const SourceString('printString'));
+ String printHelperName = namer.isolateAccess(printHelper);
+ mainBuffer.add('''
+// The following only works on V8 when run with option "--allow-natives-syntax".
+if (typeof $printHelperName === "function") {
+ $printHelperName("Size of global object: "
+ + String(Object.getOwnPropertyNames(properties).length)
+ + ", fast properties " + %HasFastProperties(properties));
+}
+''');
+ }
+mainBuffer.add(r'''
+ return properties;
+}
+''');
+ }
+
+
String assembleProgram() {
measure(() {
// Compute the required type checks to know which classes need a
@@ -4054,6 +4175,8 @@
}
emitMain(mainBuffer);
+ jsAst.FunctionDeclaration precompiledFunctionAst =
+ buildPrecompiledFunction();
emitInitFunction(mainBuffer);
if (!areAnyElementsDeferred) {
mainBuffer.add('})()$n');
@@ -4061,6 +4184,13 @@
compiler.assembledCode = mainBuffer.getText();
outputSourceMap(mainBuffer, compiler.assembledCode, '');
+ mainBuffer.write(
+ jsAst.prettyPrint(precompiledFunctionAst, compiler).getText());
+
+ compiler.outputProvider('precompiled', 'js')
+ ..add(mainBuffer.getText())
+ ..close();
+
emitDeferredCode();
});
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
deleted file mode 100644
index ae6c90e..0000000
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of js_backend;
-
-class CodeEmitterNoEvalTask extends CodeEmitterTask {
- CodeEmitterNoEvalTask(Compiler compiler,
- Namer namer,
- bool generateSourceMap)
- : super(compiler, namer, generateSourceMap);
-
- bool get getterAndSetterCanBeImplementedByFieldSpec => false;
- bool get generateTrivialNsmHandlers => false;
-
- void emitSuper(String superName, ClassBuilder builder) {
- if (superName != '') {
- builder.addProperty('super', js.string(superName));
- }
- }
-
- void emitRuntimeName(String runtimeName, ClassBuilder builder) {
- if (runtimeName != null) {
- builder.addProperty(r'$name', js.string(runtimeName));
- }
- }
-
- void emitClosureClassHeader(String mangledName,
- String superName,
- List<String> fieldNames,
- ClassBuilder builder) {
- builder.addProperty('', buildConstructor(mangledName, fieldNames));
- emitSuper(superName, builder);
- }
-
-
- bool emitFields(Element element,
- ClassBuilder builder,
- String superName,
- { bool classIsNative: false,
- bool emitStatics: false,
- bool onlyForRti: false }) {
- // Class and library fields are dynamically generated so they have to be
- // emitted using getters and setters instead.
- return false;
- }
-
- void emitClassConstructor(ClassElement classElement, ClassBuilder builder) {
- // Say we have a class A with fields b, c and d, where c needs a getter and
- // d needs both a getter and a setter. Then we produce:
- // - a constructor (directly into the given [buffer]):
- // function A(b, c, d) { this.b = b, this.c = c, this.d = d; }
- // - getters and setters (stored in the [explicitGettersSetters] list):
- // get$c : function() { return this.c; }
- // get$d : function() { return this.d; }
- // set$d : function(x) { this.d = x; }
- List<String> fields = <String>[];
- visitFields(classElement, false,
- (Element member,
- String name,
- String accessorName,
- bool needsGetter,
- bool needsSetter,
- bool needsCheckedSetter) {
- fields.add(name);
- });
- String constructorName =
- // TODO(ahe): Shouldn't this just be 'namer.getName(classElement)'?
- namer.safeName(classElement.name.slowToString().replaceAll('+', '_'));
- if (classElement.isNative()) {
- builder.addProperty('', buildUnusedConstructor(constructorName));
- } else {
- builder.addProperty('', buildConstructor(constructorName, fields));
- }
- }
-
- List get defineClassFunction {
- return [new jsAst.FunctionDeclaration(
- new jsAst.VariableDeclaration('defineClass'),
- js.fun(['name', 'cls', 'constructor', 'prototype'],
- [js(r'constructor.prototype = prototype'),
- js(r'constructor.builtin$cls = name'),
- js.return_('constructor')]))];
- }
-
- List buildProtoSupportCheck() {
- // We don't modify the prototypes in CSP mode. Therefore we can have an
- // easier prototype-check.
- return [js('var $supportsProtoName = !!{}.__proto__')];
- }
-
- jsAst.Expression buildConstructor(String mangledName,
- List<String> fieldNames) {
- return new jsAst.NamedFunction(
- new jsAst.VariableDeclaration(mangledName),
- js.fun(fieldNames, fieldNames.map(
- (name) => js('this.$name = $name')).toList()));
- }
-
- jsAst.Expression buildUnusedConstructor(String mangledName) {
- String message = 'Called unused constructor';
- return new jsAst.NamedFunction(
- new jsAst.VariableDeclaration(mangledName),
- js.fun([], new jsAst.Throw(js.string(message))));
-}
-
- jsAst.FunctionDeclaration get generateAccessorFunction {
- String message =
- 'Internal error: no dynamic generation of accessors allowed.';
- return new jsAst.FunctionDeclaration(
- new jsAst.VariableDeclaration('generateAccessor'),
- js.fun([], new jsAst.Throw(js.string(message))));
- }
-
- jsAst.Expression buildLazyInitializedGetter(VariableElement element) {
- return js.fun([], js.return_(namer.elementAccess(element)));
- }
-
- jsAst.Fun get lazyInitializerFunction {
- // function(prototype, staticName, fieldName,
- // getterName, lazyValue, getter) {
- var parameters = <String>['prototype', 'staticName', 'fieldName',
- 'getterName', 'lazyValue', 'getter'];
- return js.fun(parameters, addLazyInitializerLogic());
- }
-
- jsAst.Fun get finishIsolateConstructorFunction {
- // We replace the old Isolate function with a new one that initializes
- // all its fields with the initial (and often final) value of all globals.
- //
- // We also copy over old values like the prototype, and the
- // isolateProperties themselves.
- return js.fun('oldIsolate', [
- js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'),
- new jsAst.FunctionDeclaration(
- new jsAst.VariableDeclaration('Isolate'),
- js.fun([], [
- js('var hasOwnProperty = Object.prototype.hasOwnProperty'),
- js.forIn('staticName', 'isolateProperties',
- js.if_('hasOwnProperty.call(isolateProperties, staticName)',
- js('this[staticName] = isolateProperties[staticName]'))),
- // Use the newly created object as prototype. In Chrome,
- // this creates a hidden class for the object and makes
- // sure it is fast to access.
- new jsAst.FunctionDeclaration(
- new jsAst.VariableDeclaration('ForceEfficientMap'),
- js.fun([], [])),
- js('ForceEfficientMap.prototype = this'),
- js('new ForceEfficientMap()')])),
- js('Isolate.prototype = oldIsolate.prototype'),
- js('Isolate.prototype.constructor = Isolate'),
- js('Isolate.${namer.isolatePropertiesName} = isolateProperties'),
- js.return_('Isolate')]);
- }
-
- void emitConvertToFastObjectFunction() {
- // Create an instance that uses 'properties' as prototype. This should make
- // 'properties' a fast object.
- mainBuffer.add(r'''function convertToFastObject(properties) {
- function MyClass() {};
- MyClass.prototype = properties;
- new MyClass();
-''');
- if (DEBUG_FAST_OBJECTS) {
- ClassElement primitives =
- compiler.findHelper(const SourceString('Primitives'));
- FunctionElement printHelper =
- compiler.lookupElementIn(
- primitives, const SourceString('printString'));
- String printHelperName = namer.isolateAccess(printHelper);
- mainBuffer.add('''
-// The following only works on V8 when run with option "--allow-natives-syntax".
-if (typeof $printHelperName === "function") {
- $printHelperName("Size of global object: "
- + String(Object.getOwnPropertyNames(properties).length)
- + ", fast properties " + %HasFastProperties(properties));
-}
-''');
- }
-mainBuffer.add(r'''
- return properties;
-}
-''');
- }
-}
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
index 2d9888b..bee8ea9 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
@@ -32,7 +32,6 @@
part 'constant_emitter.dart';
part 'constant_system_javascript.dart';
part 'emitter.dart';
-part 'emitter_no_eval.dart';
part 'minify_namer.dart';
part 'namer.dart';
part 'native_emitter.dart';
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
index 67401f6..1153082 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
@@ -339,7 +339,7 @@
String superName = backend.namer.getNameOfClass(superclass);
ClassBuilder builder = new ClassBuilder();
- emitter.emitClassConstructor(classElement, builder);
+ emitter.emitClassConstructor(classElement, builder, null);
emitter.emitSuper(superName, builder);
bool hasFields = emitter.emitFields(
classElement, builder, superName, classIsNative: true);
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index eb5f588..9cac4af 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -88,7 +88,9 @@
createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
EventSink<String> outputProvider(String name, String extension) {
- if (name != '') throw 'Attempt to output file "$name.$extension"';
+ if (name != '' && name != 'precompiled') {
+ throw 'Attempt to output file "$name.$extension"';
+ }
return new NullSink('$name.$extension');
}
diff --git a/tests/compiler/dart2js/missing_file_test.dart b/tests/compiler/dart2js/missing_file_test.dart
index 06b75dd..3fc09f8 100644
--- a/tests/compiler/dart2js/missing_file_test.dart
+++ b/tests/compiler/dart2js/missing_file_test.dart
@@ -1,78 +1,80 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test that the compiler can handle imports when package root has not been set.
-
-library dart2js.test.missing_file;
-
-import 'package:expect/expect.dart';
-import "package:async_helper/async_helper.dart";
-import 'memory_source_file_helper.dart';
-
-import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
- show NullSink;
-
-import '../../../sdk/lib/_internal/compiler/compiler.dart'
- show DiagnosticHandler, Diagnostic;
-
-import 'dart:async';
-
-import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';
-
-const MEMORY_SOURCE_FILES = const {
- 'main.dart': '''
-
-import 'foo.dart';
-
-main() {}
-''',
-};
-
-void runCompiler(Uri main, String expectedMessage) {
- Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
- Uri libraryRoot = script.resolve('../../../sdk/');
-
- var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
- var handler = new FormattingDiagnosticHandler(provider);
- var errors = [];
-
- void diagnosticHandler(Uri uri, int begin, int end, String message,
- Diagnostic kind) {
- if (kind == Diagnostic.ERROR) {
- errors.add(message);
- }
- handler(uri, begin, end, message, kind);
- }
-
-
- EventSink<String> outputProvider(String name, String extension) {
- if (name != '') throw 'Attempt to output file "$name.$extension"';
- return new NullSink('$name.$extension');
- }
-
- Compiler compiler = new Compiler(provider,
- outputProvider,
- diagnosticHandler,
- libraryRoot,
- null,
- []);
-
- asyncTest(() => compiler.run(main).then((_) {
- Expect.equals(1, errors.length);
- Expect.equals(expectedMessage,
- errors[0]);
- }));
-}
-
-void main() {
- runCompiler(Uri.parse('memory:main.dart'),
- "Error: Can't read 'memory:foo.dart' "
- "(Exception: No such file memory:foo.dart).");
- runCompiler(Uri.parse('memory:foo.dart'),
- "Error: Can't read 'memory:foo.dart' "
- "(Exception: No such file memory:foo.dart).");
- runCompiler(Uri.parse('dart:foo'),
- 'Error: Library not found "dart:foo".');
-}
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that the compiler can handle imports when package root has not been set.
+
+library dart2js.test.missing_file;
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+import 'memory_source_file_helper.dart';
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
+ show NullSink;
+
+import '../../../sdk/lib/_internal/compiler/compiler.dart'
+ show DiagnosticHandler, Diagnostic;
+
+import 'dart:async';
+
+import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
+import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';
+
+const MEMORY_SOURCE_FILES = const {
+ 'main.dart': '''
+
+import 'foo.dart';
+
+main() {}
+''',
+};
+
+void runCompiler(Uri main, String expectedMessage) {
+ Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
+ Uri libraryRoot = script.resolve('../../../sdk/');
+
+ var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
+ var handler = new FormattingDiagnosticHandler(provider);
+ var errors = [];
+
+ void diagnosticHandler(Uri uri, int begin, int end, String message,
+ Diagnostic kind) {
+ if (kind == Diagnostic.ERROR) {
+ errors.add(message);
+ }
+ handler(uri, begin, end, message, kind);
+ }
+
+
+ EventSink<String> outputProvider(String name, String extension) {
+ if (name != '' && name != 'precompiled') {
+ throw 'Attempt to output file "$name.$extension"';
+ }
+ return new NullSink('$name.$extension');
+ }
+
+ Compiler compiler = new Compiler(provider,
+ outputProvider,
+ diagnosticHandler,
+ libraryRoot,
+ null,
+ []);
+
+ asyncTest(() => compiler.run(main).then((_) {
+ Expect.equals(1, errors.length);
+ Expect.equals(expectedMessage,
+ errors[0]);
+ }));
+}
+
+void main() {
+ runCompiler(Uri.parse('memory:main.dart'),
+ "Error: Can't read 'memory:foo.dart' "
+ "(Exception: No such file memory:foo.dart).");
+ runCompiler(Uri.parse('memory:foo.dart'),
+ "Error: Can't read 'memory:foo.dart' "
+ "(Exception: No such file memory:foo.dart).");
+ runCompiler(Uri.parse('dart:foo'),
+ "Error: Library not found 'dart:foo'.");
+}
diff --git a/tests/compiler/dart2js/package_root_test.dart b/tests/compiler/dart2js/package_root_test.dart
index 98b183b..2452389 100644
--- a/tests/compiler/dart2js/package_root_test.dart
+++ b/tests/compiler/dart2js/package_root_test.dart
@@ -48,7 +48,9 @@
EventSink<String> outputProvider(String name, String extension) {
- if (name != '') throw 'Attempt to output file "$name.$extension"';
+ if (name != '' && name != 'precompiled') {
+ throw 'Attempt to output file "$name.$extension"';
+ }
return new NullSink('$name.$extension');
}
diff --git a/tests/compiler/dart2js/unneeded_part_js_test.dart b/tests/compiler/dart2js/unneeded_part_js_test.dart
index c8c0f20..eef894c 100644
--- a/tests/compiler/dart2js/unneeded_part_js_test.dart
+++ b/tests/compiler/dart2js/unneeded_part_js_test.dart
@@ -31,7 +31,9 @@
}
EventSink<String> outputProvider(String name, String extension) {
- if (name != '') throw 'Attempt to output file "$name.$extension"';
+ if (name != '' && name != 'precompiled') {
+ throw 'Attempt to output file "$name.$extension"';
+ }
return new NullSink('$name.$extension');
}
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 4e065b9..1603aa3 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -40,11 +40,5 @@
bailout8_test: Fail, OK # Mismatch in thrown exception.
[ $csp ]
-mirrors_test: Fail # http://dartbug.com/6490
-mirror_printer_test: Fail # http://dartbug.com/6490
-mirror_invalid_field_access_test: Fail # http://dartbug.com/6490
-mirror_invalid_field_access3_test: Fail # http://dartbug.com/6490
deferred/deferred_class_test: Fail # http://dartbug.com/3940
deferred/deferred_constant_test: Fail # http://dartbug.com/3940
-mirror_type_inference_field_test: Fail # http://dartbug.com/6490
-mirror_type_inference_field2_test: Fail # http://dartbug.com/6490
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index a3a9274..b9257d5 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -96,3 +96,6 @@
[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
isolate_stress_test: Skip # Issue 12537
+
+[ $csp ]
+spawn_uri_negative_test: Fail # http://dartbug.com/13454
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 098b947..fe1fd3d 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -48,9 +48,6 @@
[ $runtime == safari ]
mirrors/return_type_test: Pass, Timeout # Issue 12858
-[ $csp ]
-mirrors/*: Skip # Issue 6490
-
[ $compiler == dart2js && $runtime != jsshell && $runtime != safari && $runtime != ff && $runtime != ie9 && $runtime != ie10]
math/math_test: Fail
math/math2_test: Fail
diff --git a/tools/VERSION b/tools/VERSION
index 0263c8c..67cdb56 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 7
BUILD 5
-PATCH 2
+PATCH 3
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 022574d..112bc47 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1026,6 +1026,10 @@
expectedOutput = txtPath;
content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
} else {
+ if (compiler == "dart2js" && configuration["csp"]) {
+ scriptPath = scriptPath.replaceFirst('/test.js', '/precompiled.js');
+ }
+
content = getHtmlContents(filename, scriptType,
new Path("$scriptPath"));
}
@@ -1877,9 +1881,6 @@
configuration["minified"]) {
args.add("--minify");
}
- if (compiler == "dart2js" && configuration["csp"]) {
- args.add("--disallow-unsafe-eval");
- }
if (compiler == "dartanalyzer" || compiler == "dart2analyzer") {
args.add("--show-package-warnings");
}