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 4882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4893 ASSERT(value->IsJSObject()); | 4893 ASSERT(value->IsJSObject()); |
4894 | 4894 |
4895 if (has_initial_map()) { | 4895 if (has_initial_map()) { |
4896 initial_map()->set_prototype(value); | 4896 initial_map()->set_prototype(value); |
4897 } else { | 4897 } else { |
4898 // Put the value in the initial map field until an initial map is | 4898 // Put the value in the initial map field until an initial map is |
4899 // needed. At that point, a new initial map is created and the | 4899 // needed. At that point, a new initial map is created and the |
4900 // prototype is put into the initial map where it belongs. | 4900 // prototype is put into the initial map where it belongs. |
4901 set_prototype_or_initial_map(value); | 4901 set_prototype_or_initial_map(value); |
4902 } | 4902 } |
| 4903 Heap::ClearInstanceofCache(); |
4903 return value; | 4904 return value; |
4904 } | 4905 } |
4905 | 4906 |
4906 | 4907 |
4907 | 4908 |
4908 Object* JSFunction::SetPrototype(Object* value) { | 4909 Object* JSFunction::SetPrototype(Object* value) { |
4909 ASSERT(should_have_prototype()); | 4910 ASSERT(should_have_prototype()); |
4910 Object* construct_prototype = value; | 4911 Object* construct_prototype = value; |
4911 | 4912 |
4912 // If the value is not a JSObject, store the value in the map's | 4913 // If the value is not a JSObject, store the value in the map's |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5594 current_proto = current_proto->GetPrototype(); | 5595 current_proto = current_proto->GetPrototype(); |
5595 } | 5596 } |
5596 } | 5597 } |
5597 | 5598 |
5598 // Set the new prototype of the object. | 5599 // Set the new prototype of the object. |
5599 Object* new_map = real_receiver->map()->CopyDropTransitions(); | 5600 Object* new_map = real_receiver->map()->CopyDropTransitions(); |
5600 if (new_map->IsFailure()) return new_map; | 5601 if (new_map->IsFailure()) return new_map; |
5601 Map::cast(new_map)->set_prototype(value); | 5602 Map::cast(new_map)->set_prototype(value); |
5602 real_receiver->set_map(Map::cast(new_map)); | 5603 real_receiver->set_map(Map::cast(new_map)); |
5603 | 5604 |
| 5605 Heap::ClearInstanceofCache(); |
| 5606 |
5604 return value; | 5607 return value; |
5605 } | 5608 } |
5606 | 5609 |
5607 | 5610 |
5608 bool JSObject::HasElementPostInterceptor(JSObject* receiver, uint32_t index) { | 5611 bool JSObject::HasElementPostInterceptor(JSObject* receiver, uint32_t index) { |
5609 switch (GetElementsKind()) { | 5612 switch (GetElementsKind()) { |
5610 case FAST_ELEMENTS: { | 5613 case FAST_ELEMENTS: { |
5611 uint32_t length = IsJSArray() ? | 5614 uint32_t length = IsJSArray() ? |
5612 static_cast<uint32_t> | 5615 static_cast<uint32_t> |
5613 (Smi::cast(JSArray::cast(this)->length())->value()) : | 5616 (Smi::cast(JSArray::cast(this)->length())->value()) : |
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8545 if (break_point_objects()->IsUndefined()) return 0; | 8548 if (break_point_objects()->IsUndefined()) return 0; |
8546 // Single beak point. | 8549 // Single beak point. |
8547 if (!break_point_objects()->IsFixedArray()) return 1; | 8550 if (!break_point_objects()->IsFixedArray()) return 1; |
8548 // Multiple break points. | 8551 // Multiple break points. |
8549 return FixedArray::cast(break_point_objects())->length(); | 8552 return FixedArray::cast(break_point_objects())->length(); |
8550 } | 8553 } |
8551 #endif | 8554 #endif |
8552 | 8555 |
8553 | 8556 |
8554 } } // namespace v8::internal | 8557 } } // namespace v8::internal |
OLD | NEW |