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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 172753002: Re-enable Parser::symbol_cache_ (after a long time!) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: adding safeguards Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/cctest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 preparser.set_allow_lazy(true); 317 preparser.set_allow_lazy(true);
318 i::PreParser::PreParseResult result = preparser.PreParseProgram(); 318 i::PreParser::PreParseResult result = preparser.PreParseProgram();
319 CHECK_EQ(i::PreParser::kPreParseSuccess, result); 319 CHECK_EQ(i::PreParser::kPreParseSuccess, result);
320 i::ScriptDataImpl data(log.ExtractData()); 320 i::ScriptDataImpl data(log.ExtractData());
321 // Data contains syntax error. 321 // Data contains syntax error.
322 CHECK(data.has_error()); 322 CHECK(data.has_error());
323 } 323 }
324 } 324 }
325 325
326 326
327 TEST(PreparsingObjectLiterals) {
328 // Regression test for a bug where the symbol stream produced by PreParser
329 // didn't match what Parser wanted to consume.
330 v8::Isolate* isolate = CcTest::isolate();
331 v8::HandleScope handles(isolate);
332 v8::Local<v8::Context> context = v8::Context::New(isolate);
333 v8::Context::Scope context_scope(context);
334 int marker;
335 CcTest::i_isolate()->stack_guard()->SetStackLimit(
336 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
337
338 {
339 const char* source = "var myo = {if: \"foo\"}; myo.if;";
340 v8::Local<v8::Value> result = PreCompileCompileRun(source);
341 CHECK(result->IsString());
342 v8::String::Utf8Value utf8(result);
343 CHECK_EQ("foo", *utf8);
344 }
345
346 {
347 const char* source = "var myo = {\"bar\": \"foo\"}; myo[\"bar\"];";
348 v8::Local<v8::Value> result = PreCompileCompileRun(source);
349 CHECK(result->IsString());
350 v8::String::Utf8Value utf8(result);
351 CHECK_EQ("foo", *utf8);
352 }
353
354 {
355 const char* source = "var myo = {1: \"foo\"}; myo[1];";
356 v8::Local<v8::Value> result = PreCompileCompileRun(source);
357 CHECK(result->IsString());
358 v8::String::Utf8Value utf8(result);
359 CHECK_EQ("foo", *utf8);
360 }
361 }
362
363
327 TEST(RegressChromium62639) { 364 TEST(RegressChromium62639) {
328 v8::V8::Initialize(); 365 v8::V8::Initialize();
329 i::Isolate* isolate = CcTest::i_isolate(); 366 i::Isolate* isolate = CcTest::i_isolate();
330 367
331 int marker; 368 int marker;
332 isolate->stack_guard()->SetStackLimit( 369 isolate->stack_guard()->SetStackLimit(
333 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 370 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
334 371
335 const char* program = "var x = 'something';\n" 372 const char* program = "var x = 'something';\n"
336 "escape: function() {}"; 373 "escape: function() {}";
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 2151
2115 const char* statement_data[] = { 2152 const char* statement_data[] = {
2116 "new foo bar", 2153 "new foo bar",
2117 "new ) foo", 2154 "new ) foo",
2118 "new ++foo", 2155 "new ++foo",
2119 NULL 2156 NULL
2120 }; 2157 };
2121 2158
2122 RunParserSyncTest(context_data, statement_data, kError); 2159 RunParserSyncTest(context_data, statement_data, kError);
2123 } 2160 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698