Ensure deopt entries have no relocation information.

R=ulan@chromium.org
BUG=chromium:176943

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3a1eca42
...@@ -101,6 +101,7 @@ UnaryMathFunction CreateExpFunction() { ...@@ -101,6 +101,7 @@ UnaryMathFunction CreateExpFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
......
...@@ -689,6 +689,21 @@ RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { ...@@ -689,6 +689,21 @@ RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
// Implementation of RelocInfo // Implementation of RelocInfo
#ifdef DEBUG
bool RelocInfo::RequiresRelocation(const CodeDesc& desc) {
// Ensure there are no code targets or embedded objects present in the
// deoptimization entries, they would require relocation after code
// generation.
int mode_mask = RelocInfo::kCodeTargetMask |
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) |
RelocInfo::kApplyMask;
RelocIterator it(desc, mode_mask);
return !it.done();
}
#endif
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
switch (rmode) { switch (rmode) {
......
...@@ -409,6 +409,12 @@ class RelocInfo BASE_EMBEDDED { ...@@ -409,6 +409,12 @@ class RelocInfo BASE_EMBEDDED {
// debugger. // debugger.
INLINE(bool IsPatchedDebugBreakSlotSequence()); INLINE(bool IsPatchedDebugBreakSlotSequence());
#ifdef DEBUG
// Check whether the given code contains relocation information that
// either is position-relative or movable by the garbage collector.
static bool RequiresRelocation(const CodeDesc& desc);
#endif
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
// Printing // Printing
static const char* RelocModeName(Mode rmode); static const char* RelocModeName(Mode rmode);
......
...@@ -1588,6 +1588,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(BailoutType type, ...@@ -1588,6 +1588,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(BailoutType type,
GenerateDeoptimizationEntries(&masm, entry_count, type); GenerateDeoptimizationEntries(&masm, entry_count, type);
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
MemoryChunk* chunk = type == EAGER MemoryChunk* chunk = type == EAGER
? data->eager_deoptimization_entry_code_ ? data->eager_deoptimization_entry_code_
......
...@@ -94,7 +94,7 @@ UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) { ...@@ -94,7 +94,7 @@ UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(desc.reloc_size == 0); ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
...@@ -132,6 +132,7 @@ UnaryMathFunction CreateExpFunction() { ...@@ -132,6 +132,7 @@ UnaryMathFunction CreateExpFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
...@@ -164,7 +165,7 @@ UnaryMathFunction CreateSqrtFunction() { ...@@ -164,7 +165,7 @@ UnaryMathFunction CreateSqrtFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(desc.reloc_size == 0); ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
...@@ -374,7 +375,7 @@ OS::MemCopyFunction CreateMemCopyFunction() { ...@@ -374,7 +375,7 @@ OS::MemCopyFunction CreateMemCopyFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(desc.reloc_size == 0); ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
......
...@@ -101,6 +101,7 @@ UnaryMathFunction CreateExpFunction() { ...@@ -101,6 +101,7 @@ UnaryMathFunction CreateExpFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
......
...@@ -91,7 +91,7 @@ UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) { ...@@ -91,7 +91,7 @@ UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(desc.reloc_size == 0); ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
...@@ -122,6 +122,7 @@ UnaryMathFunction CreateExpFunction() { ...@@ -122,6 +122,7 @@ UnaryMathFunction CreateExpFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
...@@ -145,7 +146,7 @@ UnaryMathFunction CreateSqrtFunction() { ...@@ -145,7 +146,7 @@ UnaryMathFunction CreateSqrtFunction() {
CodeDesc desc; CodeDesc desc;
masm.GetCode(&desc); masm.GetCode(&desc);
ASSERT(desc.reloc_size == 0); ASSERT(!RelocInfo::RequiresRelocation(desc));
CPU::FlushICache(buffer, actual_size); CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size); OS::ProtectCode(buffer, actual_size);
......
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