Commit 6a4d5b42 authored by ulan@chromium.org's avatar ulan@chromium.org

Invalidate embedded objects in optimized code if it was marked for deoptimization.

It avoids having dead pointers in code from the time it was marked for deoptimization until it is deoptimized.

BUG=320532,v8:2996
TEST=mjsunit/regress/regress-320532.js
LOG=Y
R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18013 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c0c5efb9
......@@ -2655,6 +2655,7 @@ void MarkCompactCollector::ClearAndDeoptimizeDependentCode(
if (IsMarked(code) && !code->marked_for_deoptimization()) {
code->set_marked_for_deoptimization(true);
code->InvalidateEmbeddedObjects();
have_code_to_deoptimize_ = true;
}
entries->clear_at(i);
......
......@@ -10402,6 +10402,18 @@ void Code::InvalidateRelocation() {
}
void Code::InvalidateEmbeddedObjects() {
Object* undefined = GetHeap()->undefined_value();
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT) {
it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
}
}
}
void Code::Relocate(intptr_t delta) {
for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
it.rinfo()->apply(delta);
......
......@@ -5054,6 +5054,7 @@ class Code: public HeapObject {
// [relocation_info]: Code relocation information
DECL_ACCESSORS(relocation_info, ByteArray)
void InvalidateRelocation();
void InvalidateEmbeddedObjects();
// [handler_table]: Fixed array containing offsets of exception handlers.
DECL_ACCESSORS(handler_table, FixedArray)
......
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