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

Side by Side Diff: src/regexp-macro-assembler-irregexp.cc

Issue 126111: Fix memory leak in regexp macro assembler. If the buffer has been... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008-2009 the V8 project authors. All rights reserved. 1 // Copyright 2008-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 29 matching lines...) Expand all
40 RegExpMacroAssemblerIrregexp::RegExpMacroAssemblerIrregexp(Vector<byte> buffer) 40 RegExpMacroAssemblerIrregexp::RegExpMacroAssemblerIrregexp(Vector<byte> buffer)
41 : buffer_(buffer), 41 : buffer_(buffer),
42 pc_(0), 42 pc_(0),
43 own_buffer_(false), 43 own_buffer_(false),
44 advance_current_end_(kInvalidPC) { 44 advance_current_end_(kInvalidPC) {
45 } 45 }
46 46
47 47
48 RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() { 48 RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() {
49 if (backtrack_.is_linked()) backtrack_.Unuse(); 49 if (backtrack_.is_linked()) backtrack_.Unuse();
50 if (own_buffer_) buffer_.Dispose();
50 } 51 }
51 52
52 53
53 RegExpMacroAssemblerIrregexp::IrregexpImplementation 54 RegExpMacroAssemblerIrregexp::IrregexpImplementation
54 RegExpMacroAssemblerIrregexp::Implementation() { 55 RegExpMacroAssemblerIrregexp::Implementation() {
55 return kBytecodeImplementation; 56 return kBytecodeImplementation;
56 } 57 }
57 58
58 59
59 void RegExpMacroAssemblerIrregexp::Bind(Label* l) { 60 void RegExpMacroAssemblerIrregexp::Bind(Label* l) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 buffer_ = Vector<byte>::New(old_buffer.length() * 2); 484 buffer_ = Vector<byte>::New(old_buffer.length() * 2);
484 own_buffer_ = true; 485 own_buffer_ = true;
485 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); 486 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length());
486 if (old_buffer_was_our_own) { 487 if (old_buffer_was_our_own) {
487 old_buffer.Dispose(); 488 old_buffer.Dispose();
488 } 489 }
489 } 490 }
490 491
491 492
492 } } // namespace v8::internal 493 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698