OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 const char* source, const char* origin_url) { | 433 const char* source, const char* origin_url) { |
434 return CompileRunWithOrigin(v8_str(source), origin_url); | 434 return CompileRunWithOrigin(v8_str(source), origin_url); |
435 } | 435 } |
436 | 436 |
437 | 437 |
438 | 438 |
439 static inline void ExpectString(const char* code, const char* expected) { | 439 static inline void ExpectString(const char* code, const char* expected) { |
440 v8::Local<v8::Value> result = CompileRun(code); | 440 v8::Local<v8::Value> result = CompileRun(code); |
441 CHECK(result->IsString()); | 441 CHECK(result->IsString()); |
442 v8::String::Utf8Value utf8(result); | 442 v8::String::Utf8Value utf8(result); |
443 CHECK_EQ(expected, *utf8); | 443 CHECK_EQ(0, strcmp(expected, *utf8)); |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 static inline void ExpectInt32(const char* code, int expected) { | 447 static inline void ExpectInt32(const char* code, int expected) { |
448 v8::Local<v8::Value> result = CompileRun(code); | 448 v8::Local<v8::Value> result = CompileRun(code); |
449 CHECK(result->IsInt32()); | 449 CHECK(result->IsInt32()); |
450 CHECK_EQ(expected, result->Int32Value()); | 450 CHECK_EQ(expected, result->Int32Value()); |
451 } | 451 } |
452 | 452 |
453 | 453 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 550 } |
551 | 551 |
552 | 552 |
553 // Helper class for new allocations tracking and checking. | 553 // Helper class for new allocations tracking and checking. |
554 // To use checking of JS allocations tracking in a test, | 554 // To use checking of JS allocations tracking in a test, |
555 // just create an instance of this class. | 555 // just create an instance of this class. |
556 class HeapObjectsTracker { | 556 class HeapObjectsTracker { |
557 public: | 557 public: |
558 HeapObjectsTracker() { | 558 HeapObjectsTracker() { |
559 heap_profiler_ = i::Isolate::Current()->heap_profiler(); | 559 heap_profiler_ = i::Isolate::Current()->heap_profiler(); |
560 CHECK_NE(NULL, heap_profiler_); | 560 CHECK_NOT_NULL(heap_profiler_); |
561 heap_profiler_->StartHeapObjectsTracking(true); | 561 heap_profiler_->StartHeapObjectsTracking(true); |
562 } | 562 } |
563 | 563 |
564 ~HeapObjectsTracker() { | 564 ~HeapObjectsTracker() { |
565 i::Isolate::Current()->heap()->CollectAllAvailableGarbage(); | 565 i::Isolate::Current()->heap()->CollectAllAvailableGarbage(); |
566 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); | 566 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); |
567 heap_profiler_->StopHeapObjectsTracking(); | 567 heap_profiler_->StopHeapObjectsTracking(); |
568 } | 568 } |
569 | 569 |
570 private: | 570 private: |
(...skipping 21 matching lines...) Expand all Loading... |
592 HandleAndZoneScope() {} | 592 HandleAndZoneScope() {} |
593 | 593 |
594 // Prefixing the below with main_ reduces a lot of naming clashes. | 594 // Prefixing the below with main_ reduces a lot of naming clashes. |
595 i::Zone* main_zone() { return &main_zone_; } | 595 i::Zone* main_zone() { return &main_zone_; } |
596 | 596 |
597 private: | 597 private: |
598 i::Zone main_zone_; | 598 i::Zone main_zone_; |
599 }; | 599 }; |
600 | 600 |
601 #endif // ifndef CCTEST_H_ | 601 #endif // ifndef CCTEST_H_ |
OLD | NEW |