| Index: src/lithium-allocator.cc
|
| ===================================================================
|
| --- src/lithium-allocator.cc (revision 7563)
|
| +++ src/lithium-allocator.cc (working copy)
|
| @@ -25,6 +25,7 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +#include "v8.h"
|
| #include "lithium-allocator-inl.h"
|
|
|
| #include "hydrogen.h"
|
| @@ -44,13 +45,18 @@
|
| namespace internal {
|
|
|
|
|
| -#define DEFINE_OPERAND_CACHE(name, type) \
|
| - name name::cache[name::kNumCachedOperands]; \
|
| - void name::SetupCache() { \
|
| - for (int i = 0; i < kNumCachedOperands; i++) { \
|
| - cache[i].ConvertTo(type, i); \
|
| - } \
|
| - }
|
| +#define DEFINE_OPERAND_CACHE(name, type) \
|
| + name name::cache[name::kNumCachedOperands]; \
|
| + void name::SetupCache() { \
|
| + for (int i = 0; i < kNumCachedOperands; i++) { \
|
| + cache[i].ConvertTo(type, i); \
|
| + } \
|
| + } \
|
| + static bool name##_initialize() { \
|
| + name::SetupCache(); \
|
| + return true; \
|
| + } \
|
| + static bool name##_cache_initialized = name##_initialize();
|
|
|
| DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND)
|
| DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT)
|
| @@ -1021,6 +1027,22 @@
|
| chunk_->AddGapMove(cur_block->last_instruction_index() - 1,
|
| operand,
|
| phi_operand);
|
| +
|
| + // We are going to insert a move before the branch instruction.
|
| + // Some branch instructions (e.g. loops' back edges)
|
| + // can potentially cause a GC so they have a pointer map.
|
| + // By insterting a move we essentially create a copy of a
|
| + // value which is invisible to PopulatePointerMaps(), because we store
|
| + // it into a location different from the operand of a live range
|
| + // covering a branch instruction.
|
| + // Thus we need to manually record a pointer.
|
| + if (phi->representation().IsTagged()) {
|
| + LInstruction* branch =
|
| + InstructionAt(cur_block->last_instruction_index());
|
| + if (branch->HasPointerMap()) {
|
| + branch->pointer_map()->RecordPointer(phi_operand);
|
| + }
|
| + }
|
| }
|
|
|
| LiveRange* live_range = LiveRangeFor(phi->id());
|
| @@ -1550,15 +1572,6 @@
|
| }
|
|
|
|
|
| -void LAllocator::Setup() {
|
| - LConstantOperand::SetupCache();
|
| - LStackSlot::SetupCache();
|
| - LDoubleStackSlot::SetupCache();
|
| - LRegister::SetupCache();
|
| - LDoubleRegister::SetupCache();
|
| -}
|
| -
|
| -
|
| const char* LAllocator::RegisterName(int allocation_index) {
|
| ASSERT(mode_ != NONE);
|
| if (mode_ == GENERAL_REGISTERS) {
|
|
|