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

Side by Side Diff: tests/language/arithmetic_test.dart

Issue 11880048: Fix crash bug when deoptimizing from an optimized sqrt operation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Dart test program to test arithmetic operations. 4 // Dart test program to test arithmetic operations.
5 5
6 library arithmetic_test; 6 library arithmetic_test;
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 class ArithmeticTest { 9 class ArithmeticTest {
10 10
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 413
414 static int div(a, b) => a ~/ b; 414 static int div(a, b) => a ~/ b;
415 415
416 static void testSmiDivDeopt() { 416 static void testSmiDivDeopt() {
417 var a = -0x40000000; 417 var a = -0x40000000;
418 var b = -1; 418 var b = -1;
419 for (var i = 0; i < 10; i++) Expect.equals(0x40000000, div(a, b)); 419 for (var i = 0; i < 10; i++) Expect.equals(0x40000000, div(a, b));
420 } 420 }
421 421
422 static mySqrt(var x) => sqrt(x);
423
424 static testSqrtDeopt() {
425 for (var i = 0; i < 10; i++) mySqrt(4.0);
426 Expect.equals(2.0, mySqrt(4.0));
427 Expect.throws(() => mySqrt("abc"));
428 }
429
422 static testMain() { 430 static testMain() {
423 for (int i = 0; i < 1500; i++) { 431 for (int i = 0; i < 1500; i++) {
424 runOne(); 432 runOne();
425 testSmiDivDeopt(); 433 testSmiDivDeopt();
434 testSqrtDeopt();
426 } 435 }
427 } 436 }
428 } 437 }
429 438
430 main() { 439 main() {
431 ArithmeticTest.testMain(); 440 ArithmeticTest.testMain();
432 } 441 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698