Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: src/compiler/value-numbering-reducer.cc

Issue 924453002: Fix invalid use of int in Zone. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Windows again... Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/value-numbering-reducer.h" 5 #include "src/compiler/value-numbering-reducer.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "src/base/functional.h" 9 #include "src/base/functional.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 } 129 }
130 130
131 131
132 void ValueNumberingReducer::Grow() { 132 void ValueNumberingReducer::Grow() {
133 // Allocate a new block of entries kCapacityToSizeRatio times the previous 133 // Allocate a new block of entries kCapacityToSizeRatio times the previous
134 // capacity. 134 // capacity.
135 Node** const old_entries = entries_; 135 Node** const old_entries = entries_;
136 size_t const old_capacity = capacity_; 136 size_t const old_capacity = capacity_;
137 capacity_ *= kCapacityToSizeRatio; 137 capacity_ *= kCapacityToSizeRatio;
138 entries_ = zone()->NewArray<Node*>(static_cast<int>(capacity_)); 138 entries_ = zone()->NewArray<Node*>(capacity_);
139 memset(entries_, 0, sizeof(*entries_) * capacity_); 139 memset(entries_, 0, sizeof(*entries_) * capacity_);
140 size_ = 0; 140 size_ = 0;
141 size_t const mask = capacity_ - 1; 141 size_t const mask = capacity_ - 1;
142 142
143 // Insert the old entries into the new block (skipping dead nodes). 143 // Insert the old entries into the new block (skipping dead nodes).
144 for (size_t i = 0; i < old_capacity; ++i) { 144 for (size_t i = 0; i < old_capacity; ++i) {
145 Node* const old_entry = old_entries[i]; 145 Node* const old_entry = old_entries[i];
146 if (!old_entry || old_entry->IsDead()) continue; 146 if (!old_entry || old_entry->IsDead()) continue;
147 for (size_t j = HashCode(old_entry) & mask;; j = (j + 1) & mask) { 147 for (size_t j = HashCode(old_entry) & mask;; j = (j + 1) & mask) {
148 Node* const entry = entries_[j]; 148 Node* const entry = entries_[j];
149 if (entry == old_entry) { 149 if (entry == old_entry) {
150 // Skip duplicate of the old entry. 150 // Skip duplicate of the old entry.
151 break; 151 break;
152 } 152 }
153 if (!entry) { 153 if (!entry) {
154 entries_[j] = old_entry; 154 entries_[j] = old_entry;
155 size_++; 155 size_++;
156 break; 156 break;
157 } 157 }
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 } // namespace compiler 162 } // namespace compiler
163 } // namespace internal 163 } // namespace internal
164 } // namespace v8 164 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | src/zone.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698