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