OLD | NEW |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol()) { | 85 if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol()) { |
86 return Handle<Object>(obj, isolate()); | 86 return Handle<Object>(obj, isolate()); |
87 } | 87 } |
88 | 88 |
89 return undefined; | 89 return undefined; |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { | 93 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(TypeFeedbackId id) { |
94 Handle<Object> maybe_code = GetInfo(id); | 94 Handle<Object> maybe_code = GetInfo(id); |
95 if (maybe_code->IsCode()) { | 95 if (maybe_code->IsCode()) { |
96 Handle<Code> code = Handle<Code>::cast(maybe_code); | 96 Handle<Code> code = Handle<Code>::cast(maybe_code); |
97 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; | 97 if (code->is_inline_cache_stub()) return code->ic_state(); |
98 } | 98 } |
99 return false; | 99 |
| 100 // If we can't find an IC, assume we've seen *something*, but we don't know |
| 101 // what. PREMONOMORPHIC roughly encodes this meaning. |
| 102 return PREMONOMORPHIC; |
100 } | 103 } |
101 | 104 |
102 | 105 |
103 bool TypeFeedbackOracle::LoadIsUninitialized(FeedbackVectorICSlot slot) { | 106 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( |
| 107 FeedbackVectorICSlot slot) { |
104 Code::Kind kind = feedback_vector_->GetKind(slot); | 108 Code::Kind kind = feedback_vector_->GetKind(slot); |
105 if (kind == Code::LOAD_IC) { | 109 if (kind == Code::LOAD_IC) { |
106 LoadICNexus nexus(feedback_vector_, slot); | 110 LoadICNexus nexus(feedback_vector_, slot); |
107 return nexus.StateFromFeedback() == UNINITIALIZED; | 111 return nexus.StateFromFeedback(); |
108 } else if (kind == Code::KEYED_LOAD_IC) { | 112 } else if (kind == Code::KEYED_LOAD_IC) { |
109 KeyedLoadICNexus nexus(feedback_vector_, slot); | 113 KeyedLoadICNexus nexus(feedback_vector_, slot); |
110 return nexus.StateFromFeedback() == UNINITIALIZED; | 114 return nexus.StateFromFeedback(); |
111 } else if (kind == Code::NUMBER_OF_KINDS) { | |
112 // Code::NUMBER_OF_KINDS indicates a slot that was never even compiled | |
113 // in full code. | |
114 return true; | |
115 } | 115 } |
116 | 116 |
117 return false; | 117 // If we can't find an IC, assume we've seen *something*, but we don't know |
| 118 // what. PREMONOMORPHIC roughly encodes this meaning. |
| 119 return PREMONOMORPHIC; |
118 } | 120 } |
119 | 121 |
120 | 122 |
121 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { | 123 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { |
122 Handle<Object> maybe_code = GetInfo(ast_id); | 124 Handle<Object> maybe_code = GetInfo(ast_id); |
123 if (!maybe_code->IsCode()) return false; | 125 if (!maybe_code->IsCode()) return false; |
124 Handle<Code> code = Handle<Code>::cast(maybe_code); | 126 Handle<Code> code = Handle<Code>::cast(maybe_code); |
125 return code->ic_state() == UNINITIALIZED; | 127 return code->ic_state() == UNINITIALIZED; |
126 } | 128 } |
127 | 129 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 UnseededNumberDictionary::kNotFound); | 534 UnseededNumberDictionary::kNotFound); |
533 // Dictionary has been allocated with sufficient size for all elements. | 535 // Dictionary has been allocated with sufficient size for all elements. |
534 DisallowHeapAllocation no_need_to_resize_dictionary; | 536 DisallowHeapAllocation no_need_to_resize_dictionary; |
535 HandleScope scope(isolate()); | 537 HandleScope scope(isolate()); |
536 USE(UnseededNumberDictionary::AtNumberPut( | 538 USE(UnseededNumberDictionary::AtNumberPut( |
537 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 539 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
538 } | 540 } |
539 | 541 |
540 | 542 |
541 } } // namespace v8::internal | 543 } } // namespace v8::internal |
OLD | NEW |