OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 299 |
300 | 300 |
301 void StackHandler::Cook(Code* code) { | 301 void StackHandler::Cook(Code* code) { |
302 ASSERT(MarkCompactCollector::IsCompacting()); | 302 ASSERT(MarkCompactCollector::IsCompacting()); |
303 ASSERT(code->contains(pc())); | 303 ASSERT(code->contains(pc())); |
304 set_pc(AddressFrom<Address>(pc() - code->instruction_start())); | 304 set_pc(AddressFrom<Address>(pc() - code->instruction_start())); |
305 } | 305 } |
306 | 306 |
307 | 307 |
308 void StackHandler::Uncook(Code* code) { | 308 void StackHandler::Uncook(Code* code) { |
309 ASSERT(MarkCompactCollector::IsCompacting()); | 309 ASSERT(MarkCompactCollector::HasCompacted()); |
310 set_pc(code->instruction_start() + OffsetFrom(pc())); | 310 set_pc(code->instruction_start() + OffsetFrom(pc())); |
311 ASSERT(code->contains(pc())); | 311 ASSERT(code->contains(pc())); |
312 } | 312 } |
313 | 313 |
314 | 314 |
315 // ------------------------------------------------------------------------- | 315 // ------------------------------------------------------------------------- |
316 | 316 |
317 | 317 |
318 bool StackFrame::HasHandler() const { | 318 bool StackFrame::HasHandler() const { |
319 StackHandlerIterator it(this, top_handler()); | 319 StackHandlerIterator it(this, top_handler()); |
320 return !it.done(); | 320 return !it.done(); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void StackFrame::CookFramesForThread(ThreadLocalTop* thread) { | 324 void StackFrame::CookFramesForThread(ThreadLocalTop* thread) { |
325 // Only cooking frames when the collector is compacting and thus moving code | 325 // Only cooking frames when the collector is compacting and thus moving code |
326 // around. | 326 // around. |
327 ASSERT(MarkCompactCollector::IsCompacting()); | 327 ASSERT(MarkCompactCollector::IsCompacting()); |
328 ASSERT(!thread->stack_is_cooked()); | 328 ASSERT(!thread->stack_is_cooked()); |
329 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { | 329 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { |
330 it.frame()->Cook(); | 330 it.frame()->Cook(); |
331 } | 331 } |
332 thread->set_stack_is_cooked(true); | 332 thread->set_stack_is_cooked(true); |
333 } | 333 } |
334 | 334 |
335 | 335 |
336 void StackFrame::UncookFramesForThread(ThreadLocalTop* thread) { | 336 void StackFrame::UncookFramesForThread(ThreadLocalTop* thread) { |
337 // Only uncooking frames when the collector is compacting and thus moving code | 337 // Only uncooking frames when the collector is compacting and thus moving code |
338 // around. | 338 // around. |
339 ASSERT(MarkCompactCollector::IsCompacting()); | 339 ASSERT(MarkCompactCollector::HasCompacted()); |
340 ASSERT(thread->stack_is_cooked()); | 340 ASSERT(thread->stack_is_cooked()); |
341 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { | 341 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { |
342 it.frame()->Uncook(); | 342 it.frame()->Uncook(); |
343 } | 343 } |
344 thread->set_stack_is_cooked(false); | 344 thread->set_stack_is_cooked(false); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void StackFrame::Cook() { | 348 void StackFrame::Cook() { |
349 Code* code = this->code(); | 349 Code* code = this->code(); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 reg_code[i++] = r; | 740 reg_code[i++] = r; |
741 | 741 |
742 ASSERT(i == kNumJSCallerSaved); | 742 ASSERT(i == kNumJSCallerSaved); |
743 } | 743 } |
744 ASSERT(0 <= n && n < kNumJSCallerSaved); | 744 ASSERT(0 <= n && n < kNumJSCallerSaved); |
745 return reg_code[n]; | 745 return reg_code[n]; |
746 } | 746 } |
747 | 747 |
748 | 748 |
749 } } // namespace v8::internal | 749 } } // namespace v8::internal |
OLD | NEW |