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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 *left_type = *right_type = stub.GetInputType(isolate_, map); | 276 *left_type = *right_type = stub.GetInputType(isolate_, map); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 281 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
282 Handle<Type>* left, | 282 Handle<Type>* left, |
283 Handle<Type>* right, | 283 Handle<Type>* right, |
284 Handle<Type>* result, | 284 Handle<Type>* result, |
285 Maybe<int>* fixed_right_arg, | 285 Maybe<int>* fixed_right_arg, |
286 Handle<AllocationSite>* allocation_site, | |
287 Token::Value op) { | 286 Token::Value op) { |
288 Handle<Object> object = GetInfo(id); | 287 Handle<Object> object = GetInfo(id); |
289 if (!object->IsCode()) { | 288 if (!object->IsCode()) { |
290 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the | 289 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
291 // operations covered by the BinaryOpIC we should always have them. | 290 // operations covered by the BinaryOpIC we should always have them. |
292 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || | 291 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || |
293 op > BinaryOpIC::State::LAST_TOKEN); | 292 op > BinaryOpIC::State::LAST_TOKEN); |
294 *left = *right = *result = handle(Type::None(), isolate_); | 293 *left = *right = *result = handle(Type::None(), isolate_); |
295 *fixed_right_arg = Maybe<int>(); | 294 *fixed_right_arg = Maybe<int>(); |
296 *allocation_site = Handle<AllocationSite>::null(); | |
297 return; | 295 return; |
298 } | 296 } |
299 Handle<Code> code = Handle<Code>::cast(object); | 297 Handle<Code> code = Handle<Code>::cast(object); |
300 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 298 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
301 BinaryOpIC::State state(code->extended_extra_ic_state()); | 299 BinaryOpIC::State state(code->extended_extra_ic_state()); |
302 ASSERT_EQ(op, state.op()); | 300 ASSERT_EQ(op, state.op()); |
303 | 301 |
304 *left = state.GetLeftType(isolate()); | 302 *left = state.GetLeftType(isolate()); |
305 *right = state.GetRightType(isolate()); | 303 *right = state.GetRightType(isolate()); |
306 *result = state.GetResultType(isolate()); | 304 *result = state.GetResultType(isolate()); |
307 *fixed_right_arg = state.fixed_right_arg(); | 305 *fixed_right_arg = state.fixed_right_arg(); |
308 | |
309 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); | |
310 if (first_allocation_site != NULL) { | |
311 *allocation_site = handle(first_allocation_site); | |
312 } else { | |
313 *allocation_site = Handle<AllocationSite>::null(); | |
314 } | |
315 } | 306 } |
316 | 307 |
317 | 308 |
318 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { | 309 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { |
319 Handle<Object> object = GetInfo(id); | 310 Handle<Object> object = GetInfo(id); |
320 if (!object->IsCode()) return handle(Type::None(), isolate_); | 311 if (!object->IsCode()) return handle(Type::None(), isolate_); |
321 Handle<Code> code = Handle<Code>::cast(object); | 312 Handle<Code> code = Handle<Code>::cast(object); |
322 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); | 313 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); |
323 BinaryOpIC::State state(code->extended_extra_ic_state()); | 314 BinaryOpIC::State state(code->extended_extra_ic_state()); |
324 return state.GetLeftType(isolate()); | 315 return state.GetLeftType(isolate()); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 #ifdef DEBUG | 566 #ifdef DEBUG |
576 Object* result = NULL; | 567 Object* result = NULL; |
577 // Dictionary has been allocated with sufficient size for all elements. | 568 // Dictionary has been allocated with sufficient size for all elements. |
578 ASSERT(maybe_result->ToObject(&result)); | 569 ASSERT(maybe_result->ToObject(&result)); |
579 ASSERT(*dictionary_ == result); | 570 ASSERT(*dictionary_ == result); |
580 #endif | 571 #endif |
581 } | 572 } |
582 | 573 |
583 | 574 |
584 } } // namespace v8::internal | 575 } } // namespace v8::internal |
OLD | NEW |