~ubuntu-branches/ubuntu/trusty/libv8/trusty

« back to all changes in this revision

Viewing changes to src/ia32/assembler-ia32-inl.h

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-02-20 14:08:17 UTC
  • mfrom: (15.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20120220140817-bsvmeoa4sxsj5hbz
Tags: 3.7.12.22-3
Fix mipsel build, allow test debug-step-3 to fail (non-crucial)

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
 
80
80
Address RelocInfo::target_address_address() {
81
 
  ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
 
81
  ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY
 
82
                              || rmode_ == EMBEDDED_OBJECT
 
83
                              || rmode_ == EXTERNAL_REFERENCE);
82
84
  return reinterpret_cast<Address>(pc_);
83
85
}
84
86
 
88
90
}
89
91
 
90
92
 
91
 
void RelocInfo::set_target_address(Address target) {
92
 
  ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
 
93
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
93
94
  Assembler::set_target_address_at(pc_, target);
 
95
  ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
 
96
  if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
 
97
    Object* target_code = Code::GetCodeFromTargetAddress(target);
 
98
    host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
 
99
        host(), this, HeapObject::cast(target_code));
 
100
  }
94
101
}
95
102
 
96
103
 
112
119
}
113
120
 
114
121
 
115
 
void RelocInfo::set_target_object(Object* target) {
 
122
void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
116
123
  ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
117
124
  Memory::Object_at(pc_) = target;
118
125
  CPU::FlushICache(pc_, sizeof(Address));
 
126
  if (mode == UPDATE_WRITE_BARRIER &&
 
127
      host() != NULL &&
 
128
      target->IsHeapObject()) {
 
129
    host()->GetHeap()->incremental_marking()->RecordWrite(
 
130
        host(), &Memory::Object_at(pc_), HeapObject::cast(target));
 
131
  }
119
132
}
120
133
 
121
134
 
142
155
}
143
156
 
144
157
 
145
 
void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
 
158
void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell,
 
159
                                WriteBarrierMode mode) {
146
160
  ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
147
161
  Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
148
162
  Memory::Address_at(pc_) = address;
149
163
  CPU::FlushICache(pc_, sizeof(Address));
 
164
  if (mode == UPDATE_WRITE_BARRIER && host() != NULL) {
 
165
    // TODO(1550) We are passing NULL as a slot because cell can never be on
 
166
    // evacuation candidate.
 
167
    host()->GetHeap()->incremental_marking()->RecordWrite(
 
168
        host(), NULL, cell);
 
169
  }
150
170
}
151
171
 
152
172
 
161
181
  ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
162
182
         (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
163
183
  Assembler::set_target_address_at(pc_ + 1, target);
 
184
  if (host() != NULL) {
 
185
    Object* target_code = Code::GetCodeFromTargetAddress(target);
 
186
    host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
 
187
        host(), this, HeapObject::cast(target_code));
 
188
  }
164
189
}
165
190
 
166
191
 
194
219
void RelocInfo::Visit(ObjectVisitor* visitor) {
195
220
  RelocInfo::Mode mode = rmode();
196
221
  if (mode == RelocInfo::EMBEDDED_OBJECT) {
197
 
    visitor->VisitPointer(target_object_address());
 
222
    visitor->VisitEmbeddedPointer(this);
198
223
    CPU::FlushICache(pc_, sizeof(Address));
199
224
  } else if (RelocInfo::IsCodeTarget(mode)) {
200
225
    visitor->VisitCodeTarget(this);
201
226
  } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
202
227
    visitor->VisitGlobalPropertyCell(this);
203
228
  } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
204
 
    visitor->VisitExternalReference(target_reference_address());
 
229
    visitor->VisitExternalReference(this);
205
230
    CPU::FlushICache(pc_, sizeof(Address));
206
231
#ifdef ENABLE_DEBUGGER_SUPPORT
207
232
  // TODO(isolates): Get a cached isolate below.
222
247
void RelocInfo::Visit(Heap* heap) {
223
248
  RelocInfo::Mode mode = rmode();
224
249
  if (mode == RelocInfo::EMBEDDED_OBJECT) {
225
 
    StaticVisitor::VisitPointer(heap, target_object_address());
 
250
    StaticVisitor::VisitEmbeddedPointer(heap, this);
226
251
    CPU::FlushICache(pc_, sizeof(Address));
227
252
  } else if (RelocInfo::IsCodeTarget(mode)) {
228
253
    StaticVisitor::VisitCodeTarget(heap, this);
229
254
  } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
230
255
    StaticVisitor::VisitGlobalPropertyCell(heap, this);
231
256
  } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
232
 
    StaticVisitor::VisitExternalReference(target_reference_address());
 
257
    StaticVisitor::VisitExternalReference(this);
233
258
    CPU::FlushICache(pc_, sizeof(Address));
234
259
#ifdef ENABLE_DEBUGGER_SUPPORT
235
260
  } else if (heap->isolate()->debug()->has_break_points() &&