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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 v8::Local<v8::Context> context = v8::Context::New(isolate); | 368 v8::Local<v8::Context> context = v8::Context::New(isolate); |
369 v8::Context::Scope context_scope(context); | 369 v8::Context::Scope context_scope(context); |
370 CcTest::i_isolate()->stack_guard()->SetStackLimit( | 370 CcTest::i_isolate()->stack_guard()->SetStackLimit( |
371 i::GetCurrentStackPosition() - 128 * 1024); | 371 i::GetCurrentStackPosition() - 128 * 1024); |
372 | 372 |
373 { | 373 { |
374 const char* source = "var myo = {if: \"foo\"}; myo.if;"; | 374 const char* source = "var myo = {if: \"foo\"}; myo.if;"; |
375 v8::Local<v8::Value> result = ParserCacheCompileRun(source); | 375 v8::Local<v8::Value> result = ParserCacheCompileRun(source); |
376 CHECK(result->IsString()); | 376 CHECK(result->IsString()); |
377 v8::String::Utf8Value utf8(result); | 377 v8::String::Utf8Value utf8(result); |
378 CHECK_EQ(0, strcmp("foo", *utf8)); | 378 CHECK_EQ("foo", *utf8); |
379 } | 379 } |
380 | 380 |
381 { | 381 { |
382 const char* source = "var myo = {\"bar\": \"foo\"}; myo[\"bar\"];"; | 382 const char* source = "var myo = {\"bar\": \"foo\"}; myo[\"bar\"];"; |
383 v8::Local<v8::Value> result = ParserCacheCompileRun(source); | 383 v8::Local<v8::Value> result = ParserCacheCompileRun(source); |
384 CHECK(result->IsString()); | 384 CHECK(result->IsString()); |
385 v8::String::Utf8Value utf8(result); | 385 v8::String::Utf8Value utf8(result); |
386 CHECK_EQ(0, strcmp("foo", *utf8)); | 386 CHECK_EQ("foo", *utf8); |
387 } | 387 } |
388 | 388 |
389 { | 389 { |
390 const char* source = "var myo = {1: \"foo\"}; myo[1];"; | 390 const char* source = "var myo = {1: \"foo\"}; myo[1];"; |
391 v8::Local<v8::Value> result = ParserCacheCompileRun(source); | 391 v8::Local<v8::Value> result = ParserCacheCompileRun(source); |
392 CHECK(result->IsString()); | 392 CHECK(result->IsString()); |
393 v8::String::Utf8Value utf8(result); | 393 v8::String::Utf8Value utf8(result); |
394 CHECK_EQ(0, strcmp("foo", *utf8)); | 394 CHECK_EQ("foo", *utf8); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 TEST(RegressChromium62639) { | 399 TEST(RegressChromium62639) { |
400 v8::V8::Initialize(); | 400 v8::V8::Initialize(); |
401 i::Isolate* isolate = CcTest::i_isolate(); | 401 i::Isolate* isolate = CcTest::i_isolate(); |
402 | 402 |
403 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - | 403 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - |
404 128 * 1024); | 404 128 * 1024); |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 const char* script = | 1663 const char* script = |
1664 "\"use strict\"; \n" | 1664 "\"use strict\"; \n" |
1665 "a = function() { \n" | 1665 "a = function() { \n" |
1666 " b = function() { \n" | 1666 " b = function() { \n" |
1667 " 01; \n" | 1667 " 01; \n" |
1668 " }; \n" | 1668 " }; \n" |
1669 "}; \n"; | 1669 "}; \n"; |
1670 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); | 1670 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); |
1671 CHECK(try_catch.HasCaught()); | 1671 CHECK(try_catch.HasCaught()); |
1672 v8::String::Utf8Value exception(try_catch.Exception()); | 1672 v8::String::Utf8Value exception(try_catch.Exception()); |
1673 CHECK_EQ(0, | 1673 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
1674 strcmp("SyntaxError: Octal literals are not allowed in strict mode.", | 1674 *exception); |
1675 *exception)); | |
1676 } | 1675 } |
1677 | 1676 |
1678 | 1677 |
1679 void RunParserSyncTest(const char* context_data[][2], | 1678 void RunParserSyncTest(const char* context_data[][2], |
1680 const char* statement_data[], | 1679 const char* statement_data[], |
1681 ParserSyncTestResult result, | 1680 ParserSyncTestResult result, |
1682 const ParserFlag* flags = NULL, | 1681 const ParserFlag* flags = NULL, |
1683 int flags_len = 0, | 1682 int flags_len = 0, |
1684 const ParserFlag* always_true_flags = NULL, | 1683 const ParserFlag* always_true_flags = NULL, |
1685 int always_true_len = 0, | 1684 int always_true_len = 0, |
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4914 "const x = 1;", | 4913 "const x = 1;", |
4915 "class C {}", | 4914 "class C {}", |
4916 NULL}; | 4915 NULL}; |
4917 | 4916 |
4918 static const ParserFlag always_flags[] = { | 4917 static const ParserFlag always_flags[] = { |
4919 kAllowHarmonyClasses, kAllowHarmonyScoping | 4918 kAllowHarmonyClasses, kAllowHarmonyScoping |
4920 }; | 4919 }; |
4921 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, | 4920 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, |
4922 always_flags, arraysize(always_flags)); | 4921 always_flags, arraysize(always_flags)); |
4923 } | 4922 } |
OLD | NEW |