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

Side by Side Diff: src/interpreter/constant-array-builder.cc

Issue 1608693004: [interpreter] Simplify ConstantArrayBuilder interface a bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_int-2
Patch Set: Created 4 years, 11 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/constant-array-builder.h" 5 #include "src/interpreter/constant-array-builder.h"
6 6
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (index >= idx16_slice_.start_index()) { 79 if (index >= idx16_slice_.start_index()) {
80 return idx16_slice_.At(index); 80 return idx16_slice_.At(index);
81 } else if (index < idx8_slice_.size()) { 81 } else if (index < idx8_slice_.size()) {
82 return idx8_slice_.At(index); 82 return idx8_slice_.At(index);
83 } else { 83 } else {
84 return isolate_->factory()->the_hole_value(); 84 return isolate_->factory()->the_hole_value();
85 } 85 }
86 } 86 }
87 87
88 88
89 Handle<FixedArray> ConstantArrayBuilder::ToFixedArray(Factory* factory) const { 89 Handle<FixedArray> ConstantArrayBuilder::ToFixedArray() const {
90 Handle<FixedArray> fixed_array = 90 Handle<FixedArray> fixed_array = isolate_->factory()->NewFixedArray(
91 factory->NewFixedArray(static_cast<int>(size()), PretenureFlag::TENURED); 91 static_cast<int>(size()), PretenureFlag::TENURED);
92 for (int i = 0; i < fixed_array->length(); i++) { 92 for (int i = 0; i < fixed_array->length(); i++) {
93 fixed_array->set(i, *At(static_cast<size_t>(i))); 93 fixed_array->set(i, *At(static_cast<size_t>(i)));
94 } 94 }
95 return fixed_array; 95 return fixed_array;
96 } 96 }
97 97
98 98
99 size_t ConstantArrayBuilder::Insert(Handle<Object> object) { 99 size_t ConstantArrayBuilder::Insert(Handle<Object> object) {
100 index_t* entry = constants_map_.Find(object); 100 index_t* entry = constants_map_.Find(object);
101 return (entry == nullptr) ? AllocateEntry(object) : *entry; 101 return (entry == nullptr) ? AllocateEntry(object) : *entry;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 idx16_slice_.Unreserve(); 165 idx16_slice_.Unreserve();
166 return; 166 return;
167 default: 167 default:
168 UNREACHABLE(); 168 UNREACHABLE();
169 } 169 }
170 } 170 }
171 171
172 } // namespace interpreter 172 } // namespace interpreter
173 } // namespace internal 173 } // namespace internal
174 } // namespace v8 174 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698