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

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 SourceString helper;
kasperl 2012/08/30 14:36:08 Wouldn't it be simpler just to return instead of a
ngeoffray 2012/08/30 17:10:21 Done.
553 if (element == compiler.stringClass) {
554 helper = const SourceString('stringTypeCheck');
555 } else if (element == compiler.doubleClass) {
556 helper = const SourceString('doubleTypeCheck');
557 } else if (element == compiler.numClass) {
558 helper = const SourceString('numTypeCheck');
559 } else if (element == compiler.boolClass) {
560 helper = const SourceString('boolTypeCheck');
561 } else if (element == compiler.functionClass || element.isTypedef()) {
562 helper = const SourceString('functionTypeCheck');
563 } else if (element == compiler.intClass) {
564 helper = const SourceString('intTypeCheck');
565 } else if (Elements.isStringSupertype(element, compiler)) {
566 if (nativeCheck) {
567 helper = const SourceString('stringSuperNativeTypeCheck');
568 } else {
569 helper = const SourceString('stringSuperTypeCheck');
570 }
571 } else if (element === compiler.listClass) {
572 helper = const SourceString('listTypeCheck');
573 } else {
574 if (Elements.isListSupertype(element, compiler)) {
575 if (nativeCheck) {
576 helper = const SourceString('listSuperNativeTypeCheck');
577 } else {
578 helper = const SourceString('listSuperTypeCheck');
579 }
580 } else if (nativeCheck) {
581 helper = const SourceString('callTypeCheck');
582 } else {
583 helper = const SourceString('propertyTypeCheck');
584 }
585 }
586 return helper;
587 }
547 } 588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698