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

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

Issue 2242193002: [Interpreter] Avoid accessing Isolate from during bytecode generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_sourceposition
Patch Set: Rebase Created 4 years, 4 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 | « src/interpreter/constant-array-builder.h ('k') | src/interpreter/handler-table-builder.h » ('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 7c37586417601ed587c38c9830d041077c6b0517..ff3823fde2d14ce96bbc135ac00ad11cd765c5d5 100644
--- a/src/interpreter/constant-array-builder.cc
+++ b/src/interpreter/constant-array-builder.cc
@@ -70,11 +70,12 @@ STATIC_CONST_MEMBER_DEFINITION const size_t
STATIC_CONST_MEMBER_DEFINITION const size_t
ConstantArrayBuilder::k32BitCapacity;
-ConstantArrayBuilder::ConstantArrayBuilder(Isolate* isolate, Zone* zone)
- : isolate_(isolate),
- constants_map_(zone),
+ConstantArrayBuilder::ConstantArrayBuilder(Zone* zone,
+ Handle<Object> the_hole_value)
+ : constants_map_(zone),
smi_map_(zone),
- smi_pairs_(zone) {
+ smi_pairs_(zone),
+ the_hole_value_(the_hole_value) {
idx_slice_[0] =
new (zone) ConstantArraySlice(zone, 0, k8BitCapacity, OperandSize::kByte);
idx_slice_[1] = new (zone) ConstantArraySlice(
@@ -111,18 +112,18 @@ Handle<Object> ConstantArrayBuilder::At(size_t index) const {
return slice->At(index);
} else {
DCHECK_LT(index, slice->capacity());
- return isolate_->factory()->the_hole_value();
+ return the_hole_value();
}
}
-Handle<FixedArray> ConstantArrayBuilder::ToFixedArray() {
+Handle<FixedArray> ConstantArrayBuilder::ToFixedArray(Isolate* isolate) {
// First insert reserved SMI values.
for (auto reserved_smi : smi_pairs_) {
InsertAllocatedEntry(reserved_smi.second,
- handle(reserved_smi.first, isolate_));
+ handle(reserved_smi.first, isolate));
}
- Handle<FixedArray> fixed_array = isolate_->factory()->NewFixedArray(
+ Handle<FixedArray> fixed_array = isolate->factory()->NewFixedArray(
static_cast<int>(size()), PretenureFlag::TENURED);
int array_index = 0;
for (const ConstantArraySlice* slice : idx_slice_) {
@@ -144,7 +145,7 @@ Handle<FixedArray> ConstantArrayBuilder::ToFixedArray() {
std::min(static_cast<size_t>(fixed_array->length() - array_index),
slice->capacity() - slice->size());
for (size_t i = 0; i < padding; i++) {
- fixed_array->set(array_index++, *isolate_->factory()->the_hole_value());
+ fixed_array->set(array_index++, *the_hole_value());
}
}
DCHECK_EQ(array_index, fixed_array->length());
@@ -197,12 +198,12 @@ ConstantArrayBuilder::OperandSizeToSlice(OperandSize operand_size) const {
}
size_t ConstantArrayBuilder::AllocateEntry() {
- return AllocateIndex(isolate_->factory()->the_hole_value());
+ return AllocateIndex(the_hole_value());
}
void ConstantArrayBuilder::InsertAllocatedEntry(size_t index,
Handle<Object> object) {
- DCHECK_EQ(isolate_->heap()->the_hole_value(), *At(index));
+ DCHECK_EQ(the_hole_value().address(), At(index).address());
ConstantArraySlice* slice = IndexToSlice(index);
slice->InsertAt(index, object);
}
« no previous file with comments | « src/interpreter/constant-array-builder.h ('k') | src/interpreter/handler-table-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698