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

Side by Side Diff: src/x64/full-codegen-x64.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/ppc/full-codegen-ppc.cc ('k') | src/x87/full-codegen-x87.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_X64 7 #if V8_TARGET_ARCH_X64
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 5277 matching lines...) Expand 10 before | Expand all | Expand 10 after
5288 __ Push(rdx); 5288 __ Push(rdx);
5289 5289
5290 // Store result register while executing finally block. 5290 // Store result register while executing finally block.
5291 __ Push(result_register()); 5291 __ Push(result_register());
5292 5292
5293 // Store pending message while executing finally block. 5293 // Store pending message while executing finally block.
5294 ExternalReference pending_message_obj = 5294 ExternalReference pending_message_obj =
5295 ExternalReference::address_of_pending_message_obj(isolate()); 5295 ExternalReference::address_of_pending_message_obj(isolate());
5296 __ Load(rdx, pending_message_obj); 5296 __ Load(rdx, pending_message_obj);
5297 __ Push(rdx); 5297 __ Push(rdx);
5298
5299 ClearPendingMessage();
5298 } 5300 }
5299 5301
5300 5302
5301 void FullCodeGenerator::ExitFinallyBlock() { 5303 void FullCodeGenerator::ExitFinallyBlock() {
5302 DCHECK(!result_register().is(rdx)); 5304 DCHECK(!result_register().is(rdx));
5303 DCHECK(!result_register().is(rcx)); 5305 DCHECK(!result_register().is(rcx));
5304 // Restore pending message from stack. 5306 // Restore pending message from stack.
5305 __ Pop(rdx); 5307 __ Pop(rdx);
5306 ExternalReference pending_message_obj = 5308 ExternalReference pending_message_obj =
5307 ExternalReference::address_of_pending_message_obj(isolate()); 5309 ExternalReference::address_of_pending_message_obj(isolate());
5308 __ Store(pending_message_obj, rdx); 5310 __ Store(pending_message_obj, rdx);
5309 5311
5310 // Restore result register from stack. 5312 // Restore result register from stack.
5311 __ Pop(result_register()); 5313 __ Pop(result_register());
5312 5314
5313 // Uncook return address. 5315 // Uncook return address.
5314 __ Pop(rdx); 5316 __ Pop(rdx);
5315 __ SmiToInteger32(rdx, rdx); 5317 __ SmiToInteger32(rdx, rdx);
5316 __ Move(rcx, masm_->CodeObject()); 5318 __ Move(rcx, masm_->CodeObject());
5317 __ addp(rdx, rcx); 5319 __ addp(rdx, rcx);
5318 __ jmp(rdx); 5320 __ jmp(rdx);
5319 } 5321 }
5320 5322
5321 5323
5324 void FullCodeGenerator::ClearPendingMessage() {
5325 DCHECK(!result_register().is(rdx));
5326 ExternalReference pending_message_obj =
5327 ExternalReference::address_of_pending_message_obj(isolate());
5328 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
5329 __ Store(pending_message_obj, rdx);
5330 }
5331
5332
5322 #undef __ 5333 #undef __
5323 5334
5324 5335
5325 static const byte kJnsInstruction = 0x79; 5336 static const byte kJnsInstruction = 0x79;
5326 static const byte kNopByteOne = 0x66; 5337 static const byte kNopByteOne = 0x66;
5327 static const byte kNopByteTwo = 0x90; 5338 static const byte kNopByteTwo = 0x90;
5328 #ifdef DEBUG 5339 #ifdef DEBUG
5329 static const byte kCallInstruction = 0xe8; 5340 static const byte kCallInstruction = 0xe8;
5330 #endif 5341 #endif
5331 5342
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5395 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5406 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5396 Assembler::target_address_at(call_target_address, 5407 Assembler::target_address_at(call_target_address,
5397 unoptimized_code)); 5408 unoptimized_code));
5398 return OSR_AFTER_STACK_CHECK; 5409 return OSR_AFTER_STACK_CHECK;
5399 } 5410 }
5400 5411
5401 5412
5402 } } // namespace v8::internal 5413 } } // namespace v8::internal
5403 5414
5404 #endif // V8_TARGET_ARCH_X64 5415 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698