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

Side by Side Diff: src/api.cc

Issue 302603002: Fix mem leaks in tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « no previous file | test/cctest/test-api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "api.h" 5 #include "api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 name_obj, 1721 name_obj,
1722 line_offset, 1722 line_offset,
1723 column_offset, 1723 column_offset,
1724 is_shared_cross_origin, 1724 is_shared_cross_origin,
1725 isolate->global_context(), 1725 isolate->global_context(),
1726 NULL, 1726 NULL,
1727 &script_data_impl, 1727 &script_data_impl,
1728 cached_data_mode, 1728 cached_data_mode,
1729 i::NOT_NATIVES_CODE); 1729 i::NOT_NATIVES_CODE);
1730 has_pending_exception = result.is_null(); 1730 has_pending_exception = result.is_null();
1731 if (has_pending_exception && cached_data_mode == i::CONSUME_CACHED_DATA) {
1732 // This case won't happen during normal operation; we have compiled
1733 // successfully and produced cached data, and but the second compilation
1734 // of the same source code fails.
1735 delete script_data_impl;
1736 script_data_impl = NULL;
1737 }
1731 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); 1738 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>());
1732 raw_result = *result; 1739 raw_result = *result;
1733 if ((options & kProduceDataToCache) && script_data_impl != NULL) { 1740 if ((options & kProduceDataToCache) && script_data_impl != NULL) {
1734 // script_data_impl now contains the data that was generated. source will 1741 // script_data_impl now contains the data that was generated. source will
1735 // take the ownership. 1742 // take the ownership.
1736 source->cached_data = new CachedData( 1743 source->cached_data = new CachedData(
1737 reinterpret_cast<const uint8_t*>(script_data_impl->Data()), 1744 reinterpret_cast<const uint8_t*>(script_data_impl->Data()),
1738 script_data_impl->Length(), CachedData::BufferOwned); 1745 script_data_impl->Length(), CachedData::BufferOwned);
1739 script_data_impl->owns_store_ = false; 1746 script_data_impl->owns_store_ = false;
1740 } 1747 }
(...skipping 5818 matching lines...) Expand 10 before | Expand all | Expand 10 after
7559 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7560 Address callback_address = 7567 Address callback_address =
7561 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7562 VMState<EXTERNAL> state(isolate); 7569 VMState<EXTERNAL> state(isolate);
7563 ExternalCallbackScope call_scope(isolate, callback_address); 7570 ExternalCallbackScope call_scope(isolate, callback_address);
7564 callback(info); 7571 callback(info);
7565 } 7572 }
7566 7573
7567 7574
7568 } } // namespace v8::internal 7575 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698