| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 "var bar = function () { /* second */ }"; | 314 "var bar = function () { /* second */ }"; |
| 315 | 315 |
| 316 i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const i::byte*>(program), | 316 i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const i::byte*>(program), |
| 317 static_cast<unsigned>(strlen(program))); | 317 static_cast<unsigned>(strlen(program))); |
| 318 i::ScriptDataImpl* data = | 318 i::ScriptDataImpl* data = |
| 319 i::ParserApi::PartialPreParse(&stream, NULL); | 319 i::ParserApi::PartialPreParse(&stream, NULL); |
| 320 CHECK(!data->HasError()); | 320 CHECK(!data->HasError()); |
| 321 | 321 |
| 322 data->Initialize(); | 322 data->Initialize(); |
| 323 | 323 |
| 324 intptr_t first_function = strstr(program, "function") - program; | 324 int first_function = |
| 325 intptr_t first_lbrace = first_function + strlen("function () "); | 325 static_cast<int>(strstr(program, "function") - program); |
| 326 int first_lbrace = first_function + strlen("function () "); |
| 326 CHECK_EQ('{', program[first_lbrace]); | 327 CHECK_EQ('{', program[first_lbrace]); |
| 327 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); | 328 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); |
| 328 CHECK(!entry1.is_valid()); | 329 CHECK(!entry1.is_valid()); |
| 329 | 330 |
| 330 intptr_t second_function = | 331 int second_function = |
| 331 strstr(program + first_lbrace, "function") - program; | 332 static_cast<int>(strstr(program + first_lbrace, "function") - program); |
| 332 intptr_t second_lbrace = second_function + strlen("function () "); | 333 int second_lbrace = second_function + strlen("function () "); |
| 333 CHECK_EQ('{', program[second_lbrace]); | 334 CHECK_EQ('{', program[second_lbrace]); |
| 334 i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace); | 335 i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace); |
| 335 CHECK(entry2.is_valid()); | 336 CHECK(entry2.is_valid()); |
| 336 CHECK_EQ('}', program[entry2.end_pos() - 1]); | 337 CHECK_EQ('}', program[entry2.end_pos() - 1]); |
| 337 delete data; | 338 delete data; |
| 338 } | 339 } |
| 339 | 340 |
| 340 | 341 |
| 341 TEST(PreParseOverflow) { | 342 TEST(PreParseOverflow) { |
| 342 int marker; | 343 int marker; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); | 695 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); |
| 695 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); | 696 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); |
| 696 // Escaped ']'s wont end the character class. | 697 // Escaped ']'s wont end the character class. |
| 697 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); | 698 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); |
| 698 // Escaped slashes are not terminating. | 699 // Escaped slashes are not terminating. |
| 699 TestScanRegExp("/\\//flipperwald", "\\/"); | 700 TestScanRegExp("/\\//flipperwald", "\\/"); |
| 700 // Starting with '=' works too. | 701 // Starting with '=' works too. |
| 701 TestScanRegExp("/=/", "="); | 702 TestScanRegExp("/=/", "="); |
| 702 TestScanRegExp("/=?/", "=?"); | 703 TestScanRegExp("/=?/", "=?"); |
| 703 } | 704 } |
| OLD | NEW |