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

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

Issue 328343003: Remove dependency on Vector from platform files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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-log-stack-tracer.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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 DISALLOW_COPY_AND_ASSIGN(ScopedLoggerInitializer); 107 DISALLOW_COPY_AND_ASSIGN(ScopedLoggerInitializer);
108 }; 108 };
109 109
110 } // namespace 110 } // namespace
111 111
112 112
113 static const char* StrNStr(const char* s1, const char* s2, int n) { 113 static const char* StrNStr(const char* s1, const char* s2, int n) {
114 if (s1[n] == '\0') return strstr(s1, s2); 114 if (s1[n] == '\0') return strstr(s1, s2);
115 i::ScopedVector<char> str(n + 1); 115 i::ScopedVector<char> str(n + 1);
116 i::OS::StrNCpy(str, s1, static_cast<size_t>(n)); 116 i::StrNCpy(str, s1, static_cast<size_t>(n));
117 str[n] = '\0'; 117 str[n] = '\0';
118 char* found = strstr(str.start(), s2); 118 char* found = strstr(str.start(), s2);
119 return found != NULL ? s1 + (found - str.start()) : NULL; 119 return found != NULL ? s1 + (found - str.start()) : NULL;
120 } 120 }
121 121
122 122
123 // BUG(913). Need to implement support for profiling multiple VM threads. 123 // BUG(913). Need to implement support for profiling multiple VM threads.
124 #if 0 124 #if 0
125 125
126 namespace { 126 namespace {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 CompileRun("Obj.prototype.method1.toString();"); 352 CompileRun("Obj.prototype.method1.toString();");
353 353
354 logger->LogCompiledFunctions(); 354 logger->LogCompiledFunctions();
355 355
356 bool exists = false; 356 bool exists = false;
357 i::Vector<const char> log( 357 i::Vector<const char> log(
358 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); 358 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
359 CHECK(exists); 359 CHECK(exists);
360 360
361 i::EmbeddedVector<char, 100> ref_data; 361 i::EmbeddedVector<char, 100> ref_data;
362 i::OS::SNPrintF(ref_data, 362 i::SNPrintF(ref_data,
363 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"\0", 363 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"",
364 ObjMethod1); 364 reinterpret_cast<intptr_t>(ObjMethod1));
365 365
366 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); 366 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
367 log.Dispose(); 367 log.Dispose();
368 } 368 }
369 369
370 370
371 static void Prop1Getter(v8::Local<v8::String> property, 371 static void Prop1Getter(v8::Local<v8::String> property,
372 const v8::PropertyCallbackInfo<v8::Value>& info) { 372 const v8::PropertyCallbackInfo<v8::Value>& info) {
373 } 373 }
374 374
(...skipping 21 matching lines...) Expand all
396 inst->SetAccessor(v8_str("prop2"), Prop2Getter); 396 inst->SetAccessor(v8_str("prop2"), Prop2Getter);
397 397
398 logger->LogAccessorCallbacks(); 398 logger->LogAccessorCallbacks();
399 399
400 bool exists = false; 400 bool exists = false;
401 i::Vector<const char> log( 401 i::Vector<const char> log(
402 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); 402 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
403 CHECK(exists); 403 CHECK(exists);
404 404
405 EmbeddedVector<char, 100> prop1_getter_record; 405 EmbeddedVector<char, 100> prop1_getter_record;
406 i::OS::SNPrintF(prop1_getter_record, 406 i::SNPrintF(prop1_getter_record,
407 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"", 407 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop1\"",
408 Prop1Getter); 408 reinterpret_cast<intptr_t>(Prop1Getter));
409 CHECK_NE(NULL, 409 CHECK_NE(NULL,
410 StrNStr(log.start(), prop1_getter_record.start(), log.length())); 410 StrNStr(log.start(), prop1_getter_record.start(), log.length()));
411 411
412 EmbeddedVector<char, 100> prop1_setter_record; 412 EmbeddedVector<char, 100> prop1_setter_record;
413 i::OS::SNPrintF(prop1_setter_record, 413 i::SNPrintF(prop1_setter_record,
414 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"", 414 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"set prop1\"",
415 Prop1Setter); 415 reinterpret_cast<intptr_t>(Prop1Setter));
416 CHECK_NE(NULL, 416 CHECK_NE(NULL,
417 StrNStr(log.start(), prop1_setter_record.start(), log.length())); 417 StrNStr(log.start(), prop1_setter_record.start(), log.length()));
418 418
419 EmbeddedVector<char, 100> prop2_getter_record; 419 EmbeddedVector<char, 100> prop2_getter_record;
420 i::OS::SNPrintF(prop2_getter_record, 420 i::SNPrintF(prop2_getter_record,
421 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"", 421 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"",
422 Prop2Getter); 422 reinterpret_cast<intptr_t>(Prop2Getter));
423 CHECK_NE(NULL, 423 CHECK_NE(NULL,
424 StrNStr(log.start(), prop2_getter_record.start(), log.length())); 424 StrNStr(log.start(), prop2_getter_record.start(), log.length()));
425 log.Dispose(); 425 log.Dispose();
426 } 426 }
427 427
428 428
429 typedef i::NativesCollection<i::TEST> TestSources; 429 typedef i::NativesCollection<i::TEST> TestSources;
430 430
431 431
432 // Test that logging of code create / move events is equivalent to traversal of 432 // Test that logging of code create / move events is equivalent to traversal of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 v8::Local<v8::String> s = result->ToString(); 486 v8::Local<v8::String> s = result->ToString();
487 i::ScopedVector<char> data(s->Utf8Length() + 1); 487 i::ScopedVector<char> data(s->Utf8Length() + 1);
488 CHECK_NE(NULL, data.start()); 488 CHECK_NE(NULL, data.start());
489 s->WriteUtf8(data.start()); 489 s->WriteUtf8(data.start());
490 printf("%s\n", data.start()); 490 printf("%s\n", data.start());
491 // Make sure that our output is written prior crash due to CHECK failure. 491 // Make sure that our output is written prior crash due to CHECK failure.
492 fflush(stdout); 492 fflush(stdout);
493 CHECK(false); 493 CHECK(false);
494 } 494 }
495 } 495 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-log-stack-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698