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

Unified Diff: src/objects.cc

Issue 2170743003: [api] Introduce fast instantiations cache (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing uint issue under windows Created 4 years, 5 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
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9b26b75f33f5c46d93a0517e766de2a7e5e92f99..9f5fd65471cbcfb5812071b9c095759f929810d5 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9755,6 +9755,24 @@ Code* CodeCacheHashTable::Lookup(Name* name, Code::Flags flags) {
return Code::cast(FixedArray::cast(get(EntryToIndex(entry)))->get(1));
}
+Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
+ Handle<Object> value) {
+ if (index < array->length()) {
+ array->set(index, *value);
+ return array;
+ }
+ int capacity = array->length();
+ do {
+ capacity = JSObject::NewElementsCapacity(capacity);
+ } while (capacity < index);
+ Handle<FixedArray> new_array =
+ array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
+ array->CopyTo(0, *new_array, 0, array->length());
+ new_array->FillWithHoles(array->length(), new_array->length());
+ new_array->set(index, *value);
+ return new_array;
+}
+
void FixedArray::Shrink(int new_length) {
DCHECK(0 <= new_length && new_length <= length());
if (new_length < length()) {
@@ -11624,8 +11642,8 @@ Handle<LiteralsArray> SharedFunctionInfo::FindOrCreateLiterals(
Handle<TypeFeedbackVector> feedback_vector =
TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
- Handle<LiteralsArray> literals = LiteralsArray::New(
- isolate, feedback_vector, shared->num_literals(), TENURED);
+ Handle<LiteralsArray> literals =
+ LiteralsArray::New(isolate, feedback_vector, shared->num_literals());
Handle<Code> code;
if (result.code != nullptr) {
code = Handle<Code>(result.code, isolate);
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698