OLD | NEW |
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 6094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6105 tracer->SampleAllocation(time3, counter3, 0); | 6105 tracer->SampleAllocation(time3, counter3, 0); |
6106 throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100); | 6106 throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100); |
6107 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); | 6107 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); |
6108 } | 6108 } |
6109 | 6109 |
6110 | 6110 |
6111 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { | 6111 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { |
6112 Isolate* isolate = CcTest::i_isolate(); | 6112 Isolate* isolate = CcTest::i_isolate(); |
6113 Object* message = | 6113 Object* message = |
6114 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); | 6114 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); |
6115 CHECK(message->IsTheHole()); | 6115 CHECK(message->IsTheHole(isolate)); |
6116 } | 6116 } |
6117 | 6117 |
6118 | 6118 |
6119 TEST(MessageObjectLeak) { | 6119 TEST(MessageObjectLeak) { |
6120 CcTest::InitializeVM(); | 6120 CcTest::InitializeVM(); |
6121 v8::Isolate* isolate = CcTest::isolate(); | 6121 v8::Isolate* isolate = CcTest::isolate(); |
6122 v8::HandleScope scope(isolate); | 6122 v8::HandleScope scope(isolate); |
6123 v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); | 6123 v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
6124 global->Set( | 6124 global->Set( |
6125 v8::String::NewFromUtf8(isolate, "check", v8::NewStringType::kNormal) | 6125 v8::String::NewFromUtf8(isolate, "check", v8::NewStringType::kNormal) |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6717 CHECK(marking->IsComplete()); | 6717 CHECK(marking->IsComplete()); |
6718 intptr_t size_before = heap->SizeOfObjects(); | 6718 intptr_t size_before = heap->SizeOfObjects(); |
6719 CcTest::heap()->CollectAllGarbage(); | 6719 CcTest::heap()->CollectAllGarbage(); |
6720 intptr_t size_after = heap->SizeOfObjects(); | 6720 intptr_t size_after = heap->SizeOfObjects(); |
6721 // Live size does not increase after garbage collection. | 6721 // Live size does not increase after garbage collection. |
6722 CHECK_LE(size_after, size_before); | 6722 CHECK_LE(size_after, size_before); |
6723 } | 6723 } |
6724 | 6724 |
6725 } // namespace internal | 6725 } // namespace internal |
6726 } // namespace v8 | 6726 } // namespace v8 |
OLD | NEW |