| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 381 |
| 382 | 382 |
| 383 TEST(PreParseOverflow) { | 383 TEST(PreParseOverflow) { |
| 384 v8::V8::Initialize(); | 384 v8::V8::Initialize(); |
| 385 | 385 |
| 386 int marker; | 386 int marker; |
| 387 i::Isolate::Current()->stack_guard()->SetStackLimit( | 387 i::Isolate::Current()->stack_guard()->SetStackLimit( |
| 388 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); | 388 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); |
| 389 | 389 |
| 390 size_t kProgramSize = 1024 * 1024; | 390 size_t kProgramSize = 1024 * 1024; |
| 391 i::SmartArrayPointer<char> program( | 391 i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1)); |
| 392 reinterpret_cast<char*>(malloc(kProgramSize + 1))); | |
| 393 memset(*program, '(', kProgramSize); | 392 memset(*program, '(', kProgramSize); |
| 394 program[kProgramSize] = '\0'; | 393 program[kProgramSize] = '\0'; |
| 395 | 394 |
| 396 uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit(); | 395 uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit(); |
| 397 | 396 |
| 398 i::Utf8ToUtf16CharacterStream stream( | 397 i::Utf8ToUtf16CharacterStream stream( |
| 399 reinterpret_cast<const i::byte*>(*program), | 398 reinterpret_cast<const i::byte*>(*program), |
| 400 static_cast<unsigned>(kProgramSize)); | 399 static_cast<unsigned>(kProgramSize)); |
| 401 i::CompleteParserRecorder log; | 400 i::CompleteParserRecorder log; |
| 402 i::Scanner scanner(i::Isolate::Current()->unicode_cache()); | 401 i::Scanner scanner(i::Isolate::Current()->unicode_cache()); |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 " b = function() { \n" | 1297 " b = function() { \n" |
| 1299 " 01; \n" | 1298 " 01; \n" |
| 1300 " }; \n" | 1299 " }; \n" |
| 1301 "}; \n"; | 1300 "}; \n"; |
| 1302 v8::Script::Compile(v8::String::New(script)); | 1301 v8::Script::Compile(v8::String::New(script)); |
| 1303 CHECK(try_catch.HasCaught()); | 1302 CHECK(try_catch.HasCaught()); |
| 1304 v8::String::Utf8Value exception(try_catch.Exception()); | 1303 v8::String::Utf8Value exception(try_catch.Exception()); |
| 1305 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1304 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
| 1306 *exception); | 1305 *exception); |
| 1307 } | 1306 } |
| OLD | NEW |