Chromium Code Reviews| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 if (!code->is_load_stub()) return false; | 349 if (!code->is_load_stub()) return false; |
| 350 if (code->ic_state() != MONOMORPHIC) return false; | 350 if (code->ic_state() != MONOMORPHIC) return false; |
| 351 return stub->Describes(*code); | 351 return stub->Describes(*code); |
| 352 } | 352 } |
| 353 | 353 |
| 354 | 354 |
| 355 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, | 355 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, |
| 356 Handle<Type>* left_type, | 356 Handle<Type>* left_type, |
| 357 Handle<Type>* right_type, | 357 Handle<Type>* right_type, |
| 358 Handle<Type>* combined_type) { | 358 Handle<Type>* combined_type) { |
| 359 *left_type = *right_type = *combined_type = handle(Type::Any(), isolate_); | |
| 360 Handle<Object> info = GetInfo(id); | 359 Handle<Object> info = GetInfo(id); |
| 361 if (!info->IsCode()) return; | 360 if (!info->IsCode()) { |
| 361 *left_type = *right_type = *combined_type = handle(Type::None(), isolate_); | |
|
rossberg
2013/07/02 15:33:50
Can we add a comment here explaining why this can
Jakob Kummerow
2013/07/02 16:29:54
Done.
| |
| 362 return; | |
| 363 } | |
| 362 Handle<Code> code = Handle<Code>::cast(info); | 364 Handle<Code> code = Handle<Code>::cast(info); |
| 363 | 365 |
| 364 Handle<Map> map; | 366 Handle<Map> map; |
| 365 Map* raw_map = code->FindFirstMap(); | 367 Map* raw_map = code->FindFirstMap(); |
| 366 if (raw_map != NULL) { | 368 if (raw_map != NULL) { |
| 367 raw_map = raw_map->CurrentMapForDeprecated(); | 369 raw_map = raw_map->CurrentMapForDeprecated(); |
| 368 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { | 370 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { |
| 369 map = handle(raw_map, isolate_); | 371 map = handle(raw_map, isolate_); |
| 370 } | 372 } |
| 371 } | 373 } |
| 372 | 374 |
| 373 if (code->is_compare_ic_stub()) { | 375 if (code->is_compare_ic_stub()) { |
| 374 int stub_minor_key = code->stub_info(); | 376 int stub_minor_key = code->stub_info(); |
| 375 CompareIC::StubInfoToType( | 377 CompareIC::StubInfoToType( |
| 376 stub_minor_key, left_type, right_type, combined_type, map, isolate()); | 378 stub_minor_key, left_type, right_type, combined_type, map, isolate()); |
| 377 } else if (code->is_compare_nil_ic_stub()) { | 379 } else if (code->is_compare_nil_ic_stub()) { |
| 378 CompareNilICStub::State state(code->compare_nil_state()); | 380 CompareNilICStub::State state(code->compare_nil_state()); |
| 379 *combined_type = CompareNilICStub::StateToType(isolate_, state, map); | 381 *combined_type = CompareNilICStub::StateToType(isolate_, state, map); |
| 380 Handle<Type> nil_type = handle(code->compare_nil_value() == kNullValue | 382 Handle<Type> nil_type = handle(code->compare_nil_value() == kNullValue |
| 381 ? Type::Null() : Type::Undefined(), isolate_); | 383 ? Type::Null() : Type::Undefined(), isolate_); |
| 382 *left_type = *right_type = | 384 *left_type = *right_type = |
| 383 handle(Type::Union(*combined_type, nil_type), isolate_); | 385 handle(Type::Union(*combined_type, nil_type), isolate_); |
| 384 } | 386 } |
| 385 } | 387 } |
| 386 | 388 |
| 387 | 389 |
| 388 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) { | 390 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) { |
| 389 Handle<Object> object = GetInfo(id); | 391 Handle<Object> object = GetInfo(id); |
| 390 if (!object->IsCode()) return handle(Type::Any(), isolate()); | 392 if (!object->IsCode()) { |
| 393 return handle(Type::None(), isolate()); | |
| 394 } | |
| 391 Handle<Code> code = Handle<Code>::cast(object); | 395 Handle<Code> code = Handle<Code>::cast(object); |
| 392 ASSERT(code->is_unary_op_stub()); | 396 ASSERT(code->is_unary_op_stub()); |
| 393 return UnaryOpIC::TypeInfoToType( | 397 return UnaryOpIC::TypeInfoToType( |
| 394 static_cast<UnaryOpIC::TypeInfo>(code->unary_op_type()), isolate()); | 398 static_cast<UnaryOpIC::TypeInfo>(code->unary_op_type()), isolate()); |
| 395 } | 399 } |
| 396 | 400 |
| 397 | 401 |
| 398 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 402 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
| 399 Handle<Type>* left, | 403 Handle<Type>* left, |
| 400 Handle<Type>* right, | 404 Handle<Type>* right, |
| 401 Handle<Type>* result, | 405 Handle<Type>* result, |
| 402 Maybe<int>* fixed_right_arg) { | 406 Maybe<int>* fixed_right_arg) { |
| 403 Handle<Object> object = GetInfo(id); | 407 Handle<Object> object = GetInfo(id); |
| 404 *left = *right = *result = handle(Type::Any(), isolate_); | 408 if (!object->IsCode()) { |
| 405 if (!object->IsCode()) return; | 409 *left = *right = *result = handle(Type::None(), isolate_); |
|
rossberg
2013/07/02 15:33:50
Same here.
Jakob Kummerow
2013/07/02 16:29:54
Done.
| |
| 410 return; | |
| 411 } | |
| 406 Handle<Code> code = Handle<Code>::cast(object); | 412 Handle<Code> code = Handle<Code>::cast(object); |
| 407 if (!code->is_binary_op_stub()) return; | 413 ASSERT(code->is_binary_op_stub()); |
| 408 | 414 |
| 409 int minor_key = code->stub_info(); | 415 int minor_key = code->stub_info(); |
| 410 BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate()); | 416 BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate()); |
| 411 *fixed_right_arg = | 417 *fixed_right_arg = |
| 412 BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key); | 418 BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key); |
| 413 } | 419 } |
| 414 | 420 |
| 415 | 421 |
| 416 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { | 422 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { |
| 417 Handle<Object> info = GetInfo(id); | 423 Handle<Object> info = GetInfo(id); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 USE(maybe_result); | 690 USE(maybe_result); |
| 685 #ifdef DEBUG | 691 #ifdef DEBUG |
| 686 Object* result = NULL; | 692 Object* result = NULL; |
| 687 // Dictionary has been allocated with sufficient size for all elements. | 693 // Dictionary has been allocated with sufficient size for all elements. |
| 688 ASSERT(maybe_result->ToObject(&result)); | 694 ASSERT(maybe_result->ToObject(&result)); |
| 689 ASSERT(*dictionary_ == result); | 695 ASSERT(*dictionary_ == result); |
| 690 #endif | 696 #endif |
| 691 } | 697 } |
| 692 | 698 |
| 693 } } // namespace v8::internal | 699 } } // namespace v8::internal |
| OLD | NEW |