Version 0.6.17.2 .

svn merge -c 26011 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 26014 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 26015 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 26022 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@26023 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index b2325aff..641b009 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -4627,7 +4627,9 @@
   virtual bool AllowsCSE() const { return true; }
   virtual EffectSet Effects() const { return EffectSet::None(); }
   virtual EffectSet Dependencies() const { return EffectSet::None(); }
-  virtual bool AttributesEqual(Instruction* other) const { return true; }
+  virtual bool AttributesEqual(Instruction* other) const {
+    return kind() == other->AsMathUnary()->kind();
+  }
 
   virtual bool MayThrow() const { return false; }
 
diff --git a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
index 12389ee..747f072 100644
--- a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
@@ -975,17 +975,9 @@
       List<LocalsHandler<T>> localsToMerge = <LocalsHandler<T>>[];
 
       for (SwitchCase switchCase in node.cases) {
-        if (switchCase.isDefaultCase) {
-          // If there is a default case, the current values of the local
-          // variable might be overwritten, so we don't need the current
-          // [locals] for the join block.
-          locals = saved;
-          visit(switchCase);
-        } else {
-          locals = new LocalsHandler<T>.from(saved, switchCase);
-          visit(switchCase);
-          localsToMerge.add(locals);
-        }
+        locals = new LocalsHandler<T>.from(saved, switchCase);
+        visit(switchCase);
+        localsToMerge.add(locals);
       }
       saved.mergeAll(localsToMerge);
       locals = saved;
diff --git a/tests/compiler/dart2js_extra/12320_test.dart b/tests/compiler/dart2js_extra/12320_test.dart
new file mode 100644
index 0000000..60317f9
--- /dev/null
+++ b/tests/compiler/dart2js_extra/12320_test.dart
@@ -0,0 +1,49 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+// Regression test for Issue 12320, Issue 12363.
+
+String log = '';
+int x;
+
+void main() {
+  (run)(run);
+  // The little dance with passing [run] as an argument to confuse the optimizer
+  // so that [run] is not inlined.  If [run] is inlined, the bug (Issue 12320)
+  // eliminates the following 'Expect', making the test appear to pass!
+  Expect.equals('[Foo][Foo 1][Bar][Foo][Foo 0]', log);
+}
+
+void run(f) {
+  if (f is !int) {
+    f(1);
+  } else {
+    x = f;
+    callFoo();
+    x = 2;
+    callBar();
+    callFoo();
+  }
+}
+
+void callFoo() {
+  log += '[Foo]';
+  switch(x) {
+    case 0:
+      log += '[Foo 0]';
+      break;
+    case 1:
+      log += '[Foo 1]';
+      break;
+    default:
+      throw 'invalid x';
+  }
+}
+
+void callBar() {
+  log += '[Bar]';
+  x = 0;
+}
diff --git a/tests/language/math_vm_test.dart b/tests/language/math_vm_test.dart
index ad71888..e672e9c 100644
--- a/tests/language/math_vm_test.dart
+++ b/tests/language/math_vm_test.dart
@@ -44,9 +44,19 @@
 }
 
 
+testSinCos(a) {
+  double sVal = sin(a);
+  double cVal = cos(a);
+  return sVal + cVal;
+}
+
 main() {
+  const double value = 1.54;
+  final firstRes = testSinCos(value);
   for (int i = 0; i < 200; i++) {
     MathTest.testMain();
     testDoublePow();
+    testSinCos(value);
   }
+  Expect.equals(firstRes, testSinCos(value));
 }
diff --git a/tools/VERSION b/tools/VERSION
index fd7ea6c..71aed00 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
 MAJOR 0
 MINOR 6
 BUILD 17
-PATCH 1
+PATCH 2