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

Side by Side Diff: src/objects.cc

Issue 2681773004: [FeedbackVector] Clarify the way the feedback vector is installed. (Closed)
Patch Set: Code comments+REBASE. Created 3 years, 10 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12090 matching lines...) Expand 10 before | Expand all | Expand 10 after
12101 12101
12102 if (!found) { 12102 if (!found) {
12103 // We didn't find the code in here. It must be osr'd code. 12103 // We didn't find the code in here. It must be osr'd code.
12104 isolate->EvictOSROptimizedCode(optimized_code, reason); 12104 isolate->EvictOSROptimizedCode(optimized_code, reason);
12105 } 12105 }
12106 } 12106 }
12107 12107
12108 // static 12108 // static
12109 void JSFunction::EnsureLiterals(Handle<JSFunction> function) { 12109 void JSFunction::EnsureLiterals(Handle<JSFunction> function) {
12110 Handle<SharedFunctionInfo> shared(function->shared()); 12110 Handle<SharedFunctionInfo> shared(function->shared());
12111 Handle<Context> native_context(function->context()->native_context());
12112 Isolate* isolate = shared->GetIsolate(); 12111 Isolate* isolate = shared->GetIsolate();
12113 12112
12114 Cell* cell = function->feedback_vector_cell(); 12113 FeedbackVectorState state = function->GetFeedbackVectorState(isolate);
12115 if (cell == isolate->heap()->undefined_cell()) { 12114 switch (state) {
12116 if (FLAG_trace_strong_rooted_literals) { 12115 case TOP_LEVEL_SCRIPT_NEEDS_VECTOR: {
12117 PrintF("EnsureLiterals: Installing literals cell in %s %p\n", 12116 // A top level script didn't get it's literals installed.
12118 shared->DebugName()->ToCString().get(), 12117 Handle<FeedbackVector> feedback_vector =
12119 reinterpret_cast<void*>(*function)); 12118 FeedbackVector::New(isolate, shared);
12119 Handle<Cell> new_cell = isolate->factory()->NewCell(feedback_vector);
12120 function->set_feedback_vector_cell(*new_cell);
12121 break;
12120 } 12122 }
12121 // Top level code didn't get it's literals installed. 12123 case NEEDS_VECTOR: {
12122 Handle<FeedbackVector> feedback_vector = 12124 Handle<FeedbackVector> feedback_vector =
12123 FeedbackVector::New(isolate, shared); 12125 FeedbackVector::New(isolate, shared);
12124 Handle<Cell> new_cell = isolate->factory()->NewCell(feedback_vector); 12126 function->feedback_vector_cell()->set_value(*feedback_vector);
12125 function->set_feedback_vector_cell(*new_cell); 12127 break;
12126 } else if (!cell->value()->IsFeedbackVector() ||
12127 !function->has_feedback_vector()) {
12128 DCHECK(cell != isolate->heap()->undefined_cell());
12129 if (FLAG_trace_strong_rooted_literals) {
12130 PrintF("EnsureLiterals: Update literals cell in %s %p\n",
12131 shared->DebugName()->ToCString().get(),
12132 reinterpret_cast<void*>(*function));
12133 } 12128 }
12134 Handle<FeedbackVector> feedback_vector = 12129 case HAS_VECTOR:
12135 FeedbackVector::New(isolate, shared); 12130 // Nothing to do.
12136 // Re-get the feedback_vector() value as GC may have occurred. 12131 break;
12137 function->feedback_vector_cell()->set_value(*feedback_vector);
12138 } else {
12139 if (FLAG_trace_strong_rooted_literals) {
12140 PrintF("EnsureLiterals: did nothing for %s %p\n",
12141 shared->DebugName()->ToCString().get(),
12142 reinterpret_cast<void*>(*function));
12143 }
12144 } 12132 }
12145 } 12133 }
12146 12134
12147 static void GetMinInobjectSlack(Map* map, void* data) { 12135 static void GetMinInobjectSlack(Map* map, void* data) {
12148 int slack = map->unused_property_fields(); 12136 int slack = map->unused_property_fields();
12149 if (*reinterpret_cast<int*>(data) > slack) { 12137 if (*reinterpret_cast<int*>(data) > slack) {
12150 *reinterpret_cast<int*>(data) = slack; 12138 *reinterpret_cast<int*>(data) = slack;
12151 } 12139 }
12152 } 12140 }
12153 12141
(...skipping 8049 matching lines...) Expand 10 before | Expand all | Expand 10 after
20203 // depend on this. 20191 // depend on this.
20204 return DICTIONARY_ELEMENTS; 20192 return DICTIONARY_ELEMENTS;
20205 } 20193 }
20206 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20194 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20207 return kind; 20195 return kind;
20208 } 20196 }
20209 } 20197 }
20210 20198
20211 } // namespace internal 20199 } // namespace internal
20212 } // namespace v8 20200 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698