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

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

Issue 7860011: Rename SmartPointer to SmartArrayPointer. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: rebase it again to get more fixes Created 9 years, 3 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
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-regexp.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 339
340 TEST(PreParseOverflow) { 340 TEST(PreParseOverflow) {
341 v8::V8::Initialize(); 341 v8::V8::Initialize();
342 342
343 int marker; 343 int marker;
344 i::Isolate::Current()->stack_guard()->SetStackLimit( 344 i::Isolate::Current()->stack_guard()->SetStackLimit(
345 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 345 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
346 346
347 size_t kProgramSize = 1024 * 1024; 347 size_t kProgramSize = 1024 * 1024;
348 i::SmartPointer<char> program( 348 i::SmartArrayPointer<char> program(
349 reinterpret_cast<char*>(malloc(kProgramSize + 1))); 349 reinterpret_cast<char*>(malloc(kProgramSize + 1)));
350 memset(*program, '(', kProgramSize); 350 memset(*program, '(', kProgramSize);
351 program[kProgramSize] = '\0'; 351 program[kProgramSize] = '\0';
352 352
353 uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit(); 353 uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit();
354 354
355 i::Utf8ToUC16CharacterStream stream( 355 i::Utf8ToUC16CharacterStream stream(
356 reinterpret_cast<const i::byte*>(*program), 356 reinterpret_cast<const i::byte*>(*program),
357 static_cast<unsigned>(kProgramSize)); 357 static_cast<unsigned>(kProgramSize));
358 i::CompleteParserRecorder log; 358 i::CompleteParserRecorder log;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 #define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2)) 392 #define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2))
393 393
394 void TestCharacterStream(const char* ascii_source, 394 void TestCharacterStream(const char* ascii_source,
395 unsigned length, 395 unsigned length,
396 unsigned start = 0, 396 unsigned start = 0,
397 unsigned end = 0) { 397 unsigned end = 0) {
398 if (end == 0) end = length; 398 if (end == 0) end = length;
399 unsigned sub_length = end - start; 399 unsigned sub_length = end - start;
400 i::HandleScope test_scope; 400 i::HandleScope test_scope;
401 i::SmartPointer<i::uc16> uc16_buffer(new i::uc16[length]); 401 i::SmartArrayPointer<i::uc16> uc16_buffer(new i::uc16[length]);
402 for (unsigned i = 0; i < length; i++) { 402 for (unsigned i = 0; i < length; i++) {
403 uc16_buffer[i] = static_cast<i::uc16>(ascii_source[i]); 403 uc16_buffer[i] = static_cast<i::uc16>(ascii_source[i]);
404 } 404 }
405 i::Vector<const char> ascii_vector(ascii_source, static_cast<int>(length)); 405 i::Vector<const char> ascii_vector(ascii_source, static_cast<int>(length));
406 i::Handle<i::String> ascii_string( 406 i::Handle<i::String> ascii_string(
407 FACTORY->NewStringFromAscii(ascii_vector)); 407 FACTORY->NewStringFromAscii(ascii_vector));
408 TestExternalResource resource(*uc16_buffer, length); 408 TestExternalResource resource(*uc16_buffer, length);
409 i::Handle<i::String> uc16_string( 409 i::Handle<i::String> uc16_string(
410 FACTORY->NewExternalStringFromTwoByte(&resource)); 410 FACTORY->NewExternalStringFromTwoByte(&resource));
411 411
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); 699 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]");
700 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); 700 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]");
701 // Escaped ']'s wont end the character class. 701 // Escaped ']'s wont end the character class.
702 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); 702 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]");
703 // Escaped slashes are not terminating. 703 // Escaped slashes are not terminating.
704 TestScanRegExp("/\\//flipperwald", "\\/"); 704 TestScanRegExp("/\\//flipperwald", "\\/");
705 // Starting with '=' works too. 705 // Starting with '=' works too.
706 TestScanRegExp("/=/", "="); 706 TestScanRegExp("/=/", "=");
707 TestScanRegExp("/=?/", "=?"); 707 TestScanRegExp("/=?/", "=?");
708 } 708 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698