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

Side by Side Diff: src/type-info.cc

Issue 650073002: vector-based ICs did not update type feedback counts correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/type-info.h ('k') | src/utils.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } else { 44 } else {
45 return Handle<Object>(value, isolate()); 45 return Handle<Object>(value, isolate());
46 } 46 }
47 } 47 }
48 return Handle<Object>::cast(isolate()->factory()->undefined_value()); 48 return Handle<Object>::cast(isolate()->factory()->undefined_value());
49 } 49 }
50 50
51 51
52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { 52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) {
53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); 53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length());
54 Object* obj = feedback_vector_->get(slot.ToInt()); 54 Object* obj = feedback_vector_->Get(slot);
55 if (!obj->IsJSFunction() || 55 if (!obj->IsJSFunction() ||
56 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) { 56 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
57 return Handle<Object>(obj, isolate()); 57 return Handle<Object>(obj, isolate());
58 }
59 return Handle<Object>::cast(isolate()->factory()->undefined_value());
60 }
61
62
63 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) {
64 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length());
65 Object* obj = feedback_vector_->Get(slot);
66 if (!obj->IsJSFunction() ||
67 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
68 return Handle<Object>(obj, isolate());
58 } 69 }
59 return Handle<Object>::cast(isolate()->factory()->undefined_value()); 70 return Handle<Object>::cast(isolate()->factory()->undefined_value());
60 } 71 }
61 72
62 73
63 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { 74 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) {
64 Handle<Object> maybe_code = GetInfo(id); 75 Handle<Object> maybe_code = GetInfo(id);
65 if (maybe_code->IsCode()) { 76 if (maybe_code->IsCode()) {
66 Handle<Code> code = Handle<Code>::cast(maybe_code); 77 Handle<Code> code = Handle<Code>::cast(maybe_code);
67 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; 78 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
68 } 79 }
69 return false; 80 return false;
70 } 81 }
71 82
72 83
73 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { 84 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) {
74 Handle<Object> maybe_code = GetInfo(ast_id); 85 Handle<Object> maybe_code = GetInfo(ast_id);
75 if (!maybe_code->IsCode()) return false; 86 if (!maybe_code->IsCode()) return false;
76 Handle<Code> code = Handle<Code>::cast(maybe_code); 87 Handle<Code> code = Handle<Code>::cast(maybe_code);
77 return code->ic_state() == UNINITIALIZED; 88 return code->ic_state() == UNINITIALIZED;
78 } 89 }
79 90
80 91
81 bool TypeFeedbackOracle::CallIsMonomorphic(FeedbackVectorSlot slot) { 92 bool TypeFeedbackOracle::CallIsMonomorphic(FeedbackVectorICSlot slot) {
82 Handle<Object> value = GetInfo(slot); 93 Handle<Object> value = GetInfo(slot);
83 return value->IsAllocationSite() || value->IsJSFunction(); 94 return value->IsAllocationSite() || value->IsJSFunction();
84 } 95 }
85 96
86 97
87 bool TypeFeedbackOracle::CallNewIsMonomorphic(FeedbackVectorSlot slot) { 98 bool TypeFeedbackOracle::CallNewIsMonomorphic(FeedbackVectorSlot slot) {
88 Handle<Object> info = GetInfo(slot); 99 Handle<Object> info = GetInfo(slot);
89 return FLAG_pretenuring_call_new 100 return FLAG_pretenuring_call_new
90 ? info->IsJSFunction() 101 ? info->IsJSFunction()
91 : info->IsAllocationSite() || info->IsJSFunction(); 102 : info->IsAllocationSite() || info->IsJSFunction();
(...skipping 20 matching lines...) Expand all
112 *store_mode = KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state); 123 *store_mode = KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state);
113 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state); 124 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state);
114 return; 125 return;
115 } 126 }
116 } 127 }
117 *store_mode = STANDARD_STORE; 128 *store_mode = STANDARD_STORE;
118 *key_type = ELEMENT; 129 *key_type = ELEMENT;
119 } 130 }
120 131
121 132
122 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(FeedbackVectorSlot slot) { 133 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(
134 FeedbackVectorICSlot slot) {
123 Handle<Object> info = GetInfo(slot); 135 Handle<Object> info = GetInfo(slot);
124 if (info->IsAllocationSite()) { 136 if (info->IsAllocationSite()) {
125 return Handle<JSFunction>(isolate()->native_context()->array_function()); 137 return Handle<JSFunction>(isolate()->native_context()->array_function());
126 } 138 }
127 139
128 return Handle<JSFunction>::cast(info); 140 return Handle<JSFunction>::cast(info);
129 } 141 }
130 142
131 143
132 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget( 144 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(
133 FeedbackVectorSlot slot) { 145 FeedbackVectorSlot slot) {
134 Handle<Object> info = GetInfo(slot); 146 Handle<Object> info = GetInfo(slot);
135 if (FLAG_pretenuring_call_new || info->IsJSFunction()) { 147 if (FLAG_pretenuring_call_new || info->IsJSFunction()) {
136 return Handle<JSFunction>::cast(info); 148 return Handle<JSFunction>::cast(info);
137 } 149 }
138 150
139 DCHECK(info->IsAllocationSite()); 151 DCHECK(info->IsAllocationSite());
140 return Handle<JSFunction>(isolate()->native_context()->array_function()); 152 return Handle<JSFunction>(isolate()->native_context()->array_function());
141 } 153 }
142 154
143 155
144 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite( 156 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite(
145 FeedbackVectorSlot slot) { 157 FeedbackVectorICSlot slot) {
146 Handle<Object> info = GetInfo(slot); 158 Handle<Object> info = GetInfo(slot);
147 if (info->IsAllocationSite()) { 159 if (info->IsAllocationSite()) {
148 return Handle<AllocationSite>::cast(info); 160 return Handle<AllocationSite>::cast(info);
149 } 161 }
150 return Handle<AllocationSite>::null(); 162 return Handle<AllocationSite>::null();
151 } 163 }
152 164
153 165
154 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( 166 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(
155 FeedbackVectorSlot slot) { 167 FeedbackVectorSlot slot) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 UnseededNumberDictionary::kNotFound); 469 UnseededNumberDictionary::kNotFound);
458 // Dictionary has been allocated with sufficient size for all elements. 470 // Dictionary has been allocated with sufficient size for all elements.
459 DisallowHeapAllocation no_need_to_resize_dictionary; 471 DisallowHeapAllocation no_need_to_resize_dictionary;
460 HandleScope scope(isolate()); 472 HandleScope scope(isolate());
461 USE(UnseededNumberDictionary::AtNumberPut( 473 USE(UnseededNumberDictionary::AtNumberPut(
462 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 474 dictionary_, IdToKey(ast_id), handle(target, isolate())));
463 } 475 }
464 476
465 477
466 } } // namespace v8::internal 478 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698