| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 64225b91cbf6ef711de11eab16244a6d6d43f41b..48fa124e2081221688c840cc5c616d5672972fe3 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -12344,6 +12344,22 @@ void JSFunction::AttemptConcurrentOptimization() {
|
| // No write barrier required, since the builtin is part of the root set.
|
| }
|
|
|
| +// 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) {
|
| @@ -12547,6 +12563,14 @@ 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();
|
| @@ -13824,9 +13848,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);
|
| @@ -13865,6 +13886,19 @@ int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context,
|
| return -1;
|
| }
|
|
|
| +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) {
|
| @@ -14303,14 +14337,12 @@ 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());
|
| }
|
|
|
|
|
|
|