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 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 // If name is an index we need to stay in slow case. | 2731 // If name is an index we need to stay in slow case. |
2732 Dictionary* elements = Dictionary::cast(dict); | 2732 Dictionary* elements = Dictionary::cast(dict); |
2733 elements->set_requires_slow_elements(); | 2733 elements->set_requires_slow_elements(); |
2734 // Set the potential new dictionary on the object. | 2734 // Set the potential new dictionary on the object. |
2735 set_elements(Dictionary::cast(dict)); | 2735 set_elements(Dictionary::cast(dict)); |
2736 } else { | 2736 } else { |
2737 // Normalize object to make this operation simple. | 2737 // Normalize object to make this operation simple. |
2738 Object* ok = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES); | 2738 Object* ok = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES); |
2739 if (ok->IsFailure()) return ok; | 2739 if (ok->IsFailure()) return ok; |
2740 | 2740 |
| 2741 // For the global object allocate a new map to invalidate the global inline |
| 2742 // caches which have a global property cell reference directly in the code. |
| 2743 if (IsJSGlobalObject()) { |
| 2744 Object* new_map = map()->CopyDropDescriptors(); |
| 2745 if (new_map->IsFailure()) return new_map; |
| 2746 set_map(Map::cast(new_map)); |
| 2747 } |
| 2748 |
2741 // Update the dictionary with the new CALLBACKS property. | 2749 // Update the dictionary with the new CALLBACKS property. |
2742 return SetNormalizedProperty(name, structure, details); | 2750 return SetNormalizedProperty(name, structure, details); |
2743 } | 2751 } |
2744 | 2752 |
2745 return structure; | 2753 return structure; |
2746 } | 2754 } |
2747 | 2755 |
2748 | 2756 |
2749 Object* JSObject::DefineAccessor(String* name, bool is_getter, JSFunction* fun, | 2757 Object* JSObject::DefineAccessor(String* name, bool is_getter, JSFunction* fun, |
2750 PropertyAttributes attributes) { | 2758 PropertyAttributes attributes) { |
(...skipping 4880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7631 // No break point. | 7639 // No break point. |
7632 if (break_point_objects()->IsUndefined()) return 0; | 7640 if (break_point_objects()->IsUndefined()) return 0; |
7633 // Single beak point. | 7641 // Single beak point. |
7634 if (!break_point_objects()->IsFixedArray()) return 1; | 7642 if (!break_point_objects()->IsFixedArray()) return 1; |
7635 // Multiple break points. | 7643 // Multiple break points. |
7636 return FixedArray::cast(break_point_objects())->length(); | 7644 return FixedArray::cast(break_point_objects())->length(); |
7637 } | 7645 } |
7638 #endif | 7646 #endif |
7639 | 7647 |
7640 } } // namespace v8::internal | 7648 } } // namespace v8::internal |
OLD | NEW |