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

Unified Diff: src/interpreter/constant-array-builder.cc

Issue 1749853002: [interpreter] Unbreak test262 tests using constants. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/constant-array-builder.cc
diff --git a/src/interpreter/constant-array-builder.cc b/src/interpreter/constant-array-builder.cc
index e20d392ea8db67cc3ce79ed09c65b3cd1d763291..018fda23e29e90e87a76e149f92e2c07caccea0f 100644
--- a/src/interpreter/constant-array-builder.cc
+++ b/src/interpreter/constant-array-builder.cc
@@ -87,6 +87,7 @@ Handle<Object> ConstantArrayBuilder::At(size_t index) const {
if (index < slice->start_index() + slice->size()) {
return slice->At(index);
} else {
+ DCHECK_LT(index, slice->capacity());
return isolate_->factory()->the_hole_value();
}
}
@@ -99,6 +100,8 @@ Handle<FixedArray> ConstantArrayBuilder::ToFixedArray() {
if (array_index == fixed_array->length()) {
break;
}
+ DCHECK(array_index == 0 ||
+ base::bits::IsPowerOfTwo32(static_cast<uint32_t>(array_index)));
// Copy objects from slice into array.
for (size_t i = 0; i < slice->size(); ++i) {
fixed_array->set(array_index++, *slice->At(slice->start_index() + i));
@@ -107,8 +110,7 @@ Handle<FixedArray> ConstantArrayBuilder::ToFixedArray() {
size_t padding =
std::min(static_cast<size_t>(fixed_array->length() - array_index),
slice->capacity() - slice->size());
- for (size_t i = slice->start_index() + slice->size();
- i < slice->start_index() + padding; ++i) {
+ for (size_t i = 0; i < padding; i++) {
fixed_array->set(array_index++, *isolate_->factory()->the_hole_value());
}
}
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698