| Index: tests/corelib/regexp/regress-regexp-codeflush_test.dart
|
| diff --git a/runtime/third_party/double-conversion/src/diy-fp.cc b/tests/corelib/regexp/regress-regexp-codeflush_test.dart
|
| similarity index 60%
|
| copy from runtime/third_party/double-conversion/src/diy-fp.cc
|
| copy to tests/corelib/regexp/regress-regexp-codeflush_test.dart
|
| index ddd1891b168ada0b67b3d124ff3c63b352d7fda6..23a4954a16683693f4e04bbd57e17208c02036aa 100644
|
| --- a/runtime/third_party/double-conversion/src/diy-fp.cc
|
| +++ b/tests/corelib/regexp/regress-regexp-codeflush_test.dart
|
| @@ -1,4 +1,5 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright (c) 2014, the Dart project authors. All rights reserved.
|
| +// Copyright 2011 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -25,33 +26,36 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +import 'v8_regexp_utils.dart';
|
| +import 'package:expect/expect.dart';
|
|
|
| -#include "diy-fp.h"
|
| -#include "utils.h"
|
| +void main() {
|
| + // Flags: --gc_global
|
|
|
| -namespace double_conversion {
|
| + // Regression test for regexp that has multiple matches and which
|
| + // internally calls RegExpImpl::IrregexpExecOnce more than once without
|
| + // ensuring that the regexp is compiled.
|
| + // This can create a crash if the code was exchanged with the sweep
|
| + // generation (for code flushing support) in GC durring the matching.
|
|
|
| -void DiyFp::Multiply(const DiyFp& other) {
|
| - // Simply "emulates" a 128 bit multiplication.
|
| - // However: the resulting number only contains 64 bits. The least
|
| - // significant 64 bits are only used for rounding the most significant 64
|
| - // bits.
|
| - const uint64_t kM32 = 0xFFFFFFFFU;
|
| - uint64_t a = f_ >> 32;
|
| - uint64_t b = f_ & kM32;
|
| - uint64_t c = other.f_ >> 32;
|
| - uint64_t d = other.f_ & kM32;
|
| - uint64_t ac = a * c;
|
| - uint64_t bc = b * c;
|
| - uint64_t ad = a * d;
|
| - uint64_t bd = b * d;
|
| - uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
|
| - // By adding 1U << 31 to tmp we round the final result.
|
| - // Halfway cases will be round up.
|
| - tmp += 1U << 31;
|
| - uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
|
| - e_ += other.e_ + 64;
|
| - f_ = result_f;
|
| -}
|
| + var re = new RegExp('(s)');
|
| +
|
| + dynamic foo(Match m) {
|
| + return "42";
|
| + }
|
|
|
| -} // namespace double_conversion
|
| + // Run enough times to get a number of GC's (all mark sweep because of the
|
| + // --gc_global) flag.
|
| + for ( var i = 0; i < 10; i++) {
|
| + // Make a long string with plenty of matches for re.
|
| + var x = "s foo s bar s foo s bar s";
|
| + x = x + x;
|
| + x = x + x;
|
| + x = x + x;
|
| + x = x + x;
|
| + x = x + x;
|
| + x = x + x;
|
| + x = x + x;
|
| + x.replaceAllMapped(re, foo);
|
| + }
|
| +}
|
|
|