OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 LookupResult lookup(type->GetIsolate()); | 747 LookupResult lookup(type->GetIsolate()); |
748 type->LookupInDescriptors(NULL, *name, &lookup); | 748 type->LookupInDescriptors(NULL, *name, &lookup); |
749 // If the function wasn't found directly in the map, we start | 749 // If the function wasn't found directly in the map, we start |
750 // looking upwards through the prototype chain. | 750 // looking upwards through the prototype chain. |
751 if ((!lookup.IsFound() || IsTransitionType(lookup.type())) | 751 if ((!lookup.IsFound() || IsTransitionType(lookup.type())) |
752 && type->prototype()->IsJSObject()) { | 752 && type->prototype()->IsJSObject()) { |
753 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); | 753 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); |
754 type = Handle<Map>(holder()->map()); | 754 type = Handle<Map>(holder()->map()); |
755 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { | 755 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { |
756 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 756 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
757 return CanCallWithoutIC(target_, arguments()->length()); | 757 return CanCallWithoutIC(target_, arguments()->length()); |
fschneider
2012/01/17 15:50:09
Maybe the restriction can be lifted here as well?
| |
758 } else { | 758 } else { |
759 return false; | 759 return false; |
760 } | 760 } |
761 } | 761 } |
762 } | 762 } |
763 | 763 |
764 | 764 |
765 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, | 765 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
766 LookupResult* lookup) { | 766 LookupResult* lookup) { |
767 target_ = Handle<JSFunction>::null(); | 767 target_ = Handle<JSFunction>::null(); |
768 cell_ = Handle<JSGlobalPropertyCell>::null(); | 768 cell_ = Handle<JSGlobalPropertyCell>::null(); |
769 ASSERT(lookup->IsProperty() && | 769 ASSERT(lookup->IsProperty() && |
770 lookup->type() == NORMAL && | 770 lookup->type() == NORMAL && |
771 lookup->holder() == *global); | 771 lookup->holder() == *global); |
772 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(lookup)); | 772 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(lookup)); |
773 if (cell_->value()->IsJSFunction()) { | 773 if (cell_->value()->IsJSFunction()) { |
774 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); | 774 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); |
775 // If the function is in new space we assume it's more likely to | 775 // If the function is in new space we assume it's more likely to |
776 // change and thus prefer the general IC code. | 776 // change and thus prefer the general IC code. |
777 if (!HEAP->InNewSpace(*candidate) && | 777 if (!HEAP->InNewSpace(*candidate)) { |
778 CanCallWithoutIC(candidate, arguments()->length())) { | |
779 target_ = candidate; | 778 target_ = candidate; |
780 return true; | 779 return true; |
781 } | 780 } |
782 } | 781 } |
783 return false; | 782 return false; |
784 } | 783 } |
785 | 784 |
786 | 785 |
787 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 786 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
788 CallKind call_kind) { | 787 CallKind call_kind) { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 int pos) | 1210 int pos) |
1212 : label_(label), | 1211 : label_(label), |
1213 statements_(statements), | 1212 statements_(statements), |
1214 position_(pos), | 1213 position_(pos), |
1215 compare_type_(NONE), | 1214 compare_type_(NONE), |
1216 compare_id_(AstNode::GetNextId(isolate)), | 1215 compare_id_(AstNode::GetNextId(isolate)), |
1217 entry_id_(AstNode::GetNextId(isolate)) { | 1216 entry_id_(AstNode::GetNextId(isolate)) { |
1218 } | 1217 } |
1219 | 1218 |
1220 } } // namespace v8::internal | 1219 } } // namespace v8::internal |
OLD | NEW |