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

Side by Side Diff: src/arm64/full-codegen-arm64.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/arm/full-codegen-arm.cc ('k') | src/compiler/ast-graph-builder.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after
5356 __ Sub(x10, lr, Operand(masm_->CodeObject())); 5356 __ Sub(x10, lr, Operand(masm_->CodeObject()));
5357 __ SmiTag(x10); 5357 __ SmiTag(x10);
5358 __ Push(result_register(), x10); 5358 __ Push(result_register(), x10);
5359 5359
5360 // Store pending message while executing finally block. 5360 // Store pending message while executing finally block.
5361 ExternalReference pending_message_obj = 5361 ExternalReference pending_message_obj =
5362 ExternalReference::address_of_pending_message_obj(isolate()); 5362 ExternalReference::address_of_pending_message_obj(isolate());
5363 __ Mov(x10, pending_message_obj); 5363 __ Mov(x10, pending_message_obj);
5364 __ Ldr(x10, MemOperand(x10)); 5364 __ Ldr(x10, MemOperand(x10));
5365 __ Push(x10); 5365 __ Push(x10);
5366
5367 ClearPendingMessage();
5366 } 5368 }
5367 5369
5368 5370
5369 void FullCodeGenerator::ExitFinallyBlock() { 5371 void FullCodeGenerator::ExitFinallyBlock() {
5370 ASM_LOCATION("FullCodeGenerator::ExitFinallyBlock"); 5372 ASM_LOCATION("FullCodeGenerator::ExitFinallyBlock");
5371 DCHECK(!result_register().is(x10)); 5373 DCHECK(!result_register().is(x10));
5372 5374
5373 // Restore pending message from stack. 5375 // Restore pending message from stack.
5374 __ Pop(x10); 5376 __ Pop(x10);
5375 ExternalReference pending_message_obj = 5377 ExternalReference pending_message_obj =
5376 ExternalReference::address_of_pending_message_obj(isolate()); 5378 ExternalReference::address_of_pending_message_obj(isolate());
5377 __ Mov(x13, pending_message_obj); 5379 __ Mov(x13, pending_message_obj);
5378 __ Str(x10, MemOperand(x13)); 5380 __ Str(x10, MemOperand(x13));
5379 5381
5380 // Restore result register and cooked return address from the stack. 5382 // Restore result register and cooked return address from the stack.
5381 __ Pop(x10, result_register()); 5383 __ Pop(x10, result_register());
5382 5384
5383 // Uncook the return address (see EnterFinallyBlock). 5385 // Uncook the return address (see EnterFinallyBlock).
5384 __ SmiUntag(x10); 5386 __ SmiUntag(x10);
5385 __ Add(x11, x10, Operand(masm_->CodeObject())); 5387 __ Add(x11, x10, Operand(masm_->CodeObject()));
5386 __ Br(x11); 5388 __ Br(x11);
5387 } 5389 }
5388 5390
5389 5391
5392 void FullCodeGenerator::ClearPendingMessage() {
5393 DCHECK(!result_register().is(x10));
5394 ExternalReference pending_message_obj =
5395 ExternalReference::address_of_pending_message_obj(isolate());
5396 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
5397 __ Mov(x13, pending_message_obj);
5398 __ Str(x10, MemOperand(x13));
5399 }
5400
5401
5390 #undef __ 5402 #undef __
5391 5403
5392 5404
5393 void BackEdgeTable::PatchAt(Code* unoptimized_code, 5405 void BackEdgeTable::PatchAt(Code* unoptimized_code,
5394 Address pc, 5406 Address pc,
5395 BackEdgeState target_state, 5407 BackEdgeState target_state,
5396 Code* replacement_code) { 5408 Code* replacement_code) {
5397 // Turn the jump into a nop. 5409 // Turn the jump into a nop.
5398 Address branch_address = pc - 3 * kInstructionSize; 5410 Address branch_address = pc - 3 * kInstructionSize;
5399 PatchingAssembler patcher(branch_address, 1); 5411 PatchingAssembler patcher(branch_address, 1);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
5481 } 5493 }
5482 } 5494 }
5483 5495
5484 return INTERRUPT; 5496 return INTERRUPT;
5485 } 5497 }
5486 5498
5487 5499
5488 } } // namespace v8::internal 5500 } } // namespace v8::internal
5489 5501
5490 #endif // V8_TARGET_ARCH_ARM64 5502 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698