OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (!map.is_null() && CanRetainOtherContext(*map, *native_context_)) { | 199 if (!map.is_null() && CanRetainOtherContext(*map, *native_context_)) { |
200 map = Handle<Map>::null(); | 200 map = Handle<Map>::null(); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 if (code->is_compare_ic_stub()) { | 204 if (code->is_compare_ic_stub()) { |
205 int stub_minor_key = code->stub_info(); | 205 int stub_minor_key = code->stub_info(); |
206 CompareIC::StubInfoToType( | 206 CompareIC::StubInfoToType( |
207 stub_minor_key, left_type, right_type, combined_type, map, zone()); | 207 stub_minor_key, left_type, right_type, combined_type, map, zone()); |
208 } else if (code->is_compare_nil_ic_stub()) { | 208 } else if (code->is_compare_nil_ic_stub()) { |
209 CompareNilICStub stub(code->extended_extra_ic_state()); | 209 CompareNilICStub stub(code->extra_ic_state()); |
210 *combined_type = stub.GetType(zone(), map); | 210 *combined_type = stub.GetType(zone(), map); |
211 *left_type = *right_type = stub.GetInputType(zone(), map); | 211 *left_type = *right_type = stub.GetInputType(zone(), map); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 216 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
217 Type** left, | 217 Type** left, |
218 Type** right, | 218 Type** right, |
219 Type** result, | 219 Type** result, |
220 Maybe<int>* fixed_right_arg, | 220 Maybe<int>* fixed_right_arg, |
221 Handle<AllocationSite>* allocation_site, | 221 Handle<AllocationSite>* allocation_site, |
222 Token::Value op) { | 222 Token::Value op) { |
223 Handle<Object> object = GetInfo(id); | 223 Handle<Object> object = GetInfo(id); |
224 if (!object->IsCode()) { | 224 if (!object->IsCode()) { |
225 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the | 225 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
226 // operations covered by the BinaryOpIC we should always have them. | 226 // operations covered by the BinaryOpIC we should always have them. |
227 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || | 227 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || |
228 op > BinaryOpIC::State::LAST_TOKEN); | 228 op > BinaryOpIC::State::LAST_TOKEN); |
229 *left = *right = *result = Type::None(zone()); | 229 *left = *right = *result = Type::None(zone()); |
230 *fixed_right_arg = Maybe<int>(); | 230 *fixed_right_arg = Maybe<int>(); |
231 *allocation_site = Handle<AllocationSite>::null(); | 231 *allocation_site = Handle<AllocationSite>::null(); |
232 return; | 232 return; |
233 } | 233 } |
234 Handle<Code> code = Handle<Code>::cast(object); | 234 Handle<Code> code = Handle<Code>::cast(object); |
235 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 235 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
236 BinaryOpIC::State state(code->extended_extra_ic_state()); | 236 BinaryOpIC::State state(code->extra_ic_state()); |
237 ASSERT_EQ(op, state.op()); | 237 ASSERT_EQ(op, state.op()); |
238 | 238 |
239 *left = state.GetLeftType(zone()); | 239 *left = state.GetLeftType(zone()); |
240 *right = state.GetRightType(zone()); | 240 *right = state.GetRightType(zone()); |
241 *result = state.GetResultType(zone()); | 241 *result = state.GetResultType(zone()); |
242 *fixed_right_arg = state.fixed_right_arg(); | 242 *fixed_right_arg = state.fixed_right_arg(); |
243 | 243 |
244 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); | 244 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); |
245 if (first_allocation_site != NULL) { | 245 if (first_allocation_site != NULL) { |
246 *allocation_site = handle(first_allocation_site); | 246 *allocation_site = handle(first_allocation_site); |
247 } else { | 247 } else { |
248 *allocation_site = Handle<AllocationSite>::null(); | 248 *allocation_site = Handle<AllocationSite>::null(); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { | 253 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { |
254 Handle<Object> object = GetInfo(id); | 254 Handle<Object> object = GetInfo(id); |
255 if (!object->IsCode()) return Type::None(zone()); | 255 if (!object->IsCode()) return Type::None(zone()); |
256 Handle<Code> code = Handle<Code>::cast(object); | 256 Handle<Code> code = Handle<Code>::cast(object); |
257 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 257 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
258 BinaryOpIC::State state(code->extended_extra_ic_state()); | 258 BinaryOpIC::State state(code->extra_ic_state()); |
259 return state.GetLeftType(zone()); | 259 return state.GetLeftType(zone()); |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 void TypeFeedbackOracle::PropertyReceiverTypes( | 263 void TypeFeedbackOracle::PropertyReceiverTypes( |
264 TypeFeedbackId id, Handle<String> name, | 264 TypeFeedbackId id, Handle<String> name, |
265 SmallMapList* receiver_types, bool* is_prototype) { | 265 SmallMapList* receiver_types, bool* is_prototype) { |
266 receiver_types->Clear(); | 266 receiver_types->Clear(); |
267 FunctionPrototypeStub proto_stub(Code::LOAD_IC); | 267 FunctionPrototypeStub proto_stub(Code::LOAD_IC); |
268 *is_prototype = LoadIsStub(id, &proto_stub); | 268 *is_prototype = LoadIsStub(id, &proto_stub); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 #ifdef DEBUG | 503 #ifdef DEBUG |
504 Object* result = NULL; | 504 Object* result = NULL; |
505 // Dictionary has been allocated with sufficient size for all elements. | 505 // Dictionary has been allocated with sufficient size for all elements. |
506 ASSERT(maybe_result->ToObject(&result)); | 506 ASSERT(maybe_result->ToObject(&result)); |
507 ASSERT(*dictionary_ == result); | 507 ASSERT(*dictionary_ == result); |
508 #endif | 508 #endif |
509 } | 509 } |
510 | 510 |
511 | 511 |
512 } } // namespace v8::internal | 512 } } // namespace v8::internal |
OLD | NEW |