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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 614 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
615 return CanCallWithoutIC(target_, arguments()->length()); | 615 return CanCallWithoutIC(target_, arguments()->length()); |
616 } else { | 616 } else { |
617 return false; | 617 return false; |
618 } | 618 } |
619 } | 619 } |
620 } | 620 } |
621 | 621 |
622 | 622 |
623 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, | 623 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
624 Handle<String> name) { | 624 LookupResult& lookup) { |
625 target_ = Handle<JSFunction>::null(); | 625 target_ = Handle<JSFunction>::null(); |
626 cell_ = Handle<JSGlobalPropertyCell>::null(); | 626 cell_ = Handle<JSGlobalPropertyCell>::null(); |
627 LookupResult lookup; | 627 ASSERT(lookup.IsProperty() && |
628 global->Lookup(*name, &lookup); | 628 lookup.type() == NORMAL && |
629 if (lookup.IsProperty() && | 629 lookup.holder() == *global); |
630 lookup.type() == NORMAL && | 630 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(&lookup)); |
631 lookup.holder() == *global) { | 631 if (cell_->value()->IsJSFunction()) { |
632 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(&lookup)); | 632 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); |
633 if (cell_->value()->IsJSFunction()) { | 633 // If the function is in new space we assume it's more likely to |
634 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); | 634 // change and thus prefer the general IC code. |
635 // If the function is in new space we assume it's more likely to | 635 if (!Heap::InNewSpace(*candidate) && |
636 // change and thus prefer the general IC code. | 636 CanCallWithoutIC(candidate, arguments()->length())) { |
637 if (!Heap::InNewSpace(*candidate) && | 637 target_ = candidate; |
638 CanCallWithoutIC(candidate, arguments()->length())) { | 638 return true; |
639 target_ = candidate; | |
640 return true; | |
641 } | |
642 } | 639 } |
643 } | 640 } |
644 return false; | 641 return false; |
645 } | 642 } |
646 | 643 |
647 | 644 |
648 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 645 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
649 Property* property = expression()->AsProperty(); | 646 Property* property = expression()->AsProperty(); |
650 ASSERT(property != NULL); | 647 ASSERT(property != NULL); |
651 // Specialize for the receiver types seen at runtime. | 648 // Specialize for the receiver types seen at runtime. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 ZoneList<Statement*>* statements, | 1065 ZoneList<Statement*>* statements, |
1069 int pos) | 1066 int pos) |
1070 : label_(label), | 1067 : label_(label), |
1071 statements_(statements), | 1068 statements_(statements), |
1072 position_(pos), | 1069 position_(pos), |
1073 compare_type_(NONE), | 1070 compare_type_(NONE), |
1074 entry_id_(AstNode::GetNextId()) { | 1071 entry_id_(AstNode::GetNextId()) { |
1075 } | 1072 } |
1076 | 1073 |
1077 } } // namespace v8::internal | 1074 } } // namespace v8::internal |
OLD | NEW |