OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4822 | 4822 |
4823 int SharedFunctionInfo::CalculateInObjectProperties() { | 4823 int SharedFunctionInfo::CalculateInObjectProperties() { |
4824 return (CalculateInstanceSize() - JSObject::kHeaderSize) / kPointerSize; | 4824 return (CalculateInstanceSize() - JSObject::kHeaderSize) / kPointerSize; |
4825 } | 4825 } |
4826 | 4826 |
4827 | 4827 |
4828 bool SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) { | 4828 bool SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) { |
4829 // Check the basic conditions for generating inline constructor code. | 4829 // Check the basic conditions for generating inline constructor code. |
4830 if (!FLAG_inline_new | 4830 if (!FLAG_inline_new |
4831 || !has_only_simple_this_property_assignments() | 4831 || !has_only_simple_this_property_assignments() |
4832 || !this_property_assignments_count() > 0) { | 4832 || this_property_assignments_count() == 0) { |
4833 return false; | 4833 return false; |
4834 } | 4834 } |
4835 | 4835 |
4836 // If the prototype is null inline constructors cause no problems. | 4836 // If the prototype is null inline constructors cause no problems. |
4837 if (!prototype->IsJSObject()) { | 4837 if (!prototype->IsJSObject()) { |
4838 ASSERT(prototype->IsNull()); | 4838 ASSERT(prototype->IsNull()); |
4839 return true; | 4839 return true; |
4840 } | 4840 } |
4841 | 4841 |
4842 // Traverse the proposed prototype chain looking for setters for properties of | 4842 // Traverse the proposed prototype chain looking for setters for properties of |
4843 // the same names as are set by the inline constructor.. | 4843 // the same names as are set by the inline constructor. |
4844 for (Object* obj = prototype; | 4844 for (Object* obj = prototype; |
4845 obj != Heap::null_value(); | 4845 obj != Heap::null_value(); |
4846 obj = obj->GetPrototype()) { | 4846 obj = obj->GetPrototype()) { |
4847 JSObject* js_object = JSObject::cast(obj); | 4847 JSObject* js_object = JSObject::cast(obj); |
4848 if (!js_object->HasFastProperties()) { | 4848 if (!js_object->HasFastProperties()) { |
4849 // Only allow fast case objects, as the map check in the inline | 4849 // Only allow fast case objects, as the map check in the inline |
4850 // constructor which check for changes to the prototype chain cannot | 4850 // constructor which check for changes to the prototype chain cannot |
4851 // handle dictionary case objects. | 4851 // handle dictionary case objects. |
4852 return false; | 4852 return false; |
4853 } | 4853 } |
(...skipping 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8386 if (break_point_objects()->IsUndefined()) return 0; | 8386 if (break_point_objects()->IsUndefined()) return 0; |
8387 // Single beak point. | 8387 // Single beak point. |
8388 if (!break_point_objects()->IsFixedArray()) return 1; | 8388 if (!break_point_objects()->IsFixedArray()) return 1; |
8389 // Multiple break points. | 8389 // Multiple break points. |
8390 return FixedArray::cast(break_point_objects())->length(); | 8390 return FixedArray::cast(break_point_objects())->length(); |
8391 } | 8391 } |
8392 #endif | 8392 #endif |
8393 | 8393 |
8394 | 8394 |
8395 } } // namespace v8::internal | 8395 } } // namespace v8::internal |
OLD | NEW |