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 4804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4815 kHasOnlyThisPropertyAssignments, | 4815 kHasOnlyThisPropertyAssignments, |
4816 only_this_property_assignments)); | 4816 only_this_property_assignments)); |
4817 set_compiler_hints(BooleanBit::set(compiler_hints(), | 4817 set_compiler_hints(BooleanBit::set(compiler_hints(), |
4818 kHasOnlySimpleThisPropertyAssignments, | 4818 kHasOnlySimpleThisPropertyAssignments, |
4819 only_simple_this_property_assignments)); | 4819 only_simple_this_property_assignments)); |
4820 set_this_property_assignments(assignments); | 4820 set_this_property_assignments(assignments); |
4821 set_this_property_assignments_count(assignments->length() / 3); | 4821 set_this_property_assignments_count(assignments->length() / 3); |
4822 } | 4822 } |
4823 | 4823 |
4824 | 4824 |
| 4825 void SharedFunctionInfo::ClearThisPropertyAssignmentsInfo() { |
| 4826 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 4827 kHasOnlyThisPropertyAssignments, |
| 4828 false)); |
| 4829 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 4830 kHasOnlySimpleThisPropertyAssignments, |
| 4831 false)); |
| 4832 set_this_property_assignments(Heap::undefined_value()); |
| 4833 set_this_property_assignments_count(0); |
| 4834 } |
| 4835 |
| 4836 |
4825 String* SharedFunctionInfo::GetThisPropertyAssignmentName(int index) { | 4837 String* SharedFunctionInfo::GetThisPropertyAssignmentName(int index) { |
4826 Object* obj = this_property_assignments(); | 4838 Object* obj = this_property_assignments(); |
4827 ASSERT(obj->IsFixedArray()); | 4839 ASSERT(obj->IsFixedArray()); |
4828 ASSERT(index < this_property_assignments_count()); | 4840 ASSERT(index < this_property_assignments_count()); |
4829 obj = FixedArray::cast(obj)->get(index * 3); | 4841 obj = FixedArray::cast(obj)->get(index * 3); |
4830 ASSERT(obj->IsString()); | 4842 ASSERT(obj->IsString()); |
4831 return String::cast(obj); | 4843 return String::cast(obj); |
4832 } | 4844 } |
4833 | 4845 |
4834 | 4846 |
| 4847 bool SharedFunctionInfo::IsThisPropertyAssignmentArgument(int index) { |
| 4848 Object* obj = this_property_assignments(); |
| 4849 ASSERT(obj->IsFixedArray()); |
| 4850 ASSERT(index < this_property_assignments_count()); |
| 4851 obj = FixedArray::cast(obj)->get(index * 3 + 1); |
| 4852 return Smi::cast(obj)->value() != -1; |
| 4853 } |
| 4854 |
| 4855 |
| 4856 int SharedFunctionInfo::GetThisPropertyAssignmentArgument(int index) { |
| 4857 ASSERT(IsThisPropertyAssignmentArgument(index)); |
| 4858 Object* obj = |
| 4859 FixedArray::cast(this_property_assignments())->get(index * 3 + 1); |
| 4860 return Smi::cast(obj)->value(); |
| 4861 } |
| 4862 |
| 4863 |
| 4864 Object* SharedFunctionInfo::GetThisPropertyAssignmentConstant(int index) { |
| 4865 ASSERT(!IsThisPropertyAssignmentArgument(index)); |
| 4866 Object* obj = |
| 4867 FixedArray::cast(this_property_assignments())->get(index * 3 + 2); |
| 4868 return obj; |
| 4869 } |
| 4870 |
| 4871 |
| 4872 |
4835 // Support function for printing the source code to a StringStream | 4873 // Support function for printing the source code to a StringStream |
4836 // without any allocation in the heap. | 4874 // without any allocation in the heap. |
4837 void SharedFunctionInfo::SourceCodePrint(StringStream* accumulator, | 4875 void SharedFunctionInfo::SourceCodePrint(StringStream* accumulator, |
4838 int max_length) { | 4876 int max_length) { |
4839 // For some native functions there is no source. | 4877 // For some native functions there is no source. |
4840 if (script()->IsUndefined() || | 4878 if (script()->IsUndefined() || |
4841 Script::cast(script())->source()->IsUndefined()) { | 4879 Script::cast(script())->source()->IsUndefined()) { |
4842 accumulator->Add("<No Source>"); | 4880 accumulator->Add("<No Source>"); |
4843 return; | 4881 return; |
4844 } | 4882 } |
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7958 if (break_point_objects()->IsUndefined()) return 0; | 7996 if (break_point_objects()->IsUndefined()) return 0; |
7959 // Single beak point. | 7997 // Single beak point. |
7960 if (!break_point_objects()->IsFixedArray()) return 1; | 7998 if (!break_point_objects()->IsFixedArray()) return 1; |
7961 // Multiple break points. | 7999 // Multiple break points. |
7962 return FixedArray::cast(break_point_objects())->length(); | 8000 return FixedArray::cast(break_point_objects())->length(); |
7963 } | 8001 } |
7964 #endif | 8002 #endif |
7965 | 8003 |
7966 | 8004 |
7967 } } // namespace v8::internal | 8005 } } // namespace v8::internal |
OLD | NEW |