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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 *combined_type = stub.GetType(isolate_, map); | 374 *combined_type = stub.GetType(isolate_, map); |
| 375 *left_type = *right_type = stub.GetInputType(isolate_, map); | 375 *left_type = *right_type = stub.GetInputType(isolate_, map); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 | 379 |
| 380 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 380 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
| 381 Handle<Type>* left, | 381 Handle<Type>* left, |
| 382 Handle<Type>* right, | 382 Handle<Type>* right, |
| 383 Handle<Type>* result, | 383 Handle<Type>* result, |
| 384 Maybe<int>* fixed_right_arg) { | 384 Maybe<int>* fixed_right_arg, |
| 385 Token::Value operation) { | |
| 385 Handle<Object> object = GetInfo(id); | 386 Handle<Object> object = GetInfo(id); |
| 386 if (!object->IsCode()) { | 387 if (!object->IsCode()) { |
| 387 // For some binary ops we don't have ICs, e.g. Token::COMMA. | 388 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
| 389 // operations covered by the BinaryOpStub we should always have them. | |
| 390 ASSERT(!(operation >= BinaryOpStub::FIRST_TOKEN && | |
| 391 operation <= BinaryOpStub::LAST_TOKEN)); | |
| 388 *left = *right = *result = handle(Type::None(), isolate_); | 392 *left = *right = *result = handle(Type::None(), isolate_); |
| 389 return; | 393 return; |
| 390 } | 394 } |
| 391 Handle<Code> code = Handle<Code>::cast(object); | 395 Handle<Code> code = Handle<Code>::cast(object); |
| 392 ASSERT(code->is_binary_op_stub()); | 396 ASSERT(code->is_binary_op_stub()); |
| 393 | 397 |
| 394 int minor_key = code->stub_info(); | 398 BinaryOpStub stub(code->extended_extra_ic_state()); |
| 395 BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate()); | 399 |
| 396 *fixed_right_arg = | 400 // Sanity check. |
| 397 BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key); | 401 ASSERT(stub.operation() == operation); |
| 402 | |
| 403 *left = stub.GetLeftType(isolate()); | |
| 404 *right = stub.GetRightType(isolate()); | |
| 405 *result = stub.GetResultType(isolate()); | |
| 406 *fixed_right_arg = stub.fixed_right_arg(); | |
| 407 return; | |
|
Michael Starzinger
2013/09/27 08:36:11
Terminal return is obsolete.
| |
| 398 } | 408 } |
| 399 | 409 |
| 400 | 410 |
| 401 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { | 411 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { |
| 402 Handle<Object> info = GetInfo(id); | 412 Handle<Object> info = GetInfo(id); |
| 403 Handle<Type> result(Type::None(), isolate_); | 413 Handle<Type> result(Type::None(), isolate_); |
| 404 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { | 414 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { |
| 405 Handle<Code> code = Handle<Code>::cast(info); | 415 Handle<Code> code = Handle<Code>::cast(info); |
| 406 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); | 416 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); |
| 407 result = CompareIC::StateToType(isolate_, state); | 417 result = CompareIC::StateToType(isolate_, state); |
| 408 } | 418 } |
| 409 return result; | 419 return result; |
| 410 } | 420 } |
| 411 | 421 |
| 412 | 422 |
| 413 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { | 423 Handle<Type> TypeFeedbackOracle::IncrementType(CountOperation* expr) { |
| 414 Handle<Object> object = GetInfo(expr->CountBinOpFeedbackId()); | 424 Handle<Object> object = GetInfo(expr->CountBinOpFeedbackId()); |
| 415 TypeInfo unknown = TypeInfo::Unknown(); | 425 Handle<Type> unknown = handle(Type::None(), isolate_); |
|
Michael Starzinger
2013/09/27 08:36:11
nit: Can we use the constructor syntax instead of
| |
| 426 ASSERT(object->IsCode()); | |
| 416 if (!object->IsCode()) return unknown; | 427 if (!object->IsCode()) return unknown; |
| 417 Handle<Code> code = Handle<Code>::cast(object); | 428 Handle<Code> code = Handle<Code>::cast(object); |
| 418 if (!code->is_binary_op_stub()) return unknown; | 429 if (!code->is_binary_op_stub()) return unknown; |
| 419 | 430 |
| 420 BinaryOpIC::TypeInfo left_type, right_type, unused_result_type; | 431 BinaryOpStub stub(code->extended_extra_ic_state()); |
| 421 BinaryOpStub::decode_types_from_minor_key(code->stub_info(), &left_type, | 432 return stub.GetLeftType(isolate()); |
| 422 &right_type, &unused_result_type); | |
| 423 // CountOperations should always have +1 or -1 as their right input. | |
| 424 ASSERT(right_type == BinaryOpIC::SMI || | |
| 425 right_type == BinaryOpIC::UNINITIALIZED); | |
| 426 | |
| 427 switch (left_type) { | |
| 428 case BinaryOpIC::UNINITIALIZED: | |
| 429 case BinaryOpIC::SMI: | |
| 430 return TypeInfo::Smi(); | |
| 431 case BinaryOpIC::INT32: | |
| 432 return TypeInfo::Integer32(); | |
| 433 case BinaryOpIC::NUMBER: | |
| 434 return TypeInfo::Double(); | |
| 435 case BinaryOpIC::STRING: | |
| 436 case BinaryOpIC::GENERIC: | |
| 437 return unknown; | |
| 438 default: | |
| 439 return unknown; | |
| 440 } | |
| 441 UNREACHABLE(); | |
| 442 return unknown; | |
| 443 } | 433 } |
| 444 | 434 |
| 445 | 435 |
| 446 void TypeFeedbackOracle::CollectPolymorphicMaps(Handle<Code> code, | 436 void TypeFeedbackOracle::CollectPolymorphicMaps(Handle<Code> code, |
| 447 SmallMapList* types) { | 437 SmallMapList* types) { |
| 448 MapHandleList maps; | 438 MapHandleList maps; |
| 449 code->FindAllMaps(&maps); | 439 code->FindAllMaps(&maps); |
| 450 types->Reserve(maps.length(), zone()); | 440 types->Reserve(maps.length(), zone()); |
| 451 for (int i = 0; i < maps.length(); i++) { | 441 for (int i = 0; i < maps.length(); i++) { |
| 452 Handle<Map> map(maps.at(i)); | 442 Handle<Map> map(maps.at(i)); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 if (info.IsUninitialized()) return Representation::None(); | 682 if (info.IsUninitialized()) return Representation::None(); |
| 693 if (info.IsSmi()) return Representation::Smi(); | 683 if (info.IsSmi()) return Representation::Smi(); |
| 694 if (info.IsInteger32()) return Representation::Integer32(); | 684 if (info.IsInteger32()) return Representation::Integer32(); |
| 695 if (info.IsDouble()) return Representation::Double(); | 685 if (info.IsDouble()) return Representation::Double(); |
| 696 if (info.IsNumber()) return Representation::Double(); | 686 if (info.IsNumber()) return Representation::Double(); |
| 697 return Representation::Tagged(); | 687 return Representation::Tagged(); |
| 698 } | 688 } |
| 699 | 689 |
| 700 | 690 |
| 701 } } // namespace v8::internal | 691 } } // namespace v8::internal |
| OLD | NEW |