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

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

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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 | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-utils.cc » ('j') | 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 { 76 {
77 i::Utf8ToUtf16CharacterStream stream(keyword, length - 1); 77 i::Utf8ToUtf16CharacterStream stream(keyword, length - 1);
78 i::Scanner scanner(&unicode_cache); 78 i::Scanner scanner(&unicode_cache);
79 scanner.Initialize(&stream); 79 scanner.Initialize(&stream);
80 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 80 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
81 CHECK_EQ(i::Token::EOS, scanner.Next()); 81 CHECK_EQ(i::Token::EOS, scanner.Next());
82 } 82 }
83 // Adding characters will make keyword matching fail. 83 // Adding characters will make keyword matching fail.
84 static const char chars_to_append[] = { 'z', '0', '_' }; 84 static const char chars_to_append[] = { 'z', '0', '_' };
85 for (int j = 0; j < static_cast<int>(ARRAY_SIZE(chars_to_append)); ++j) { 85 for (int j = 0; j < static_cast<int>(ARRAY_SIZE(chars_to_append)); ++j) {
86 memmove(buffer, keyword, length); 86 i::OS::MemMove(buffer, keyword, length);
87 buffer[length] = chars_to_append[j]; 87 buffer[length] = chars_to_append[j];
88 i::Utf8ToUtf16CharacterStream stream(buffer, length + 1); 88 i::Utf8ToUtf16CharacterStream stream(buffer, length + 1);
89 i::Scanner scanner(&unicode_cache); 89 i::Scanner scanner(&unicode_cache);
90 scanner.Initialize(&stream); 90 scanner.Initialize(&stream);
91 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 91 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
92 CHECK_EQ(i::Token::EOS, scanner.Next()); 92 CHECK_EQ(i::Token::EOS, scanner.Next());
93 } 93 }
94 // Replacing characters will make keyword matching fail. 94 // Replacing characters will make keyword matching fail.
95 { 95 {
96 memmove(buffer, keyword, length); 96 i::OS::MemMove(buffer, keyword, length);
97 buffer[length - 1] = '_'; 97 buffer[length - 1] = '_';
98 i::Utf8ToUtf16CharacterStream stream(buffer, length); 98 i::Utf8ToUtf16CharacterStream stream(buffer, length);
99 i::Scanner scanner(&unicode_cache); 99 i::Scanner scanner(&unicode_cache);
100 scanner.Initialize(&stream); 100 scanner.Initialize(&stream);
101 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 101 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
102 CHECK_EQ(i::Token::EOS, scanner.Next()); 102 CHECK_EQ(i::Token::EOS, scanner.Next());
103 } 103 }
104 } 104 }
105 } 105 }
106 106
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 " b = function() { \n" 1288 " b = function() { \n"
1289 " 01; \n" 1289 " 01; \n"
1290 " }; \n" 1290 " }; \n"
1291 "}; \n"; 1291 "}; \n";
1292 v8::Script::Compile(v8::String::New(script)); 1292 v8::Script::Compile(v8::String::New(script));
1293 CHECK(try_catch.HasCaught()); 1293 CHECK(try_catch.HasCaught());
1294 v8::String::Utf8Value exception(try_catch.Exception()); 1294 v8::String::Utf8Value exception(try_catch.Exception());
1295 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1295 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
1296 *exception); 1296 *exception);
1297 } 1297 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698