OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); | 1204 CHECK(SlicedString::cast(*string)->parent()->IsSeqString()); |
1205 CHECK_EQ(0, strcmp("cdefghijklmnopqrstuvwx", string->ToCString().get())); | 1205 CHECK_EQ(0, strcmp("cdefghijklmnopqrstuvwx", string->ToCString().get())); |
1206 } | 1206 } |
1207 | 1207 |
1208 | 1208 |
1209 UNINITIALIZED_TEST(OneByteArrayJoin) { | 1209 UNINITIALIZED_TEST(OneByteArrayJoin) { |
1210 v8::Isolate::CreateParams create_params; | 1210 v8::Isolate::CreateParams create_params; |
1211 // Set heap limits. | 1211 // Set heap limits. |
1212 create_params.constraints.set_max_semi_space_size(1); | 1212 create_params.constraints.set_max_semi_space_size(1); |
1213 create_params.constraints.set_max_old_space_size(6); | 1213 create_params.constraints.set_max_old_space_size(6); |
| 1214 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
1214 v8::Isolate* isolate = v8::Isolate::New(create_params); | 1215 v8::Isolate* isolate = v8::Isolate::New(create_params); |
1215 isolate->Enter(); | 1216 isolate->Enter(); |
1216 | 1217 |
1217 { | 1218 { |
1218 // String s is made of 2^17 = 131072 'c' characters and a is an array | 1219 // String s is made of 2^17 = 131072 'c' characters and a is an array |
1219 // starting with 'bad', followed by 2^14 times the string s. That means the | 1220 // starting with 'bad', followed by 2^14 times the string s. That means the |
1220 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems | 1221 // total length of the concatenated strings is 2^31 + 3. So on 32bit systems |
1221 // summing the lengths of the strings (as Smis) overflows and wraps. | 1222 // summing the lengths of the strings (as Smis) overflows and wraps. |
1222 LocalContext context(isolate); | 1223 LocalContext context(isolate); |
1223 v8::HandleScope scope(isolate); | 1224 v8::HandleScope scope(isolate); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); | 1471 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); |
1471 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); | 1472 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); |
1472 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); | 1473 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); |
1473 Handle<String> result = | 1474 Handle<String> result = |
1474 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, | 1475 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, |
1475 arg0, arg1, arg2).ToHandleChecked(); | 1476 arg0, arg1, arg2).ToHandleChecked(); |
1476 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( | 1477 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( |
1477 "Property 'arg0' of object arg1 is not a function"); | 1478 "Property 'arg0' of object arg1 is not a function"); |
1478 CHECK(String::Equals(result, expected)); | 1479 CHECK(String::Equals(result, expected)); |
1479 } | 1480 } |
OLD | NEW |