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

Side by Side Diff: lib/compiler/implementation/js_backend/backend.dart

Issue 10908012: Support checked mode for field setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 typedef void Recompile(Element element); 5 typedef void Recompile(Element element);
6 6
7 class ReturnInfo { 7 class ReturnInfo {
8 HType returnType; 8 HType returnType;
9 List<Element> compiledFunctions; 9 List<Element> compiledFunctions;
10 10
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 */ 537 */
538 HType optimisticReturnTypesWithRecompilationOnTypeChange( 538 HType optimisticReturnTypesWithRecompilationOnTypeChange(
539 FunctionElement caller, FunctionElement callee) { 539 FunctionElement caller, FunctionElement callee) {
540 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType()); 540 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType());
541 ReturnInfo info = returnInfo[callee]; 541 ReturnInfo info = returnInfo[callee];
542 if (info.returnType != HType.UNKNOWN && caller != null) { 542 if (info.returnType != HType.UNKNOWN && caller != null) {
543 info.addCompiledFunction(caller); 543 info.addCompiledFunction(caller);
544 } 544 }
545 return info.returnType; 545 return info.returnType;
546 } 546 }
547
548 SourceString getCheckedModeHelper(Type type) {
549 Element element = type.element;
550 bool nativeCheck =
551 emitter.nativeEmitter.requiresNativeIsCheck(element);
552 if (element == compiler.stringClass) {
553 return const SourceString('stringTypeCheck');
554 } else if (element == compiler.doubleClass) {
555 return const SourceString('doubleTypeCheck');
556 } else if (element == compiler.numClass) {
557 return const SourceString('numTypeCheck');
558 } else if (element == compiler.boolClass) {
559 return const SourceString('boolTypeCheck');
560 } else if (element == compiler.functionClass || element.isTypedef()) {
561 return const SourceString('functionTypeCheck');
562 } else if (element == compiler.intClass) {
563 return const SourceString('intTypeCheck');
564 } else if (Elements.isStringSupertype(element, compiler)) {
565 if (nativeCheck) {
566 return const SourceString('stringSuperNativeTypeCheck');
567 } else {
568 return const SourceString('stringSuperTypeCheck');
569 }
570 } else if (element === compiler.listClass) {
571 return const SourceString('listTypeCheck');
572 } else {
573 if (Elements.isListSupertype(element, compiler)) {
574 if (nativeCheck) {
575 return const SourceString('listSuperNativeTypeCheck');
576 } else {
577 return const SourceString('listSuperTypeCheck');
578 }
579 } else if (nativeCheck) {
580 return const SourceString('callTypeCheck');
581 } else {
582 return const SourceString('propertyTypeCheck');
583 }
584 }
585 }
547 } 586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698