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

Side by Side Diff: lib/runtime/dart/_js_helper.js

Issue 1039243002: fix temp used in postfix ops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 let positions = dart.map(); 1667 let positions = dart.map();
1668 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) { 1668 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
1669 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i ); 1669 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
1670 positions.set(this.parameterName(index), index); 1670 positions.set(this.parameterName(index), index);
1671 } 1671 }
1672 let index = 0; 1672 let index = 0;
1673 ((_$) => { 1673 ((_$) => {
1674 _$.sort(); 1674 _$.sort();
1675 return _$; 1675 return _$;
1676 }).bind(this)(positions.keys.toList()).forEach(((name) => { 1676 }).bind(this)(positions.keys.toList()).forEach(((name) => {
1677 this.cachedSortedIndices.set(((x) => index = dart.notNull(x$) + 1, x$) (index), positions.get(name)); 1677 this.cachedSortedIndices.set(((x$) => index = dart.notNull(x$) + 1, x$ )(index), positions.get(name));
1678 }).bind(this)); 1678 }).bind(this));
1679 } 1679 }
1680 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); 1680 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int);
1681 } 1681 }
1682 computeFunctionRti(jsConstructor) { 1682 computeFunctionRti(jsConstructor) {
1683 if (typeof this.functionType == "number") { 1683 if (typeof this.functionType == "number") {
1684 return getMetadata(dart.as(this.functionType, core.int)); 1684 return getMetadata(dart.as(this.functionType, core.int));
1685 } else if (typeof this.functionType == "function") { 1685 } else if (typeof this.functionType == "function") {
1686 let fakeInstance = new jsConstructor(); 1686 let fakeInstance = new jsConstructor();
1687 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); 1687 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 return dart.as(dart.dload(object, 'hashCode'), core.int); 2511 return dart.as(dart.dload(object, 'hashCode'), core.int);
2512 } else { 2512 } else {
2513 return Primitives.objectHashCode(object); 2513 return Primitives.objectHashCode(object);
2514 } 2514 }
2515 } 2515 }
2516 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic 2516 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
2517 function fillLiteralMap(keyValuePairs, result) { 2517 function fillLiteralMap(keyValuePairs, result) {
2518 let index = 0; 2518 let index = 0;
2519 let length = getLength(keyValuePairs); 2519 let length = getLength(keyValuePairs);
2520 while (dart.notNull(index) < dart.notNull(length)) { 2520 while (dart.notNull(index) < dart.notNull(length)) {
2521 let key = getIndex(keyValuePairs, ((x) => index = dart.notNull(x$) + 1, x$ )(index)); 2521 let key = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x $)(index));
2522 let value = getIndex(keyValuePairs, ((x) => index = dart.notNull(x$) + 1, x$)(index)); 2522 let value = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x$)(index));
2523 result.set(key, value); 2523 result.set(key, value);
2524 } 2524 }
2525 return result; 2525 return result;
2526 } 2526 }
2527 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 2527 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2528 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 2528 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2529 if (numberOfArguments === 0) { 2529 if (numberOfArguments === 0) {
2530 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 2530 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
2531 } else if (numberOfArguments === 1) { 2531 } else if (numberOfArguments === 1) {
2532 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 2532 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 let callName = dart.as(func.$callName, core.String); 2568 let callName = dart.as(func.$callName, core.String);
2569 func.$reflectionInfo = reflectionInfo; 2569 func.$reflectionInfo = reflectionInfo;
2570 let info = new ReflectionInfo(func); 2570 let info = new ReflectionInfo(func);
2571 let functionType = info.functionType; 2571 let functionType = info.functionType;
2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2573 prototype.$initialize = prototype.constructor; 2573 prototype.$initialize = prototype.constructor;
2574 let constructor = isStatic ? function() { 2574 let constructor = isStatic ? function() {
2575 this.$initialize(); 2575 this.$initialize();
2576 } : isCsp ? function(a, b, c, d) { 2576 } : isCsp ? function(a, b, c, d) {
2577 this.$initialize(a, b, c, d); 2577 this.$initialize(a, b, c, d);
2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x) = > functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)); 2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x$) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter));
2579 prototype.constructor = constructor; 2579 prototype.constructor = constructor;
2580 constructor.prototype = prototype; 2580 constructor.prototype = prototype;
2581 let trampoline = func; 2581 let trampoline = func;
2582 let isIntercepted = false; 2582 let isIntercepted = false;
2583 if (!dart.notNull(isStatic)) { 2583 if (!dart.notNull(isStatic)) {
2584 if (jsArguments.length == 1) { 2584 if (jsArguments.length == 1) {
2585 isIntercepted = true; 2585 isIntercepted = true;
2586 } 2586 }
2587 trampoline = forwardCallTo(receiver, func, isIntercepted); 2587 trampoline = forwardCallTo(receiver, func, isIntercepted);
2588 trampoline.$reflectionInfo = reflectionInfo; 2588 trampoline.$reflectionInfo = reflectionInfo;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 if (isIntercepted) 2675 if (isIntercepted)
2676 return forwardInterceptedCallTo(receiver, func); 2676 return forwardInterceptedCallTo(receiver, func);
2677 let stubName = dart.as(func.$stubName, core.String); 2677 let stubName = dart.as(func.$stubName, core.String);
2678 let arity = func.length; 2678 let arity = func.length;
2679 let lookedUpFunction = receiver[stubName]; 2679 let lookedUpFunction = receiver[stubName];
2680 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2680 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) { 2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) {
2682 return cspForwardCall(arity, isSuperCall, stubName, func); 2682 return cspForwardCall(arity, isSuperCall, stubName, func);
2683 } 2683 }
2684 if (arity === 0) { 2684 if (arity === 0) {
2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x$) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2686 } 2686 }
2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(","); 2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(",");
2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${((x) => functionCount er = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${((x$) => functionCoun ter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2690 } 2690 }
2691 static cspForwardInterceptedCall(arity, isSuperCall, name, func) { 2691 static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2694 if (isSuperCall) 2694 if (isSuperCall)
2695 arity = -1; 2695 arity = -1;
2696 switch (arity) { 2696 switch (arity) {
2697 case 0: 2697 case 0:
2698 throw new RuntimeError('Intercepted function with no arguments.'); 2698 throw new RuntimeError('Intercepted function with no arguments.');
2699 case 1: 2699 case 1:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 let receiverField = BoundClosure.receiverFieldName(); 2747 let receiverField = BoundClosure.receiverFieldName();
2748 let stubName = dart.as(func.$stubName, core.String); 2748 let stubName = dart.as(func.$stubName, core.String);
2749 let arity = func.length; 2749 let arity = func.length;
2750 let isCsp = typeof dart_precompiled == "function"; 2750 let isCsp = typeof dart_precompiled == "function";
2751 let lookedUpFunction = receiver[stubName]; 2751 let lookedUpFunction = receiver[stubName];
2752 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2752 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, func); 2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, func);
2755 } 2755 }
2756 if (arity === 1) { 2756 if (arity === 1) {
2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x) => functionCounter = dart.notNull(x$ ) + 1, x$)(functionCounter)}` + '}')(); 2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x$) => functionCounter = dart.notNull(x $) + 1, x$)(functionCounter)}` + '}')();
2758 } 2758 }
2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(","); 2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(",");
2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${((x) => functionC ounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${((x$) => function Counter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2762 } 2762 }
2763 toString() { 2763 toString() {
2764 return "Closure"; 2764 return "Closure";
2765 } 2765 }
2766 } 2766 }
2767 Closure.FUNCTION_INDEX = 0; 2767 Closure.FUNCTION_INDEX = 0;
2768 Closure.NAME_INDEX = 1; 2768 Closure.NAME_INDEX = 1;
2769 Closure.CALL_NAME_INDEX = 2; 2769 Closure.CALL_NAME_INDEX = 2;
2770 Closure.REQUIRED_PARAMETER_INDEX = 3; 2770 Closure.REQUIRED_PARAMETER_INDEX = 3;
2771 Closure.OPTIONAL_PARAMETER_INDEX = 4; 2771 Closure.OPTIONAL_PARAMETER_INDEX = 4;
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; 3950 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
3951 exports.random64 = random64; 3951 exports.random64 = random64;
3952 exports.jsonEncodeNative = jsonEncodeNative; 3952 exports.jsonEncodeNative = jsonEncodeNative;
3953 exports.getIsolateAffinityTag = getIsolateAffinityTag; 3953 exports.getIsolateAffinityTag = getIsolateAffinityTag;
3954 exports.loadDeferredLibrary = loadDeferredLibrary; 3954 exports.loadDeferredLibrary = loadDeferredLibrary;
3955 exports.MainError = MainError; 3955 exports.MainError = MainError;
3956 exports.missingMain = missingMain; 3956 exports.missingMain = missingMain;
3957 exports.badMain = badMain; 3957 exports.badMain = badMain;
3958 exports.mainHasTooManyParameters = mainHasTooManyParameters; 3958 exports.mainHasTooManyParameters = mainHasTooManyParameters;
3959 })(_js_helper || (_js_helper = {})); 3959 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698