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

Unified Diff: src/objects.cc

Issue 1563213002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 510e6d3aef46ff963aeea15fe65263258b97402a..41a8162e77af28d22fe1990881c686cd0553d20f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12287,6 +12287,24 @@ void JSFunction::AttemptConcurrentOptimization() {
}
+// static
+Handle<LiteralsArray> SharedFunctionInfo::FindOrCreateLiterals(
+ Handle<SharedFunctionInfo> shared, Handle<Context> native_context) {
+ Isolate* isolate = shared->GetIsolate();
+ CodeAndLiterals result =
+ shared->SearchOptimizedCodeMap(*native_context, BailoutId::None());
+ if (result.literals != nullptr) {
+ return handle(result.literals, isolate);
+ }
+ Handle<TypeFeedbackVector> feedback_vector =
+ TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
+ Handle<LiteralsArray> literals = LiteralsArray::New(
+ isolate, feedback_vector, shared->num_literals(), TENURED);
+ AddLiteralsToOptimizedCodeMap(shared, native_context, literals);
+ return literals;
+}
+
+
void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(
Handle<SharedFunctionInfo> shared, Handle<Code> code) {
Isolate* isolate = shared->GetIsolate();
@@ -12490,6 +12508,16 @@ void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) {
}
+// static
+void JSFunction::EnsureLiterals(Handle<JSFunction> function) {
+ Handle<SharedFunctionInfo> shared(function->shared());
+ Handle<Context> native_context(function->context()->native_context());
+ Handle<LiteralsArray> literals =
+ SharedFunctionInfo::FindOrCreateLiterals(shared, native_context);
+ function->set_literals(*literals);
+}
+
+
static void GetMinInobjectSlack(Map* map, void* data) {
int slack = map->unused_property_fields();
if (*reinterpret_cast<int*>(data) > slack) {
@@ -13761,9 +13789,6 @@ void Map::StartInobjectSlackTracking() {
void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
code()->ClearInlineCaches();
- // If we clear ICs, we need to clear the type feedback vector too, since
- // CallICs are synced with a feedback vector slot.
- ClearTypeFeedbackInfo();
set_ic_age(new_ic_age);
if (code()->kind() == Code::FUNCTION) {
code()->set_profiler_ticks(0);
@@ -13803,6 +13828,21 @@ int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context,
}
+void SharedFunctionInfo::ClearCodeFromOptimizedCodeMap() {
+ if (!OptimizedCodeMapIsCleared()) {
+ FixedArray* optimized_code_map = this->optimized_code_map();
+ int length = optimized_code_map->length();
+ WeakCell* empty_weak_cell = GetHeap()->empty_weak_cell();
+ for (int i = kEntriesStart; i < length; i += kEntryLength) {
+ optimized_code_map->set(i + kCachedCodeOffset, empty_weak_cell,
+ SKIP_WRITE_BARRIER);
+ }
+ optimized_code_map->set(kSharedCodeIndex, empty_weak_cell,
+ SKIP_WRITE_BARRIER);
+ }
+}
+
+
CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap(
Context* native_context, BailoutId osr_ast_id) {
CodeAndLiterals result = {nullptr, nullptr};
@@ -14241,13 +14281,13 @@ void Code::ClearInlineCaches(Code::Kind* kind) {
}
-void SharedFunctionInfo::ClearTypeFeedbackInfo() {
- feedback_vector()->ClearSlots(this);
+void JSFunction::ClearTypeFeedbackInfo() {
+ feedback_vector()->ClearSlots(shared());
}
-void SharedFunctionInfo::ClearTypeFeedbackInfoAtGCTime() {
- feedback_vector()->ClearSlotsAtGCTime(this);
+void JSFunction::ClearTypeFeedbackInfoAtGCTime() {
+ feedback_vector()->ClearSlotsAtGCTime(shared());
}
« src/crankshaft/hydrogen.cc ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698