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