| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 i::Isolate::Current()->stack_guard()->SetStackLimit( | 347 i::Isolate::Current()->stack_guard()->SetStackLimit( |
| 348 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); | 348 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); |
| 349 | 349 |
| 350 const char* program = | 350 const char* program = |
| 351 "try { } catch (e) { var foo = function () { /* first */ } }" | 351 "try { } catch (e) { var foo = function () { /* first */ } }" |
| 352 "var bar = function () { /* second */ }"; | 352 "var bar = function () { /* second */ }"; |
| 353 | 353 |
| 354 v8::HandleScope handles; | 354 v8::HandleScope handles; |
| 355 i::Handle<i::String> source( | 355 i::Handle<i::String> source( |
| 356 FACTORY->NewStringFromAscii(i::CStrVector(program))); | 356 FACTORY->NewStringFromAscii(i::CStrVector(program))); |
| 357 i::ScriptDataImpl* data = i::ParserApi::PartialPreParse(source, NULL, false); | 357 i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); |
| 358 i::ScriptDataImpl* data = i::ParserApi::PreParse(&stream, NULL, false); |
| 358 CHECK(!data->HasError()); | 359 CHECK(!data->HasError()); |
| 359 | 360 |
| 360 data->Initialize(); | 361 data->Initialize(); |
| 361 | 362 |
| 362 int first_function = | 363 int first_function = |
| 363 static_cast<int>(strstr(program, "function") - program); | 364 static_cast<int>(strstr(program, "function") - program); |
| 364 int first_lbrace = first_function + i::StrLength("function () "); | 365 int first_lbrace = first_function + i::StrLength("function () "); |
| 365 CHECK_EQ('{', program[first_lbrace]); | 366 CHECK_EQ('{', program[first_lbrace]); |
| 366 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); | 367 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); |
| 367 CHECK(!entry1.is_valid()); | 368 CHECK(!entry1.is_valid()); |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 " b = function() { \n" | 1254 " b = function() { \n" |
| 1254 " 01; \n" | 1255 " 01; \n" |
| 1255 " }; \n" | 1256 " }; \n" |
| 1256 "}; \n"; | 1257 "}; \n"; |
| 1257 v8::Script::Compile(v8::String::New(script)); | 1258 v8::Script::Compile(v8::String::New(script)); |
| 1258 CHECK(try_catch.HasCaught()); | 1259 CHECK(try_catch.HasCaught()); |
| 1259 v8::String::Utf8Value exception(try_catch.Exception()); | 1260 v8::String::Utf8Value exception(try_catch.Exception()); |
| 1260 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1261 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
| 1261 *exception); | 1262 *exception); |
| 1262 } | 1263 } |
| OLD | NEW |