Index: test/mjsunit/regress/regress-crbug-229923.js |
diff --git a/test/cctest/test-platform.cc b/test/mjsunit/regress/regress-crbug-229923.js |
similarity index 73% |
copy from test/cctest/test-platform.cc |
copy to test/mjsunit/regress/regress-crbug-229923.js |
index 6c20b853c5e7408b1877ee74617c01c3fc32ed5f..95c0dedefd6f3ef945aeb30226f5c74c91c3f135 100644 |
--- a/test/cctest/test-platform.cc |
+++ b/test/mjsunit/regress/regress-crbug-229923.js |
@@ -25,13 +25,17 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#include <stdlib.h> |
+// Flags: --expose-externalize-string |
-#include "cctest.h" |
-#include "platform.h" |
+var slice = "slow path of JSON.stringify for sliced string".substring(1); |
+assertEquals('"' + slice + '"', JSON.stringify(slice, null, 0)); |
-using namespace ::v8::internal; |
- |
-TEST(NumberOfCores) { |
- CHECK_GT(OS::NumberOfCores(), 0); |
-} |
+var parent = "external string turned into two byte"; |
+var slice_of_external = parent.substring(1); |
+try { |
+ // Turn the string to a two-byte external string, so that the sliced |
+ // string looks like one-byte, but its parent is actually two-byte. |
+ externalizeString(parent, true); |
+} catch (e) { } |
+assertEquals('"' + slice_of_external + '"', |
+ JSON.stringify(slice_of_external, null, 0)); |