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

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

Issue 9690019: Fix compile warning on 64 bit Windows. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 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 | « no previous file | 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ScriptDataImpl* data = i::ParserApi::PartialPreParse(source, NULL, false);
358 CHECK(!data->HasError()); 358 CHECK(!data->HasError());
359 359
360 data->Initialize(); 360 data->Initialize();
361 361
362 int first_function = 362 int first_function =
363 static_cast<int>(strstr(program, "function") - program); 363 static_cast<int>(strstr(program, "function") - program);
364 int first_lbrace = first_function + static_cast<int>(strlen("function () ")); 364 int first_lbrace = first_function + i::StrLength("function () ");
365 CHECK_EQ('{', program[first_lbrace]); 365 CHECK_EQ('{', program[first_lbrace]);
366 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace); 366 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
367 CHECK(!entry1.is_valid()); 367 CHECK(!entry1.is_valid());
368 368
369 int second_function = 369 int second_function =
370 static_cast<int>(strstr(program + first_lbrace, "function") - program); 370 static_cast<int>(strstr(program + first_lbrace, "function") - program);
371 int second_lbrace = 371 int second_lbrace =
372 second_function + static_cast<int>(strlen("function () ")); 372 second_function + i::StrLength("function () ");
373 CHECK_EQ('{', program[second_lbrace]); 373 CHECK_EQ('{', program[second_lbrace]);
374 i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace); 374 i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace);
375 CHECK(entry2.is_valid()); 375 CHECK(entry2.is_valid());
376 CHECK_EQ('}', program[entry2.end_pos() - 1]); 376 CHECK_EQ('}', program[entry2.end_pos() - 1]);
377 delete data; 377 delete data;
378 } 378 }
379 379
380 380
381 TEST(PreParseOverflow) { 381 TEST(PreParseOverflow) {
382 v8::V8::Initialize(); 382 v8::V8::Initialize();
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); 745 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]");
746 // Escaped slashes are not terminating. 746 // Escaped slashes are not terminating.
747 TestScanRegExp("/\\//flipperwald", "\\/"); 747 TestScanRegExp("/\\//flipperwald", "\\/");
748 // Starting with '=' works too. 748 // Starting with '=' works too.
749 TestScanRegExp("/=/", "="); 749 TestScanRegExp("/=/", "=");
750 TestScanRegExp("/=?/", "=?"); 750 TestScanRegExp("/=?/", "=?");
751 } 751 }
752 752
753 753
754 static int Utf8LengthHelper(const char* s) { 754 static int Utf8LengthHelper(const char* s) {
755 int len = strlen(s); 755 int len = i::StrLength(s);
756 int character_length = len; 756 int character_length = len;
757 for (int i = 0; i < len; i++) { 757 for (int i = 0; i < len; i++) {
758 unsigned char c = s[i]; 758 unsigned char c = s[i];
759 int input_offset = 0; 759 int input_offset = 0;
760 int output_adjust = 0; 760 int output_adjust = 0;
761 if (c > 0x7f) { 761 if (c > 0x7f) {
762 if (c < 0xc0) continue; 762 if (c < 0xc0) continue;
763 if (c >= 0xf0) { 763 if (c >= 0xf0) {
764 if (c >= 0xf8) { 764 if (c >= 0xf8) {
765 // 5 and 6 byte UTF-8 sequences turn into a kBadChar for each UTF-8 765 // 5 and 6 byte UTF-8 sequences turn into a kBadChar for each UTF-8
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 termination_data[k], 1229 termination_data[k],
1230 context_data[i][1]); 1230 context_data[i][1]);
1231 CHECK(length == kProgramSize); 1231 CHECK(length == kProgramSize);
1232 i::Handle<i::String> source = 1232 i::Handle<i::String> source =
1233 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); 1233 FACTORY->NewStringFromAscii(i::CStrVector(program.start()));
1234 TestParserSyncWithFlags(source); 1234 TestParserSyncWithFlags(source);
1235 } 1235 }
1236 } 1236 }
1237 } 1237 }
1238 } 1238 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698