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

Side by Side Diff: src/x87/full-codegen-x87.cc

Issue 1150293002: Do not leak message object beyond try-catch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix memory leak by setting flag Created 5 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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-heap.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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 5251 matching lines...) Expand 10 before | Expand all | Expand 10 after
5262 __ push(edx); 5262 __ push(edx);
5263 5263
5264 // Store result register while executing finally block. 5264 // Store result register while executing finally block.
5265 __ push(result_register()); 5265 __ push(result_register());
5266 5266
5267 // Store pending message while executing finally block. 5267 // Store pending message while executing finally block.
5268 ExternalReference pending_message_obj = 5268 ExternalReference pending_message_obj =
5269 ExternalReference::address_of_pending_message_obj(isolate()); 5269 ExternalReference::address_of_pending_message_obj(isolate());
5270 __ mov(edx, Operand::StaticVariable(pending_message_obj)); 5270 __ mov(edx, Operand::StaticVariable(pending_message_obj));
5271 __ push(edx); 5271 __ push(edx);
5272
5273 ClearPendingMessage();
5272 } 5274 }
5273 5275
5274 5276
5275 void FullCodeGenerator::ExitFinallyBlock() { 5277 void FullCodeGenerator::ExitFinallyBlock() {
5276 DCHECK(!result_register().is(edx)); 5278 DCHECK(!result_register().is(edx));
5277 // Restore pending message from stack. 5279 // Restore pending message from stack.
5278 __ pop(edx); 5280 __ pop(edx);
5279 ExternalReference pending_message_obj = 5281 ExternalReference pending_message_obj =
5280 ExternalReference::address_of_pending_message_obj(isolate()); 5282 ExternalReference::address_of_pending_message_obj(isolate());
5281 __ mov(Operand::StaticVariable(pending_message_obj), edx); 5283 __ mov(Operand::StaticVariable(pending_message_obj), edx);
5282 5284
5283 // Restore result register from stack. 5285 // Restore result register from stack.
5284 __ pop(result_register()); 5286 __ pop(result_register());
5285 5287
5286 // Uncook return address. 5288 // Uncook return address.
5287 __ pop(edx); 5289 __ pop(edx);
5288 __ SmiUntag(edx); 5290 __ SmiUntag(edx);
5289 __ add(edx, Immediate(masm_->CodeObject())); 5291 __ add(edx, Immediate(masm_->CodeObject()));
5290 __ jmp(edx); 5292 __ jmp(edx);
5291 } 5293 }
5292 5294
5293 5295
5296 void FullCodeGenerator::ClearPendingMessage() {
5297 DCHECK(!result_register().is(edx));
5298 ExternalReference pending_message_obj =
5299 ExternalReference::address_of_pending_message_obj(isolate());
5300 __ mov(edx, Immediate(isolate()->factory()->the_hole_value()));
5301 __ mov(Operand::StaticVariable(pending_message_obj), edx);
5302 }
5303
5304
5294 #undef __ 5305 #undef __
5295 5306
5296 5307
5297 static const byte kJnsInstruction = 0x79; 5308 static const byte kJnsInstruction = 0x79;
5298 static const byte kJnsOffset = 0x11; 5309 static const byte kJnsOffset = 0x11;
5299 static const byte kNopByteOne = 0x66; 5310 static const byte kNopByteOne = 0x66;
5300 static const byte kNopByteTwo = 0x90; 5311 static const byte kNopByteTwo = 0x90;
5301 #ifdef DEBUG 5312 #ifdef DEBUG
5302 static const byte kCallInstruction = 0xe8; 5313 static const byte kCallInstruction = 0xe8;
5303 #endif 5314 #endif
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5367 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5378 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5368 Assembler::target_address_at(call_target_address, 5379 Assembler::target_address_at(call_target_address,
5369 unoptimized_code)); 5380 unoptimized_code));
5370 return OSR_AFTER_STACK_CHECK; 5381 return OSR_AFTER_STACK_CHECK;
5371 } 5382 }
5372 5383
5373 5384
5374 } } // namespace v8::internal 5385 } } // namespace v8::internal
5375 5386
5376 #endif // V8_TARGET_ARCH_X87 5387 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698