| OLD | NEW |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES); | 48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES); |
| 49 jsAst.Expression mangledNamesAccess = | 49 jsAst.Expression mangledNamesAccess = |
| 50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES); | 50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES); |
| 51 jsAst.Expression librariesAccess = | 51 jsAst.Expression librariesAccess = |
| 52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES); | 52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES); |
| 53 jsAst.Expression typesAccess = | 53 jsAst.Expression typesAccess = |
| 54 emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPES); | 54 emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPES); |
| 55 | 55 |
| 56 jsAst.Statement processClassData = js.statement('''{ | 56 jsAst.Statement processClassData = js.statement('''{ |
| 57 function processClassData(cls, descriptor, processedClasses) { | 57 function processClassData(cls, descriptor, processedClasses) { |
| 58 var newDesc = map(); // Use a slow object. | 58 var newDesc = {}; |
| 59 newDesc.x = 0; delete newDesc.x; // Make object slow. |
| 59 var previousProperty; | 60 var previousProperty; |
| 60 var properties = Object.keys(descriptor); | 61 var properties = Object.keys(descriptor); |
| 61 for (var i = 0; i < properties.length; i++) { | 62 for (var i = 0; i < properties.length; i++) { |
| 62 var property = properties[i]; | 63 var property = properties[i]; |
| 63 var firstChar = property.substring(0, 1); | 64 var firstChar = property.substring(0, 1); |
| 64 if (property === "static") { | 65 if (property === "static") { |
| 65 processStatics(#embeddedStatics[cls] = descriptor[property], | 66 processStatics(#embeddedStatics[cls] = descriptor[property], |
| 66 processedClasses); | 67 processedClasses); |
| 67 } else if (firstChar === "+") { | 68 } else if (firstChar === "+") { |
| 68 mangledNames[previousProperty] = property.substring(1); | 69 mangledNames[previousProperty] = property.substring(1); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 (function() { | 485 (function() { |
| 485 var result = $array[$index]; | 486 var result = $array[$index]; |
| 486 if ($check) { | 487 if ($check) { |
| 487 throw new Error( | 488 throw new Error( |
| 488 name + ": expected value of type \'$type\' at index " + ($index) + | 489 name + ": expected value of type \'$type\' at index " + ($index) + |
| 489 " but got " + (typeof result)); | 490 " but got " + (typeof result)); |
| 490 } | 491 } |
| 491 return result; | 492 return result; |
| 492 })()'''; | 493 })()'''; |
| 493 } | 494 } |
| OLD | NEW |