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

Side by Side Diff: src/ia32/full-codegen-ia32.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, 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
« no previous file with comments | « src/full-codegen.cc ('k') | src/mips/full-codegen-mips.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 5261 matching lines...) Expand 10 before | Expand all | Expand 10 after
5272 __ push(edx); 5272 __ push(edx);
5273 5273
5274 // Store result register while executing finally block. 5274 // Store result register while executing finally block.
5275 __ push(result_register()); 5275 __ push(result_register());
5276 5276
5277 // Store pending message while executing finally block. 5277 // Store pending message while executing finally block.
5278 ExternalReference pending_message_obj = 5278 ExternalReference pending_message_obj =
5279 ExternalReference::address_of_pending_message_obj(isolate()); 5279 ExternalReference::address_of_pending_message_obj(isolate());
5280 __ mov(edx, Operand::StaticVariable(pending_message_obj)); 5280 __ mov(edx, Operand::StaticVariable(pending_message_obj));
5281 __ push(edx); 5281 __ push(edx);
5282
5283 ClearPendingMessage();
5282 } 5284 }
5283 5285
5284 5286
5285 void FullCodeGenerator::ExitFinallyBlock() { 5287 void FullCodeGenerator::ExitFinallyBlock() {
5286 DCHECK(!result_register().is(edx)); 5288 DCHECK(!result_register().is(edx));
5287 // Restore pending message from stack. 5289 // Restore pending message from stack.
5288 __ pop(edx); 5290 __ pop(edx);
5289 ExternalReference pending_message_obj = 5291 ExternalReference pending_message_obj =
5290 ExternalReference::address_of_pending_message_obj(isolate()); 5292 ExternalReference::address_of_pending_message_obj(isolate());
5291 __ mov(Operand::StaticVariable(pending_message_obj), edx); 5293 __ mov(Operand::StaticVariable(pending_message_obj), edx);
5292 5294
5293 // Restore result register from stack. 5295 // Restore result register from stack.
5294 __ pop(result_register()); 5296 __ pop(result_register());
5295 5297
5296 // Uncook return address. 5298 // Uncook return address.
5297 __ pop(edx); 5299 __ pop(edx);
5298 __ SmiUntag(edx); 5300 __ SmiUntag(edx);
5299 __ add(edx, Immediate(masm_->CodeObject())); 5301 __ add(edx, Immediate(masm_->CodeObject()));
5300 __ jmp(edx); 5302 __ jmp(edx);
5301 } 5303 }
5302 5304
5303 5305
5306 void FullCodeGenerator::ClearPendingMessage() {
5307 DCHECK(!result_register().is(edx));
5308 ExternalReference pending_message_obj =
5309 ExternalReference::address_of_pending_message_obj(isolate());
5310 __ mov(edx, Immediate(isolate()->factory()->the_hole_value()));
5311 __ mov(Operand::StaticVariable(pending_message_obj), edx);
5312 }
5313
5314
5304 #undef __ 5315 #undef __
5305 5316
5306 5317
5307 static const byte kJnsInstruction = 0x79; 5318 static const byte kJnsInstruction = 0x79;
5308 static const byte kJnsOffset = 0x11; 5319 static const byte kJnsOffset = 0x11;
5309 static const byte kNopByteOne = 0x66; 5320 static const byte kNopByteOne = 0x66;
5310 static const byte kNopByteTwo = 0x90; 5321 static const byte kNopByteTwo = 0x90;
5311 #ifdef DEBUG 5322 #ifdef DEBUG
5312 static const byte kCallInstruction = 0xe8; 5323 static const byte kCallInstruction = 0xe8;
5313 #endif 5324 #endif
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5377 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5388 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5378 Assembler::target_address_at(call_target_address, 5389 Assembler::target_address_at(call_target_address,
5379 unoptimized_code)); 5390 unoptimized_code));
5380 return OSR_AFTER_STACK_CHECK; 5391 return OSR_AFTER_STACK_CHECK;
5381 } 5392 }
5382 5393
5383 5394
5384 } } // namespace v8::internal 5395 } } // namespace v8::internal
5385 5396
5386 #endif // V8_TARGET_ARCH_IA32 5397 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698