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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "ast.h" | 7 #include "ast.h" |
8 #include "code-stubs.h" | 8 #include "code-stubs.h" |
9 #include "compiler.h" | 9 #include "compiler.h" |
10 #include "ic.h" | 10 #include "ic.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 Handle<Code> code = Handle<Code>::cast(maybe_code); | 90 Handle<Code> code = Handle<Code>::cast(maybe_code); |
91 return code->is_keyed_store_stub() && | 91 return code->is_keyed_store_stub() && |
92 code->ic_state() == POLYMORPHIC; | 92 code->ic_state() == POLYMORPHIC; |
93 } | 93 } |
94 return false; | 94 return false; |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 bool TypeFeedbackOracle::CallIsMonomorphic(int slot) { | 98 bool TypeFeedbackOracle::CallIsMonomorphic(int slot) { |
99 Handle<Object> value = GetInfo(slot); | 99 Handle<Object> value = GetInfo(slot); |
100 return FLAG_pretenuring_call_new | 100 return value->IsAllocationSite() || value->IsJSFunction(); |
101 ? value->IsJSFunction() | |
102 : value->IsAllocationSite() || value->IsJSFunction(); | |
103 } | 101 } |
104 | 102 |
105 | 103 |
106 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) { | 104 bool TypeFeedbackOracle::CallNewIsMonomorphic(int slot) { |
107 Handle<Object> info = GetInfo(slot); | 105 Handle<Object> info = GetInfo(slot); |
108 return FLAG_pretenuring_call_new | 106 return FLAG_pretenuring_call_new |
109 ? info->IsJSFunction() | 107 ? info->IsJSFunction() |
110 : info->IsAllocationSite() || info->IsJSFunction(); | 108 : info->IsAllocationSite() || info->IsJSFunction(); |
111 } | 109 } |
112 | 110 |
(...skipping 14 matching lines...) Expand all Loading... |
127 if (code->kind() == Code::KEYED_STORE_IC) { | 125 if (code->kind() == Code::KEYED_STORE_IC) { |
128 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); | 126 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); |
129 } | 127 } |
130 } | 128 } |
131 return STANDARD_STORE; | 129 return STANDARD_STORE; |
132 } | 130 } |
133 | 131 |
134 | 132 |
135 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) { | 133 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) { |
136 Handle<Object> info = GetInfo(slot); | 134 Handle<Object> info = GetInfo(slot); |
137 if (FLAG_pretenuring_call_new || info->IsJSFunction()) { | 135 if (info->IsAllocationSite()) { |
| 136 ASSERT(!FLAG_pretenuring_call_new); |
| 137 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
| 138 } else { |
138 return Handle<JSFunction>::cast(info); | 139 return Handle<JSFunction>::cast(info); |
139 } | 140 } |
140 | 141 |
141 ASSERT(info->IsAllocationSite()); | 142 ASSERT(info->IsAllocationSite()); |
142 return Handle<JSFunction>(isolate()->native_context()->array_function()); | 143 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
143 } | 144 } |
144 | 145 |
145 | 146 |
146 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(int slot) { | 147 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(int slot) { |
147 Handle<Object> info = GetInfo(slot); | 148 Handle<Object> info = GetInfo(slot); |
148 if (FLAG_pretenuring_call_new || info->IsJSFunction()) { | 149 if (FLAG_pretenuring_call_new || info->IsJSFunction()) { |
149 return Handle<JSFunction>::cast(info); | 150 return Handle<JSFunction>::cast(info); |
150 } | 151 } |
151 | 152 |
152 ASSERT(info->IsAllocationSite()); | 153 ASSERT(info->IsAllocationSite()); |
153 return Handle<JSFunction>(isolate()->native_context()->array_function()); | 154 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
154 } | 155 } |
155 | 156 |
156 | 157 |
| 158 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite(int slot) { |
| 159 Handle<Object> info = GetInfo(slot); |
| 160 if (info->IsAllocationSite()) { |
| 161 return Handle<AllocationSite>::cast(info); |
| 162 } |
| 163 return Handle<AllocationSite>::null(); |
| 164 } |
| 165 |
| 166 |
157 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(int slot) { | 167 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(int slot) { |
158 Handle<Object> info = GetInfo(slot); | 168 Handle<Object> info = GetInfo(slot); |
159 if (FLAG_pretenuring_call_new || info->IsAllocationSite()) { | 169 if (FLAG_pretenuring_call_new || info->IsAllocationSite()) { |
160 return Handle<AllocationSite>::cast(info); | 170 return Handle<AllocationSite>::cast(info); |
161 } | 171 } |
162 return Handle<AllocationSite>::null(); | 172 return Handle<AllocationSite>::null(); |
163 } | 173 } |
164 | 174 |
165 | 175 |
166 bool TypeFeedbackOracle::LoadIsBuiltin( | 176 bool TypeFeedbackOracle::LoadIsBuiltin( |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 UnseededNumberDictionary::kNotFound); | 480 UnseededNumberDictionary::kNotFound); |
471 // Dictionary has been allocated with sufficient size for all elements. | 481 // Dictionary has been allocated with sufficient size for all elements. |
472 DisallowHeapAllocation no_need_to_resize_dictionary; | 482 DisallowHeapAllocation no_need_to_resize_dictionary; |
473 HandleScope scope(isolate()); | 483 HandleScope scope(isolate()); |
474 USE(UnseededNumberDictionary::AtNumberPut( | 484 USE(UnseededNumberDictionary::AtNumberPut( |
475 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 485 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
476 } | 486 } |
477 | 487 |
478 | 488 |
479 } } // namespace v8::internal | 489 } } // namespace v8::internal |
OLD | NEW |