| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 SharedFunctionInfo* info = target->shared(); | 563 SharedFunctionInfo* info = target->shared(); |
| 564 // If the number of formal parameters of the target function does | 564 // If the number of formal parameters of the target function does |
| 565 // not match the number of arguments we're passing, we don't want to | 565 // not match the number of arguments we're passing, we don't want to |
| 566 // deal with it. Otherwise, we can call it directly. | 566 // deal with it. Otherwise, we can call it directly. |
| 567 return !target->NeedsArgumentsAdaption() || | 567 return !target->NeedsArgumentsAdaption() || |
| 568 info->formal_parameter_count() == arity; | 568 info->formal_parameter_count() == arity; |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { | 572 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { |
| 573 holder_ = Handle<JSObject>::null(); | 573 if (check_type_ == RECEIVER_MAP_CHECK) { |
| 574 // For primitive checks the holder is set up to point to the |
| 575 // corresponding prototype object, i.e. one step of the algorithm |
| 576 // below has been already performed. |
| 577 // For non-primitive checks we clear it to allow computing targets |
| 578 // for polymorphic calls. |
| 579 holder_ = Handle<JSObject>::null(); |
| 580 } |
| 574 while (true) { | 581 while (true) { |
| 575 LookupResult lookup; | 582 LookupResult lookup; |
| 576 type->LookupInDescriptors(NULL, *name, &lookup); | 583 type->LookupInDescriptors(NULL, *name, &lookup); |
| 577 // If the function wasn't found directly in the map, we start | 584 // If the function wasn't found directly in the map, we start |
| 578 // looking upwards through the prototype chain. | 585 // looking upwards through the prototype chain. |
| 579 if (!lookup.IsFound() && type->prototype()->IsJSObject()) { | 586 if (!lookup.IsFound() && type->prototype()->IsJSObject()) { |
| 580 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); | 587 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); |
| 581 type = Handle<Map>(holder()->map()); | 588 type = Handle<Map>(holder()->map()); |
| 582 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { | 589 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { |
| 583 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 590 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 #endif | 640 #endif |
| 634 is_monomorphic_ = oracle->CallIsMonomorphic(this); | 641 is_monomorphic_ = oracle->CallIsMonomorphic(this); |
| 635 check_type_ = oracle->GetCallCheckType(this); | 642 check_type_ = oracle->GetCallCheckType(this); |
| 636 if (is_monomorphic_) { | 643 if (is_monomorphic_) { |
| 637 Handle<Map> map; | 644 Handle<Map> map; |
| 638 if (receiver_types_ != NULL && receiver_types_->length() > 0) { | 645 if (receiver_types_ != NULL && receiver_types_->length() > 0) { |
| 639 ASSERT(check_type_ == RECEIVER_MAP_CHECK); | 646 ASSERT(check_type_ == RECEIVER_MAP_CHECK); |
| 640 map = receiver_types_->at(0); | 647 map = receiver_types_->at(0); |
| 641 } else { | 648 } else { |
| 642 ASSERT(check_type_ != RECEIVER_MAP_CHECK); | 649 ASSERT(check_type_ != RECEIVER_MAP_CHECK); |
| 643 map = Handle<Map>( | 650 holder_ = Handle<JSObject>( |
| 644 oracle->GetPrototypeForPrimitiveCheck(check_type_)->map()); | 651 oracle->GetPrototypeForPrimitiveCheck(check_type_)); |
| 652 map = Handle<Map>(holder_->map()); |
| 645 } | 653 } |
| 646 is_monomorphic_ = ComputeTarget(map, name); | 654 is_monomorphic_ = ComputeTarget(map, name); |
| 647 } | 655 } |
| 648 } | 656 } |
| 649 | 657 |
| 650 | 658 |
| 651 void BinaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 659 void BinaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
| 652 TypeInfo left = oracle->BinaryType(this, TypeFeedbackOracle::LEFT); | 660 TypeInfo left = oracle->BinaryType(this, TypeFeedbackOracle::LEFT); |
| 653 TypeInfo right = oracle->BinaryType(this, TypeFeedbackOracle::RIGHT); | 661 TypeInfo right = oracle->BinaryType(this, TypeFeedbackOracle::RIGHT); |
| 654 is_smi_only_ = left.IsSmi() && right.IsSmi(); | 662 is_smi_only_ = left.IsSmi() && right.IsSmi(); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1048 |
| 1041 CaseClause::CaseClause(Expression* label, | 1049 CaseClause::CaseClause(Expression* label, |
| 1042 ZoneList<Statement*>* statements, | 1050 ZoneList<Statement*>* statements, |
| 1043 int pos) | 1051 int pos) |
| 1044 : label_(label), | 1052 : label_(label), |
| 1045 statements_(statements), | 1053 statements_(statements), |
| 1046 position_(pos), | 1054 position_(pos), |
| 1047 compare_type_(NONE) {} | 1055 compare_type_(NONE) {} |
| 1048 | 1056 |
| 1049 } } // namespace v8::internal | 1057 } } // namespace v8::internal |
| OLD | NEW |