Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: test/cctest/test-parsing.cc

Issue 368053002: Stack overflow checkers are now compatible with ASAN's detect_stack_use_after_return mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 47f5e6abecef02c5ae37e43f3249c61e781570be..b12098a85a19e5352471686389ca8387a1789031 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -143,9 +143,8 @@ TEST(ScanHTMLEndComments) {
};
// Parser/Scanner needs a stack limit.
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit();
for (int i = 0; tests[i]; i++) {
const i::byte* source =
@@ -199,9 +198,8 @@ TEST(UsingCachedData) {
v8::HandleScope handles(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
// Source containing functions that might be lazily compiled and all types
// of symbols (string, propertyName, regexp).
@@ -247,9 +245,8 @@ TEST(PreparseFunctionDataIsUsed) {
v8::HandleScope handles(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
const char* good_code =
"function this_is_lazy() { var a; } function foo() { return 25; } foo();";
@@ -282,9 +279,8 @@ TEST(PreparseFunctionDataIsUsed) {
TEST(StandAlonePreParser) {
v8::V8::Initialize();
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
const char* programs[] = {
"{label: 42}",
@@ -319,9 +315,8 @@ TEST(StandAlonePreParser) {
TEST(StandAlonePreParserNoNatives) {
v8::V8::Initialize();
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
const char* programs[] = {
"%ArgleBargle(glop);",
@@ -358,9 +353,8 @@ TEST(PreparsingObjectLiterals) {
v8::HandleScope handles(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
{
const char* source = "var myo = {if: \"foo\"}; myo.if;";
@@ -392,9 +386,7 @@ TEST(RegressChromium62639) {
v8::V8::Initialize();
i::Isolate* isolate = CcTest::i_isolate();
- int marker;
- isolate->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024);
const char* program = "var x = 'something';\n"
"escape: function() {}";
@@ -429,9 +421,7 @@ TEST(Regress928) {
// as with-content, which made it assume that a function inside
// the block could be lazily compiled, and an extra, unexpected,
// entry was added to the data.
- int marker;
- isolate->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024);
const char* program =
"try { } catch (e) { var foo = function () { /* first */ } }"
@@ -473,9 +463,8 @@ TEST(Regress928) {
TEST(PreParseOverflow) {
v8::V8::Initialize();
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
size_t kProgramSize = 1024 * 1024;
i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1));
@@ -1097,9 +1086,7 @@ TEST(ScopePositions) {
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
- int marker;
- isolate->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 128 * 1024);
for (int i = 0; source_data[i].outer_prefix; i++) {
int kPrefixLen = Utf8LengthHelper(source_data[i].outer_prefix);
@@ -1400,9 +1387,8 @@ TEST(ParserSync) {
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
static const ParserFlag flags1[] = {
kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
@@ -1478,9 +1464,8 @@ void RunParserSyncTest(const char* context_data[][2],
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
static const ParserFlag default_flags[] = {
kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
@@ -2153,9 +2138,8 @@ TEST(DontRegressPreParserDataSizes) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handles(isolate);
- int marker;
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
+ CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
+ 128 * 1024);
struct TestCase {
const char* program;
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698