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

Side by Side Diff: src/feedback-vector.cc

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Rebase. Created 3 years, 9 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/feedback-vector.h ('k') | src/interpreter/bytecode-array-builder.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/feedback-vector.h" 5 #include "src/feedback-vector.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/feedback-vector-inl.h" 7 #include "src/feedback-vector-inl.h"
8 #include "src/ic/ic-inl.h" 8 #include "src/ic/ic-inl.h"
9 #include "src/ic/ic-state.h" 9 #include "src/ic/ic-state.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 InlineCacheState CollectTypeProfileNexus::StateFromFeedback() const { 1042 InlineCacheState CollectTypeProfileNexus::StateFromFeedback() const {
1043 Isolate* isolate = GetIsolate(); 1043 Isolate* isolate = GetIsolate();
1044 Object* const feedback = GetFeedback(); 1044 Object* const feedback = GetFeedback();
1045 1045
1046 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) { 1046 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
1047 return UNINITIALIZED; 1047 return UNINITIALIZED;
1048 } 1048 }
1049 return MONOMORPHIC; 1049 return MONOMORPHIC;
1050 } 1050 }
1051 1051
1052 void CollectTypeProfileNexus::Collect(Handle<Name> type) { 1052 void CollectTypeProfileNexus::Collect(Handle<Name> type, int position) {
1053 Isolate* isolate = GetIsolate(); 1053 Isolate* isolate = GetIsolate();
1054 1054
1055 Object* const feedback = GetFeedback(); 1055 Object* const feedback = GetFeedback();
1056 Handle<ArrayList> types; 1056 Handle<ArrayList> types;
1057 1057
1058 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) { 1058 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
1059 types = ArrayList::New(isolate, 1); 1059 types = ArrayList::New(isolate, 1);
1060 } else { 1060 } else {
1061 types = Handle<ArrayList>(ArrayList::cast(feedback), isolate); 1061 types = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
1062 } 1062 }
1063
1064 Handle<Tuple2> entry = isolate->factory()->NewTuple2(
1065 type, Handle<Smi>(Smi::FromInt(position), isolate));
1066
1063 // TODO(franzih): Somehow sort this list. Either avoid duplicates 1067 // TODO(franzih): Somehow sort this list. Either avoid duplicates
1064 // or use the common base type. 1068 // or use the common base type.
1065 SetFeedback(*ArrayList::Add(types, type)); 1069 SetFeedback(*ArrayList::Add(types, entry));
1066 } 1070 }
1067 1071
1068 void CollectTypeProfileNexus::Print() const { 1072 void CollectTypeProfileNexus::Print() const {
1069 Isolate* isolate = GetIsolate(); 1073 Isolate* isolate = GetIsolate();
1070 1074
1071 Object* const feedback = GetFeedback(); 1075 Object* const feedback = GetFeedback();
1072 1076
1073 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) { 1077 if (feedback == *FeedbackVector::UninitializedSentinel(isolate)) {
1074 return; 1078 return;
1075 } 1079 }
1076 1080
1077 Handle<ArrayList> list; 1081 Handle<ArrayList> list;
1078 list = Handle<ArrayList>(ArrayList::cast(feedback), isolate); 1082 list = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
1079 1083
1080 for (int i = 0; i < list->Length(); i++) { 1084 for (int i = 0; i < list->Length(); i++) {
1081 String* name = String::cast(list->Get(i)); 1085 Handle<Object> maybe_entry = Handle<Object>(list->Get(i), isolate);
1082 PrintF("%s\n", name->ToCString().get()); 1086 DCHECK(maybe_entry->IsTuple2());
1087 Handle<Tuple2> entry = Handle<Tuple2>::cast(maybe_entry);
1088 Handle<String> type =
1089 Handle<String>(String::cast(entry->value1()), isolate);
1090 int position = Smi::cast(entry->value2())->value();
1091 PrintF("%d: %s\n", position, type->ToCString().get());
1083 } 1092 }
1084 } 1093 }
1085 1094
1086 } // namespace internal 1095 } // namespace internal
1087 } // namespace v8 1096 } // namespace v8
OLDNEW
« no previous file with comments | « src/feedback-vector.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698