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 4782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4793 | 4793 |
4794 int SharedFunctionInfo::CalculateInObjectProperties() { | 4794 int SharedFunctionInfo::CalculateInObjectProperties() { |
4795 return (CalculateInstanceSize() - JSObject::kHeaderSize) / kPointerSize; | 4795 return (CalculateInstanceSize() - JSObject::kHeaderSize) / kPointerSize; |
4796 } | 4796 } |
4797 | 4797 |
4798 | 4798 |
4799 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( | 4799 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( |
4800 bool only_this_property_assignments, | 4800 bool only_this_property_assignments, |
4801 bool only_simple_this_property_assignments, | 4801 bool only_simple_this_property_assignments, |
4802 FixedArray* assignments) { | 4802 FixedArray* assignments) { |
| 4803 ASSERT(this_property_assignments()->IsUndefined()); |
4803 set_compiler_hints(BooleanBit::set(compiler_hints(), | 4804 set_compiler_hints(BooleanBit::set(compiler_hints(), |
4804 kHasOnlyThisPropertyAssignments, | 4805 kHasOnlyThisPropertyAssignments, |
4805 only_this_property_assignments)); | 4806 only_this_property_assignments)); |
4806 set_compiler_hints(BooleanBit::set(compiler_hints(), | 4807 set_compiler_hints(BooleanBit::set(compiler_hints(), |
4807 kHasOnlySimpleThisPropertyAssignments, | 4808 kHasOnlySimpleThisPropertyAssignments, |
4808 only_simple_this_property_assignments)); | 4809 only_simple_this_property_assignments)); |
4809 set_this_property_assignments(assignments); | 4810 set_this_property_assignments(assignments); |
4810 set_this_property_assignments_count(assignments->length() / 3); | 4811 set_this_property_assignments_count(assignments->length() / 3); |
4811 } | 4812 } |
4812 | 4813 |
4813 | 4814 |
4814 void SharedFunctionInfo::ClearThisPropertyAssignmentsInfo() { | |
4815 set_compiler_hints(BooleanBit::set(compiler_hints(), | |
4816 kHasOnlyThisPropertyAssignments, | |
4817 false)); | |
4818 set_compiler_hints(BooleanBit::set(compiler_hints(), | |
4819 kHasOnlySimpleThisPropertyAssignments, | |
4820 false)); | |
4821 set_this_property_assignments(Heap::undefined_value()); | |
4822 set_this_property_assignments_count(0); | |
4823 } | |
4824 | |
4825 | |
4826 String* SharedFunctionInfo::GetThisPropertyAssignmentName(int index) { | 4815 String* SharedFunctionInfo::GetThisPropertyAssignmentName(int index) { |
4827 Object* obj = this_property_assignments(); | 4816 Object* obj = this_property_assignments(); |
4828 ASSERT(obj->IsFixedArray()); | 4817 ASSERT(obj->IsFixedArray()); |
4829 ASSERT(index < this_property_assignments_count()); | 4818 ASSERT(index < this_property_assignments_count()); |
4830 obj = FixedArray::cast(obj)->get(index * 3); | 4819 obj = FixedArray::cast(obj)->get(index * 3); |
4831 ASSERT(obj->IsString()); | 4820 ASSERT(obj->IsString()); |
4832 return String::cast(obj); | 4821 return String::cast(obj); |
4833 } | 4822 } |
4834 | 4823 |
4835 | 4824 |
4836 bool SharedFunctionInfo::IsThisPropertyAssignmentArgument(int index) { | |
4837 Object* obj = this_property_assignments(); | |
4838 ASSERT(obj->IsFixedArray()); | |
4839 ASSERT(index < this_property_assignments_count()); | |
4840 obj = FixedArray::cast(obj)->get(index * 3 + 1); | |
4841 return Smi::cast(obj)->value() != -1; | |
4842 } | |
4843 | |
4844 | |
4845 int SharedFunctionInfo::GetThisPropertyAssignmentArgument(int index) { | |
4846 ASSERT(IsThisPropertyAssignmentArgument(index)); | |
4847 Object* obj = | |
4848 FixedArray::cast(this_property_assignments())->get(index * 3 + 1); | |
4849 return Smi::cast(obj)->value(); | |
4850 } | |
4851 | |
4852 | |
4853 Object* SharedFunctionInfo::GetThisPropertyAssignmentConstant(int index) { | |
4854 ASSERT(!IsThisPropertyAssignmentArgument(index)); | |
4855 Object* obj = | |
4856 FixedArray::cast(this_property_assignments())->get(index * 3 + 2); | |
4857 return obj; | |
4858 } | |
4859 | |
4860 | |
4861 | |
4862 // Support function for printing the source code to a StringStream | 4825 // Support function for printing the source code to a StringStream |
4863 // without any allocation in the heap. | 4826 // without any allocation in the heap. |
4864 void SharedFunctionInfo::SourceCodePrint(StringStream* accumulator, | 4827 void SharedFunctionInfo::SourceCodePrint(StringStream* accumulator, |
4865 int max_length) { | 4828 int max_length) { |
4866 // For some native functions there is no source. | 4829 // For some native functions there is no source. |
4867 if (script()->IsUndefined() || | 4830 if (script()->IsUndefined() || |
4868 Script::cast(script())->source()->IsUndefined()) { | 4831 Script::cast(script())->source()->IsUndefined()) { |
4869 accumulator->Add("<No Source>"); | 4832 accumulator->Add("<No Source>"); |
4870 return; | 4833 return; |
4871 } | 4834 } |
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7985 if (break_point_objects()->IsUndefined()) return 0; | 7948 if (break_point_objects()->IsUndefined()) return 0; |
7986 // Single beak point. | 7949 // Single beak point. |
7987 if (!break_point_objects()->IsFixedArray()) return 1; | 7950 if (!break_point_objects()->IsFixedArray()) return 1; |
7988 // Multiple break points. | 7951 // Multiple break points. |
7989 return FixedArray::cast(break_point_objects())->length(); | 7952 return FixedArray::cast(break_point_objects())->length(); |
7990 } | 7953 } |
7991 #endif | 7954 #endif |
7992 | 7955 |
7993 | 7956 |
7994 } } // namespace v8::internal | 7957 } } // namespace v8::internal |
OLD | NEW |