Reviewers: mvstanton,
Description:
Reenable code recompilation verification.
BUG=chromium:516304
LOG=N
Please review this at https://codereview.chromium.org/1267953002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+12, -3 lines):
M src/objects-debug.cc
M src/objects-inl.h
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index
3a2ec3e559a16863db44acfcbce63a72cc9762aa..de7b06f670c6874ad5f1c95f0d22469b931c1ef7
100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -4,6 +4,7 @@
#include "src/v8.h"
+#include "src/bootstrapper.h"
#include "src/disasm.h"
#include "src/disassembler.h"
#include "src/heap/objects-visiting.h"
@@ -1281,9 +1282,11 @@ void Code::VerifyEmbeddedObjects(VerifyMode mode) {
void Code::VerifyRecompiledCode(Code* old_code, Code* new_code) {
if (old_code->kind() != FUNCTION) return;
if (new_code->kind() != FUNCTION) return;
- static const int mask = RelocInfo::kCodeTargetMask;
-
Isolate* isolate = old_code->GetIsolate();
+ // Do not verify during bootstrapping. We may replace code
using %SetCode.
+ if (isolate->bootstrapper()->IsActive()) return;
+
+ static const int mask = RelocInfo::kCodeTargetMask;
RelocIterator old_it(old_code, mask);
RelocIterator new_it(new_code, mask);
Code* stack_check = isolate->builtins()->builtin(Builtins::kStackCheck);
@@ -1316,7 +1319,10 @@ void Code::VerifyRecompiledCode(Code* old_code,
Code* new_code) {
Code* new_target =
Code::GetCodeFromTargetAddress(new_it.rinfo()->target_address());
CHECK_EQ(old_target->kind(), new_target->kind());
- if (!old_target->is_handler() && !old_target->is_inline_cache_stub()) {
+ // Check call target for equality unless it's an IC or an interrupt
check.
+ // In both cases they may be patched to be something else.
+ if (!old_target->is_handler() && !old_target->is_inline_cache_stub() &&
+ new_target ==
isolate->builtins()->builtin(Builtins::kInterruptCheck)) {
CHECK_EQ(old_target, new_target);
}
old_it.next();
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
4929c0d2dfd56a70900d070e8d2b2e87f52120c2..ba5719b615d8f7485b24526a89b8b2a6904310ab
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5229,6 +5229,9 @@ void SharedFunctionInfo::ReplaceCode(Code* value) {
}
DCHECK(code()->gc_metadata() == NULL && value->gc_metadata() == NULL);
+#ifdef DEBUG
+ Code::VerifyRecompiledCode(code(), value);
+#endif // DEBUG
set_code(value);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.