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

Side by Side 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, 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 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 9737 matching lines...) Expand 10 before | Expand all | Expand 10 after
9748 } 9748 }
9749 9749
9750 Code* CodeCacheHashTable::Lookup(Name* name, Code::Flags flags) { 9750 Code* CodeCacheHashTable::Lookup(Name* name, Code::Flags flags) {
9751 DisallowHeapAllocation no_alloc; 9751 DisallowHeapAllocation no_alloc;
9752 CodeCacheHashTableKey key(handle(name), flags); 9752 CodeCacheHashTableKey key(handle(name), flags);
9753 int entry = FindEntry(&key); 9753 int entry = FindEntry(&key);
9754 if (entry == kNotFound) return nullptr; 9754 if (entry == kNotFound) return nullptr;
9755 return Code::cast(FixedArray::cast(get(EntryToIndex(entry)))->get(1)); 9755 return Code::cast(FixedArray::cast(get(EntryToIndex(entry)))->get(1));
9756 } 9756 }
9757 9757
9758 Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
9759 Handle<Object> value) {
9760 if (index < array->length()) {
9761 array->set(index, *value);
9762 return array;
9763 }
9764 int capacity = array->length();
9765 do {
9766 capacity = JSObject::NewElementsCapacity(capacity);
9767 } while (capacity < index);
9768 Handle<FixedArray> new_array =
9769 array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
9770 array->CopyTo(0, *new_array, 0, array->length());
9771 new_array->FillWithHoles(array->length(), new_array->length());
9772 new_array->set(index, *value);
9773 return new_array;
9774 }
9775
9758 void FixedArray::Shrink(int new_length) { 9776 void FixedArray::Shrink(int new_length) {
9759 DCHECK(0 <= new_length && new_length <= length()); 9777 DCHECK(0 <= new_length && new_length <= length());
9760 if (new_length < length()) { 9778 if (new_length < length()) {
9761 GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( 9779 GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(
9762 this, length() - new_length); 9780 this, length() - new_length);
9763 } 9781 }
9764 } 9782 }
9765 9783
9766 9784
9767 void FixedArray::CopyTo(int pos, FixedArray* dest, int dest_pos, int len) { 9785 void FixedArray::CopyTo(int pos, FixedArray* dest, int dest_pos, int len) {
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
11617 CodeAndLiterals result = 11635 CodeAndLiterals result =
11618 shared->SearchOptimizedCodeMap(*native_context, BailoutId::None()); 11636 shared->SearchOptimizedCodeMap(*native_context, BailoutId::None());
11619 if (result.literals != nullptr) { 11637 if (result.literals != nullptr) {
11620 DCHECK(shared->feedback_metadata()->is_empty() || 11638 DCHECK(shared->feedback_metadata()->is_empty() ||
11621 !result.literals->feedback_vector()->is_empty()); 11639 !result.literals->feedback_vector()->is_empty());
11622 return handle(result.literals, isolate); 11640 return handle(result.literals, isolate);
11623 } 11641 }
11624 11642
11625 Handle<TypeFeedbackVector> feedback_vector = 11643 Handle<TypeFeedbackVector> feedback_vector =
11626 TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata())); 11644 TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
11627 Handle<LiteralsArray> literals = LiteralsArray::New( 11645 Handle<LiteralsArray> literals =
11628 isolate, feedback_vector, shared->num_literals(), TENURED); 11646 LiteralsArray::New(isolate, feedback_vector, shared->num_literals());
11629 Handle<Code> code; 11647 Handle<Code> code;
11630 if (result.code != nullptr) { 11648 if (result.code != nullptr) {
11631 code = Handle<Code>(result.code, isolate); 11649 code = Handle<Code>(result.code, isolate);
11632 } 11650 }
11633 AddToOptimizedCodeMap(shared, native_context, code, literals, 11651 AddToOptimizedCodeMap(shared, native_context, code, literals,
11634 BailoutId::None()); 11652 BailoutId::None());
11635 return literals; 11653 return literals;
11636 } 11654 }
11637 11655
11638 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( 11656 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(
(...skipping 7352 matching lines...) Expand 10 before | Expand all | Expand 10 after
18991 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19009 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
18992 PrototypeIterator::END_AT_NULL); 19010 PrototypeIterator::END_AT_NULL);
18993 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19011 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
18994 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19012 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
18995 } 19013 }
18996 return false; 19014 return false;
18997 } 19015 }
18998 19016
18999 } // namespace internal 19017 } // namespace internal
19000 } // namespace v8 19018 } // namespace v8
OLDNEW
« 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