Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index b038b7d577d5c678fd6fb008e35328662ea764a9..6e86ad5bf3a95fadb4dbabda9bf6b10497a2de3f 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2011 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -264,16 +264,24 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { |
__ j(above_equal, &ok, taken); |
StackCheckStub stub; |
__ CallStub(&stub); |
- __ bind(&ok); |
- PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
- PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); |
+ // Record a mapping of this PC offset to the OSR id. This is used to find |
+ // the AST id from the unoptimized code in order to use it as a key into |
+ // the deoptimization input data found in the optimized code. |
RecordStackCheck(stmt->OsrEntryId()); |
- // Loop stack checks can be patched to perform on-stack |
- // replacement. In order to decide whether or not to perform OSR we |
- // embed the loop depth in a test instruction after the call so we |
- // can extract it from the OSR builtin. |
+ |
+ // Loop stack checks can be patched to perform on-stack replacement. In |
+ // order to decide whether or not to perform OSR we embed the loop depth |
+ // in a test instruction after the call so we can extract it from the OSR |
+ // builtin. |
ASSERT(loop_depth() > 0); |
__ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker))); |
+ |
+ __ bind(&ok); |
+ PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
+ // Record a mapping of the OSR id to this PC. This is used if the OSR |
+ // entry becomes the target of a bailout. We don't expect it to be, but |
+ // we want it to work if it is. |
+ PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); |
} |