| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 break; | 104 break; |
| 105 case DOUBLE_STACK_SLOT: | 105 case DOUBLE_STACK_SLOT: |
| 106 stream->Add("[double_stack:%d]", index()); | 106 stream->Add("[double_stack:%d]", index()); |
| 107 break; | 107 break; |
| 108 case REGISTER: | 108 case REGISTER: |
| 109 stream->Add("[%s|R]", Register::AllocationIndexToString(index())); | 109 stream->Add("[%s|R]", Register::AllocationIndexToString(index())); |
| 110 break; | 110 break; |
| 111 case DOUBLE_REGISTER: | 111 case DOUBLE_REGISTER: |
| 112 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); | 112 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); |
| 113 break; | 113 break; |
| 114 case ARGUMENT: | |
| 115 stream->Add("[arg:%d]", index()); | |
| 116 break; | |
| 117 } | 114 } |
| 118 } | 115 } |
| 119 | 116 |
| 120 #define DEFINE_OPERAND_CACHE(name, type) \ | 117 |
| 121 L##name* L##name::cache = NULL; \ | 118 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
| 122 \ | 119 LSubKindOperand<kOperandKind, kNumCachedOperands>* |
| 123 void L##name::SetUpCache() { \ | 120 LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL; |
| 124 if (cache) return; \ | 121 |
| 125 cache = new L##name[kNumCachedOperands]; \ | 122 |
| 126 for (int i = 0; i < kNumCachedOperands; i++) { \ | 123 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
| 127 cache[i].ConvertTo(type, i); \ | 124 void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() { |
| 128 } \ | 125 if (cache) return; |
| 129 } \ | 126 cache = new LSubKindOperand[kNumCachedOperands]; |
| 130 \ | 127 for (int i = 0; i < kNumCachedOperands; i++) { |
| 131 void L##name::TearDownCache() { \ | 128 cache[i].ConvertTo(kOperandKind, i); |
| 132 delete[] cache; \ | |
| 133 } | 129 } |
| 130 } |
| 134 | 131 |
| 135 LITHIUM_OPERAND_LIST(DEFINE_OPERAND_CACHE) | 132 |
| 136 #undef DEFINE_OPERAND_CACHE | 133 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
| 134 void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() { |
| 135 delete[] cache; |
| 136 } |
| 137 |
| 137 | 138 |
| 138 void LOperand::SetUpCaches() { | 139 void LOperand::SetUpCaches() { |
| 139 #define LITHIUM_OPERAND_SETUP(name, type) L##name::SetUpCache(); | 140 #define LITHIUM_OPERAND_SETUP(name, type, number) L##name::SetUpCache(); |
| 140 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP) | 141 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP) |
| 141 #undef LITHIUM_OPERAND_SETUP | 142 #undef LITHIUM_OPERAND_SETUP |
| 142 } | 143 } |
| 143 | 144 |
| 144 | 145 |
| 145 void LOperand::TearDownCaches() { | 146 void LOperand::TearDownCaches() { |
| 146 #define LITHIUM_OPERAND_TEARDOWN(name, type) L##name::TearDownCache(); | 147 #define LITHIUM_OPERAND_TEARDOWN(name, type, number) L##name::TearDownCache(); |
| 147 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN) | 148 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN) |
| 148 #undef LITHIUM_OPERAND_TEARDOWN | 149 #undef LITHIUM_OPERAND_TEARDOWN |
| 149 } | 150 } |
| 150 | 151 |
| 151 | 152 |
| 152 bool LParallelMove::IsRedundant() const { | 153 bool LParallelMove::IsRedundant() const { |
| 153 for (int i = 0; i < move_operands_.length(); ++i) { | 154 for (int i = 0; i < move_operands_.length(); ++i) { |
| 154 if (!move_operands_[i].IsRedundant()) return false; | 155 if (!move_operands_[i].IsRedundant()) return false; |
| 155 } | 156 } |
| 156 return true; | 157 return true; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 zone()); | 492 zone()); |
| 492 int argument_index = *argument_index_accumulator; | 493 int argument_index = *argument_index_accumulator; |
| 493 | 494 |
| 494 // Store the environment description into the environment | 495 // Store the environment description into the environment |
| 495 // (with holes for nested objects) | 496 // (with holes for nested objects) |
| 496 for (int i = 0; i < hydrogen_env->length(); ++i) { | 497 for (int i = 0; i < hydrogen_env->length(); ++i) { |
| 497 if (hydrogen_env->is_special_index(i)) continue; | 498 if (hydrogen_env->is_special_index(i)) continue; |
| 498 | 499 |
| 499 LOperand* op; | 500 LOperand* op; |
| 500 HValue* value = hydrogen_env->values()->at(i); | 501 HValue* value = hydrogen_env->values()->at(i); |
| 502 CHECK(!value->IsPushArgument()); // Do not deopt outgoing arguments |
| 501 if (value->IsArgumentsObject() || value->IsCapturedObject()) { | 503 if (value->IsArgumentsObject() || value->IsCapturedObject()) { |
| 502 op = LEnvironment::materialization_marker(); | 504 op = LEnvironment::materialization_marker(); |
| 503 } else if (value->IsPushArgument()) { | |
| 504 op = new(zone()) LArgument(argument_index++); | |
| 505 } else { | 505 } else { |
| 506 op = UseAny(value); | 506 op = UseAny(value); |
| 507 } | 507 } |
| 508 result->AddValue(op, | 508 result->AddValue(op, |
| 509 value->representation(), | 509 value->representation(), |
| 510 value->CheckFlag(HInstruction::kUint32)); | 510 value->CheckFlag(HInstruction::kUint32)); |
| 511 } | 511 } |
| 512 | 512 |
| 513 // Recursively store the nested objects into the environment | 513 // Recursively store the nested objects into the environment |
| 514 for (int i = 0; i < hydrogen_env->length(); ++i) { | 514 for (int i = 0; i < hydrogen_env->length(); ++i) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 608 |
| 609 | 609 |
| 610 LPhase::~LPhase() { | 610 LPhase::~LPhase() { |
| 611 if (ShouldProduceTraceOutput()) { | 611 if (ShouldProduceTraceOutput()) { |
| 612 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 612 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 | 616 |
| 617 } } // namespace v8::internal | 617 } } // namespace v8::internal |
| OLD | NEW |