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

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: Ports. 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
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 15 matching lines...) Expand all
107 if (maybe_code->IsCode()) { 118 if (maybe_code->IsCode()) {
108 Handle<Code> code = Handle<Code>::cast(maybe_code); 119 Handle<Code> code = Handle<Code>::cast(maybe_code);
109 if (code->kind() == Code::KEYED_STORE_IC) { 120 if (code->kind() == Code::KEYED_STORE_IC) {
110 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); 121 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state());
111 } 122 }
112 } 123 }
113 return STANDARD_STORE; 124 return STANDARD_STORE;
114 } 125 }
115 126
116 127
117 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(FeedbackVectorSlot slot) { 128 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(
129 FeedbackVectorICSlot slot) {
118 Handle<Object> info = GetInfo(slot); 130 Handle<Object> info = GetInfo(slot);
119 if (info->IsAllocationSite()) { 131 if (info->IsAllocationSite()) {
120 return Handle<JSFunction>(isolate()->native_context()->array_function()); 132 return Handle<JSFunction>(isolate()->native_context()->array_function());
121 } 133 }
122 134
123 return Handle<JSFunction>::cast(info); 135 return Handle<JSFunction>::cast(info);
124 } 136 }
125 137
126 138
127 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget( 139 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(
128 FeedbackVectorSlot slot) { 140 FeedbackVectorSlot slot) {
129 Handle<Object> info = GetInfo(slot); 141 Handle<Object> info = GetInfo(slot);
130 if (FLAG_pretenuring_call_new || info->IsJSFunction()) { 142 if (FLAG_pretenuring_call_new || info->IsJSFunction()) {
131 return Handle<JSFunction>::cast(info); 143 return Handle<JSFunction>::cast(info);
132 } 144 }
133 145
134 DCHECK(info->IsAllocationSite()); 146 DCHECK(info->IsAllocationSite());
135 return Handle<JSFunction>(isolate()->native_context()->array_function()); 147 return Handle<JSFunction>(isolate()->native_context()->array_function());
136 } 148 }
137 149
138 150
139 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite( 151 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite(
140 FeedbackVectorSlot slot) { 152 FeedbackVectorICSlot slot) {
141 Handle<Object> info = GetInfo(slot); 153 Handle<Object> info = GetInfo(slot);
142 if (info->IsAllocationSite()) { 154 if (info->IsAllocationSite()) {
143 return Handle<AllocationSite>::cast(info); 155 return Handle<AllocationSite>::cast(info);
144 } 156 }
145 return Handle<AllocationSite>::null(); 157 return Handle<AllocationSite>::null();
146 } 158 }
147 159
148 160
149 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( 161 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(
150 FeedbackVectorSlot slot) { 162 FeedbackVectorSlot slot) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 UnseededNumberDictionary::kNotFound); 462 UnseededNumberDictionary::kNotFound);
451 // Dictionary has been allocated with sufficient size for all elements. 463 // Dictionary has been allocated with sufficient size for all elements.
452 DisallowHeapAllocation no_need_to_resize_dictionary; 464 DisallowHeapAllocation no_need_to_resize_dictionary;
453 HandleScope scope(isolate()); 465 HandleScope scope(isolate());
454 USE(UnseededNumberDictionary::AtNumberPut( 466 USE(UnseededNumberDictionary::AtNumberPut(
455 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 467 dictionary_, IdToKey(ast_id), handle(target, isolate())));
456 } 468 }
457 469
458 470
459 } } // namespace v8::internal 471 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698