Chromium Code Reviews| 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 5540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5551 size_t counter2 = 2000; | 5551 size_t counter2 = 2000; |
| 5552 tracer->SampleNewSpaceAllocation(time2, counter2); | 5552 tracer->SampleNewSpaceAllocation(time2, counter2); |
| 5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); | 5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); |
| 5554 CHECK_EQ(0, bytes); | 5554 CHECK_EQ(0, bytes); |
| 5555 int time3 = 1000; | 5555 int time3 = 1000; |
| 5556 size_t counter3 = 30000; | 5556 size_t counter3 = 30000; |
| 5557 tracer->SampleNewSpaceAllocation(time3, counter3); | 5557 tracer->SampleNewSpaceAllocation(time3, counter3); |
| 5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); | 5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); |
| 5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); | 5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); |
| 5560 } | 5560 } |
| 5561 | |
| 5562 | |
| 5563 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| 5564 Isolate* isolate = CcTest::i_isolate(); | |
| 5565 Object* message = | |
| 5566 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); | |
| 5567 CHECK(message->IsTheHole()); | |
| 5568 } | |
| 5569 | |
| 5570 | |
| 5571 TEST(MessageObjectLeak) { | |
| 5572 CcTest::InitializeVM(); | |
| 5573 v8::Isolate* isolate = CcTest::isolate(); | |
| 5574 v8::HandleScope scope(isolate); | |
| 5575 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); | |
| 5576 global->Set(v8::String::NewFromUtf8(isolate, "check"), | |
| 5577 v8::FunctionTemplate::New(isolate, CheckLeak)); | |
| 5578 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); | |
| 5579 v8::Context::Scope cscope(context); | |
| 5580 | |
| 5581 const char* test = | |
| 5582 "try {" | |
| 5583 " throw 'message';" | |
|
Michael Starzinger
2015/05/22 13:02:29
As discussed offline: We should have the same prob
| |
| 5584 "} catch (e) {" | |
| 5585 "}" | |
| 5586 "check();"; | |
| 5587 CompileRun(test); | |
| 5588 | |
| 5589 FLAG_turbo_filter = "*"; | |
| 5590 FLAG_always_opt = true; | |
| 5591 FLAG_turbo_exceptions = true; | |
| 5592 | |
| 5593 CompileRun(test); | |
| 5594 } | |
| OLD | NEW |