Commit f01e0831 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Assert that unoptimized code does not embed context-specific objects.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/690713003

Cr-Commit-Position: refs/heads/master@{#25029}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25029 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 48584766
......@@ -346,6 +346,11 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
info->SetCode(code);
void* line_info = masm.positions_recorder()->DetachJITHandlerData();
LOG_CODE_EVENT(isolate, CodeEndLinePosInfoRecordEvent(*code, line_info));
#ifdef DEBUG
// Check that no context-specific object has been embedded.
code->VerifyEmbeddedObjectsInFullCode();
#endif // DEBUG
return true;
}
......
......@@ -1218,6 +1218,24 @@ bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) {
}
void Code::VerifyEmbeddedObjectsInFullCode() {
// Check that no context-specific object has been embedded.
Heap* heap = GetIsolate()->heap();
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(this, mask); !it.done(); it.next()) {
Object* obj = it.rinfo()->target_object();
if (obj->IsCell()) obj = Cell::cast(obj)->value();
if (obj->IsPropertyCell()) obj = PropertyCell::cast(obj)->value();
if (!obj->IsHeapObject()) continue;
Map* map = obj->IsMap() ? Map::cast(obj) : HeapObject::cast(obj)->map();
int i = 0;
while (map != heap->roots_array_start()[i++]) {
CHECK_LT(i, Heap::kStrongRootListLength);
}
}
}
#endif // DEBUG
} } // namespace v8::internal
......@@ -5362,6 +5362,10 @@ class Code: public HeapObject {
void VerifyEmbeddedObjectsDependency();
#endif
#ifdef DEBUG
void VerifyEmbeddedObjectsInFullCode();
#endif // DEBUG
inline bool CanContainWeakObjects() {
return is_optimized_code() || is_weak_stub();
}
......
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