| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/hydrogen-instructions.h" | 5 #include "src/crankshaft/hydrogen-instructions.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/ieee754.h" | 8 #include "src/base/ieee754.h" |
| 9 #include "src/base/safe_math.h" | 9 #include "src/base/safe_math.h" |
| 10 #include "src/crankshaft/hydrogen-infer-representation.h" | 10 #include "src/crankshaft/hydrogen-infer-representation.h" |
| (...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3177 if (!current_size->IsInteger32Constant() || | 3177 if (!current_size->IsInteger32Constant() || |
| 3178 !dominator_size->IsInteger32Constant()) { | 3178 !dominator_size->IsInteger32Constant()) { |
| 3179 if (FLAG_trace_allocation_folding) { | 3179 if (FLAG_trace_allocation_folding) { |
| 3180 PrintF("#%d (%s) cannot fold into #%d (%s), " | 3180 PrintF("#%d (%s) cannot fold into #%d (%s), " |
| 3181 "dynamic allocation size in dominator\n", | 3181 "dynamic allocation size in dominator\n", |
| 3182 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3182 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3183 } | 3183 } |
| 3184 return false; | 3184 return false; |
| 3185 } | 3185 } |
| 3186 | 3186 |
| 3187 if (IsAllocationFoldingDominator()) { |
| 3188 if (FLAG_trace_allocation_folding) { |
| 3189 PrintF("#%d (%s) cannot fold into #%d (%s), already dominator\n", id(), |
| 3190 Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3191 } |
| 3192 return false; |
| 3193 } |
| 3187 | 3194 |
| 3188 if (!IsFoldable(dominator_allocate)) { | 3195 if (!IsFoldable(dominator_allocate)) { |
| 3189 if (FLAG_trace_allocation_folding) { | 3196 if (FLAG_trace_allocation_folding) { |
| 3190 PrintF("#%d (%s) cannot fold into #%d (%s), different spaces\n", id(), | 3197 PrintF("#%d (%s) cannot fold into #%d (%s), different spaces\n", id(), |
| 3191 Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3198 Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3192 } | 3199 } |
| 3193 return false; | 3200 return false; |
| 3194 } | 3201 } |
| 3195 | 3202 |
| 3196 DCHECK( | 3203 DCHECK( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3228 dominator_allocate); | 3235 dominator_allocate); |
| 3229 | 3236 |
| 3230 dominator_allocate->UpdateSize(new_dominator_size_value); | 3237 dominator_allocate->UpdateSize(new_dominator_size_value); |
| 3231 | 3238 |
| 3232 if (MustAllocateDoubleAligned()) { | 3239 if (MustAllocateDoubleAligned()) { |
| 3233 if (!dominator_allocate->MustAllocateDoubleAligned()) { | 3240 if (!dominator_allocate->MustAllocateDoubleAligned()) { |
| 3234 dominator_allocate->MakeDoubleAligned(); | 3241 dominator_allocate->MakeDoubleAligned(); |
| 3235 } | 3242 } |
| 3236 } | 3243 } |
| 3237 | 3244 |
| 3238 if (IsAllocationFoldingDominator()) { | |
| 3239 DeleteAndReplaceWith(dominator_allocate); | |
| 3240 if (FLAG_trace_allocation_folding) { | |
| 3241 PrintF( | |
| 3242 "#%d (%s) folded dominator into #%d (%s), new dominator size: %d\n", | |
| 3243 id(), Mnemonic(), dominator_allocate->id(), | |
| 3244 dominator_allocate->Mnemonic(), new_dominator_size); | |
| 3245 } | |
| 3246 return true; | |
| 3247 } | |
| 3248 | |
| 3249 if (!dominator_allocate->IsAllocationFoldingDominator()) { | 3245 if (!dominator_allocate->IsAllocationFoldingDominator()) { |
| 3250 HAllocate* first_alloc = | 3246 HAllocate* first_alloc = |
| 3251 HAllocate::New(isolate, zone, dominator_allocate->context(), | 3247 HAllocate::New(isolate, zone, dominator_allocate->context(), |
| 3252 dominator_size, dominator_allocate->type(), | 3248 dominator_size, dominator_allocate->type(), |
| 3253 IsNewSpaceAllocation() ? NOT_TENURED : TENURED, | 3249 IsNewSpaceAllocation() ? NOT_TENURED : TENURED, |
| 3254 JS_OBJECT_TYPE, block()->graph()->GetConstant0()); | 3250 JS_OBJECT_TYPE, block()->graph()->GetConstant0()); |
| 3255 first_alloc->InsertAfter(dominator_allocate); | 3251 first_alloc->InsertAfter(dominator_allocate); |
| 3256 dominator_allocate->ReplaceAllUsesWith(first_alloc); | 3252 dominator_allocate->ReplaceAllUsesWith(first_alloc); |
| 3257 dominator_allocate->MakeAllocationFoldingDominator(); | 3253 dominator_allocate->MakeAllocationFoldingDominator(); |
| 3258 first_alloc->MakeFoldedAllocation(dominator_allocate); | 3254 first_alloc->MakeFoldedAllocation(dominator_allocate); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3273 return true; | 3269 return true; |
| 3274 } | 3270 } |
| 3275 | 3271 |
| 3276 | 3272 |
| 3277 std::ostream& HAllocate::PrintDataTo(std::ostream& os) const { // NOLINT | 3273 std::ostream& HAllocate::PrintDataTo(std::ostream& os) const { // NOLINT |
| 3278 os << NameOf(size()) << " ("; | 3274 os << NameOf(size()) << " ("; |
| 3279 if (IsNewSpaceAllocation()) os << "N"; | 3275 if (IsNewSpaceAllocation()) os << "N"; |
| 3280 if (IsOldSpaceAllocation()) os << "P"; | 3276 if (IsOldSpaceAllocation()) os << "P"; |
| 3281 if (MustAllocateDoubleAligned()) os << "A"; | 3277 if (MustAllocateDoubleAligned()) os << "A"; |
| 3282 if (MustPrefillWithFiller()) os << "F"; | 3278 if (MustPrefillWithFiller()) os << "F"; |
| 3279 if (IsAllocationFoldingDominator()) os << "d"; |
| 3280 if (IsAllocationFolded()) os << "f"; |
| 3283 return os << ")"; | 3281 return os << ")"; |
| 3284 } | 3282 } |
| 3285 | 3283 |
| 3286 | 3284 |
| 3287 bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { | 3285 bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
| 3288 // The base offset is usually simply the size of the array header, except | 3286 // The base offset is usually simply the size of the array header, except |
| 3289 // with dehoisting adds an addition offset due to a array index key | 3287 // with dehoisting adds an addition offset due to a array index key |
| 3290 // manipulation, in which case it becomes (array header size + | 3288 // manipulation, in which case it becomes (array header size + |
| 3291 // constant-offset-from-key * kPointerSize) | 3289 // constant-offset-from-key * kPointerSize) |
| 3292 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; | 3290 v8::base::internal::CheckedNumeric<uint32_t> addition_result = base_offset_; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4057 case HObjectAccess::kExternalMemory: | 4055 case HObjectAccess::kExternalMemory: |
| 4058 os << "[external-memory]"; | 4056 os << "[external-memory]"; |
| 4059 break; | 4057 break; |
| 4060 } | 4058 } |
| 4061 | 4059 |
| 4062 return os << "@" << access.offset(); | 4060 return os << "@" << access.offset(); |
| 4063 } | 4061 } |
| 4064 | 4062 |
| 4065 } // namespace internal | 4063 } // namespace internal |
| 4066 } // namespace v8 | 4064 } // namespace v8 |
| OLD | NEW |