Fix missing tagging of stack value in finally block.

R=yangguo@chromium.org
BUG=chromium:137496
TEST=cctest/test-api/Regress137496

Review URL: https://chromiumcodereview.appspot.com/10787017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12096 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9f04c321
...@@ -4509,6 +4509,7 @@ void FullCodeGenerator::EnterFinallyBlock() { ...@@ -4509,6 +4509,7 @@ void FullCodeGenerator::EnterFinallyBlock() {
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ mov(ip, Operand(has_pending_message)); __ mov(ip, Operand(has_pending_message));
__ ldr(r1, MemOperand(ip)); __ ldr(r1, MemOperand(ip));
__ SmiTag(r1);
__ push(r1); __ push(r1);
ExternalReference pending_message_script = ExternalReference pending_message_script =
...@@ -4529,6 +4530,7 @@ void FullCodeGenerator::ExitFinallyBlock() { ...@@ -4529,6 +4530,7 @@ void FullCodeGenerator::ExitFinallyBlock() {
__ str(r1, MemOperand(ip)); __ str(r1, MemOperand(ip));
__ pop(r1); __ pop(r1);
__ SmiUntag(r1);
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ mov(ip, Operand(has_pending_message)); __ mov(ip, Operand(has_pending_message));
......
...@@ -4485,6 +4485,7 @@ void FullCodeGenerator::EnterFinallyBlock() { ...@@ -4485,6 +4485,7 @@ void FullCodeGenerator::EnterFinallyBlock() {
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ mov(edx, Operand::StaticVariable(has_pending_message)); __ mov(edx, Operand::StaticVariable(has_pending_message));
__ SmiTag(edx);
__ push(edx); __ push(edx);
ExternalReference pending_message_script = ExternalReference pending_message_script =
...@@ -4503,6 +4504,7 @@ void FullCodeGenerator::ExitFinallyBlock() { ...@@ -4503,6 +4504,7 @@ void FullCodeGenerator::ExitFinallyBlock() {
__ mov(Operand::StaticVariable(pending_message_script), edx); __ mov(Operand::StaticVariable(pending_message_script), edx);
__ pop(edx); __ pop(edx);
__ SmiUntag(edx);
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ mov(Operand::StaticVariable(has_pending_message), edx); __ mov(Operand::StaticVariable(has_pending_message), edx);
......
...@@ -4545,6 +4545,7 @@ void FullCodeGenerator::EnterFinallyBlock() { ...@@ -4545,6 +4545,7 @@ void FullCodeGenerator::EnterFinallyBlock() {
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ li(at, Operand(has_pending_message)); __ li(at, Operand(has_pending_message));
__ lw(a1, MemOperand(at)); __ lw(a1, MemOperand(at));
__ SmiTag(a1);
__ push(a1); __ push(a1);
ExternalReference pending_message_script = ExternalReference pending_message_script =
...@@ -4565,6 +4566,7 @@ void FullCodeGenerator::ExitFinallyBlock() { ...@@ -4565,6 +4566,7 @@ void FullCodeGenerator::ExitFinallyBlock() {
__ sw(a1, MemOperand(at)); __ sw(a1, MemOperand(at));
__ pop(a1); __ pop(a1);
__ SmiUntag(a1);
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ li(at, Operand(has_pending_message)); __ li(at, Operand(has_pending_message));
......
...@@ -4477,6 +4477,7 @@ void FullCodeGenerator::EnterFinallyBlock() { ...@@ -4477,6 +4477,7 @@ void FullCodeGenerator::EnterFinallyBlock() {
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ Load(rdx, has_pending_message); __ Load(rdx, has_pending_message);
__ Integer32ToSmi(rdx, rdx);
__ push(rdx); __ push(rdx);
ExternalReference pending_message_script = ExternalReference pending_message_script =
...@@ -4496,6 +4497,7 @@ void FullCodeGenerator::ExitFinallyBlock() { ...@@ -4496,6 +4497,7 @@ void FullCodeGenerator::ExitFinallyBlock() {
__ Store(pending_message_script, rdx); __ Store(pending_message_script, rdx);
__ pop(rdx); __ pop(rdx);
__ SmiToInteger32(rdx, rdx);
ExternalReference has_pending_message = ExternalReference has_pending_message =
ExternalReference::address_of_has_pending_message(isolate()); ExternalReference::address_of_has_pending_message(isolate());
__ Store(has_pending_message, rdx); __ Store(has_pending_message, rdx);
......
...@@ -16856,3 +16856,17 @@ THREADED_TEST(Regress137002b) { ...@@ -16856,3 +16856,17 @@ THREADED_TEST(Regress137002b) {
"var result = f(obj);"); "var result = f(obj);");
CHECK(context->Global()->Get(v8_str("result"))->IsUndefined()); CHECK(context->Global()->Get(v8_str("result"))->IsUndefined());
} }
THREADED_TEST(Regress137496) {
i::FLAG_expose_gc = true;
v8::HandleScope scope;
LocalContext context;
// Compile a try-finally clause where the finally block causes a GC
// while there still is a message pending for external reporting.
TryCatch try_catch;
try_catch.SetVerbose(true);
CompileRun("try { throw new Error(); } finally { gc(); }");
CHECK(try_catch.HasCaught());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment