Reviewers: Søren Gjesse, Kevin Millikin,
Description:
Merge bleeding edge r6035 to 2.5 branch. Fix for push of random value
in connection with try-catch in the full codegenerator.
Please review this at http://codereview.chromium.org/6052004/
SVN Base: http://v8.googlecode.com/svn/branches/2.5/
Affected files:
M src/arm/full-codegen-arm.cc
M src/full-codegen.h
M src/full-codegen.cc
M src/ia32/full-codegen-ia32.cc
M src/version.cc
M src/x64/full-codegen-x64.cc
A + test/mjsunit/regress/regress-974.js
### BEGIN SVN COPY METADATA
#$ cp branches/bleeding_edge/test/mjsunit/regress/regress-974.js
test/mjsunit/regress/regress-974.js
### END SVN COPY METADATA
Index: src/arm/full-codegen-arm.cc
===================================================================
--- src/arm/full-codegen-arm.cc (revision 6104)
+++ src/arm/full-codegen-arm.cc (working copy)
@@ -203,6 +203,11 @@
}
+void FullCodeGenerator::ClearAccumulator() {
+ __ mov(r0, Operand(Smi::FromInt(0)));
+}
+
+
void FullCodeGenerator::EmitReturnSequence() {
Comment cmnt(masm_, "[ Return sequence");
if (return_label_.is_bound()) {
Index: src/full-codegen.cc
===================================================================
--- src/full-codegen.cc (revision 6104)
+++ src/full-codegen.cc (working copy)
@@ -795,6 +795,11 @@
SetStatementPosition(stmt);
NestedStatement* current = nesting_stack_;
int stack_depth = 0;
+ // When continuing, we clobber the unpredictable value in the accumulator
+ // with one that's safe for GC. If we hit an exit from the try block of
+ // try...finally on our way out, we will unconditionally preserve the
+ // accumulator on the stack.
+ ClearAccumulator();
while (!current->IsContinueTarget(stmt->target())) {
stack_depth = current->Exit(stack_depth);
current = current->outer();
@@ -811,6 +816,11 @@
SetStatementPosition(stmt);
NestedStatement* current = nesting_stack_;
int stack_depth = 0;
+ // When breaking, we clobber the unpredictable value in the accumulator
+ // with one that's safe for GC. If we hit an exit from the try block of
+ // try...finally on our way out, we will unconditionally preserve the
+ // accumulator on the stack.
+ ClearAccumulator();
while (!current->IsBreakTarget(stmt->target())) {
stack_depth = current->Exit(stack_depth);
current = current->outer();
@@ -1100,7 +1110,10 @@
Visit(stmt->try_block());
__ PopTryHandler();
}
- // Execute the finally block on the way out.
+ // Execute the finally block on the way out. Clobber the unpredictable
+ // value in the accumulator with one that's safe for GC. The finally
+ // block will unconditionally preserve the accumulator on the stack.
+ ClearAccumulator();
__ Call(&finally_entry);
}
Index: src/full-codegen.h
===================================================================
--- src/full-codegen.h (revision 6104)
+++ src/full-codegen.h (working copy)
@@ -241,6 +241,10 @@
static const InlineFunctionGenerator kInlineFunctionGenerators[];
+ // A platform-specific utility to overwrite the accumulator register
+ // with a GC-safe value.
+ void ClearAccumulator();
+
// Compute the frame pointer relative offset for a given local or
// parameter slot.
int SlotOffset(Slot* slot);
Index: src/ia32/full-codegen-ia32.cc
===================================================================
--- src/ia32/full-codegen-ia32.cc (revision 6104)
+++ src/ia32/full-codegen-ia32.cc (working copy)
@@ -197,6 +197,11 @@
}
+void FullCodeGenerator::ClearAccumulator() {
+ __ Set(eax, Immediate(Smi::FromInt(0)));
+}
+
+
void FullCodeGenerator::EmitReturnSequence() {
Comment cmnt(masm_, "[ Return sequence");
if (return_label_.is_bound()) {
Index: src/version.cc
===================================================================
--- src/version.cc (revision 6104)
+++ src/version.cc (working copy)
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 2
#define MINOR_VERSION 5
#define BUILD_NUMBER 9
-#define PATCH_LEVEL 4
+#define PATCH_LEVEL 5
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
Index: src/x64/full-codegen-x64.cc
===================================================================
--- src/x64/full-codegen-x64.cc (revision 6104)
+++ src/x64/full-codegen-x64.cc (working copy)
@@ -197,6 +197,11 @@
}
+void FullCodeGenerator::ClearAccumulator() {
+ __ xor(rax, rax);
+}
+
+
void FullCodeGenerator::EmitReturnSequence() {
Comment cmnt(masm_, "[ Return sequence");
if (return_label_.is_bound()) {
Index: test/mjsunit/regress/regress-974.js
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev