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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 v8::Isolate* isolate = v8::Isolate::New(create_params); | 1215 v8::Isolate* isolate = v8::Isolate::New(create_params); |
1216 isolate->Enter(); | 1216 isolate->Enter(); |
1217 | 1217 |
1218 { | 1218 { |
1219 // 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 |
1220 // 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 |
1221 // 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 |
1222 // summing the lengths of the strings (as Smis) overflows and wraps. | 1222 // summing the lengths of the strings (as Smis) overflows and wraps. |
1223 LocalContext context(isolate); | 1223 LocalContext context(isolate); |
1224 v8::HandleScope scope(isolate); | 1224 v8::HandleScope scope(isolate); |
1225 v8::TryCatch try_catch; | 1225 v8::TryCatch try_catch(isolate); |
1226 CHECK(CompileRun( | 1226 CHECK(CompileRun( |
1227 "var two_14 = Math.pow(2, 14);" | 1227 "var two_14 = Math.pow(2, 14);" |
1228 "var two_17 = Math.pow(2, 17);" | 1228 "var two_17 = Math.pow(2, 17);" |
1229 "var s = Array(two_17 + 1).join('c');" | 1229 "var s = Array(two_17 + 1).join('c');" |
1230 "var a = ['bad'];" | 1230 "var a = ['bad'];" |
1231 "for (var i = 1; i <= two_14; i++) a.push(s);" | 1231 "for (var i = 1; i <= two_14; i++) a.push(s);" |
1232 "a.join(" | 1232 "a.join(" |
1233 ");").IsEmpty()); | 1233 ");").IsEmpty()); |
1234 CHECK(try_catch.HasCaught()); | 1234 CHECK(try_catch.HasCaught()); |
1235 } | 1235 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); | 1471 Handle<String> arg0 = isolate->factory()->NewStringFromAsciiChecked("arg0"); |
1472 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); | 1472 Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1"); |
1473 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); | 1473 Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2"); |
1474 Handle<String> result = | 1474 Handle<String> result = |
1475 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, | 1475 MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction, |
1476 arg0, arg1, arg2).ToHandleChecked(); | 1476 arg0, arg1, arg2).ToHandleChecked(); |
1477 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( | 1477 Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked( |
1478 "Property 'arg0' of object arg1 is not a function"); | 1478 "Property 'arg0' of object arg1 is not a function"); |
1479 CHECK(String::Equals(result, expected)); | 1479 CHECK(String::Equals(result, expected)); |
1480 } | 1480 } |
OLD | NEW |