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

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

Issue 392263002: Remove obsolete options in ScriptCompiler::CompileOptions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed tests. Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 // Insert a syntax error inside the lazy function. 271 // Insert a syntax error inside the lazy function.
272 const char* bad_code[] = { 272 const char* bad_code[] = {
273 "function this_is_lazy() { if ( } function foo() { return 25; } foo();", 273 "function this_is_lazy() { if ( } function foo() { return 25; } foo();",
274 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();", 274 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();",
275 }; 275 };
276 276
277 for (unsigned i = 0; i < arraysize(good_code); i++) { 277 for (unsigned i = 0; i < arraysize(good_code); i++) {
278 v8::ScriptCompiler::Source good_source(v8_str(good_code[i])); 278 v8::ScriptCompiler::Source good_source(v8_str(good_code[i]));
279 v8::ScriptCompiler::Compile(isolate, &good_source, 279 v8::ScriptCompiler::Compile(isolate, &good_source,
280 v8::ScriptCompiler::kProduceDataToCache); 280 v8::ScriptCompiler::kProduceParserCache);
281 281
282 const v8::ScriptCompiler::CachedData* cached_data = 282 const v8::ScriptCompiler::CachedData* cached_data =
283 good_source.GetCachedData(); 283 good_source.GetCachedData();
284 CHECK(cached_data->data != NULL); 284 CHECK(cached_data->data != NULL);
285 CHECK_GT(cached_data->length, 0); 285 CHECK_GT(cached_data->length, 0);
286 286
287 // Now compile the erroneous code with the good preparse data. If the 287 // Now compile the erroneous code with the good preparse data. If the
288 // preparse data is used, the lazy function is skipped and it should 288 // preparse data is used, the lazy function is skipped and it should
289 // compile fine. 289 // compile fine.
290 v8::ScriptCompiler::Source bad_source( 290 v8::ScriptCompiler::Source bad_source(
291 v8_str(bad_code[i]), new v8::ScriptCompiler::CachedData( 291 v8_str(bad_code[i]), new v8::ScriptCompiler::CachedData(
292 cached_data->data, cached_data->length)); 292 cached_data->data, cached_data->length));
293 v8::Local<v8::Value> result = 293 v8::Local<v8::Value> result =
294 v8::ScriptCompiler::Compile(isolate, &bad_source)->Run(); 294 v8::ScriptCompiler::Compile(isolate, &bad_source,
295 v8::ScriptCompiler::kConsumeParserCache)
296 ->Run();
295 CHECK(result->IsInt32()); 297 CHECK(result->IsInt32());
296 CHECK_EQ(25, result->Int32Value()); 298 CHECK_EQ(25, result->Int32Value());
297 } 299 }
298 } 300 }
299 301
300 302
301 TEST(StandAlonePreParser) { 303 TEST(StandAlonePreParser) {
302 v8::V8::Initialize(); 304 v8::V8::Initialize();
303 305
304 CcTest::i_isolate()->stack_guard()->SetStackLimit( 306 CcTest::i_isolate()->stack_guard()->SetStackLimit(
(...skipping 6502 matching lines...) Expand 10 before | Expand all | Expand 10 after
6807 kAllowHarmonyObjectLiterals, 6809 kAllowHarmonyObjectLiterals,
6808 kAllowHarmonySloppy, 6810 kAllowHarmonySloppy,
6809 }; 6811 };
6810 // clang-format on 6812 // clang-format on
6811 6813
6812 RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags, 6814 RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags,
6813 arraysize(always_flags)); 6815 arraysize(always_flags));
6814 RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags, 6816 RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags,
6815 arraysize(always_flags)); 6817 arraysize(always_flags));
6816 } 6818 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698