OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 9666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9677 | 9677 |
9678 | 9678 |
9679 void Map::ZapPrototypeTransitions() { | 9679 void Map::ZapPrototypeTransitions() { |
9680 FixedArray* proto_transitions = GetPrototypeTransitions(); | 9680 FixedArray* proto_transitions = GetPrototypeTransitions(); |
9681 MemsetPointer(proto_transitions->data_start(), | 9681 MemsetPointer(proto_transitions->data_start(), |
9682 GetHeap()->the_hole_value(), | 9682 GetHeap()->the_hole_value(), |
9683 proto_transitions->length()); | 9683 proto_transitions->length()); |
9684 } | 9684 } |
9685 | 9685 |
9686 | 9686 |
9687 Handle<DependentCodes> DependentCodes::Append(Handle<DependentCodes> codes, | |
9688 Handle<Code> value) { | |
9689 int append_index = codes->number_of_codes(); | |
9690 if (append_index > 0 && codes->code_at(append_index - 1) == *value) { | |
9691 // Do not append the code if it is already in the array. | |
9692 // It is sufficient to just check only the last element because | |
9693 // we process embedded maps of an optimized code in one batch. | |
9694 return codes; | |
9695 } | |
9696 if (codes->length() < kCodesOffset + append_index + 1) { | |
9697 Factory* factory = codes->GetIsolate()->factory(); | |
9698 int capacity = kCodesOffset + append_index + 1; | |
9699 if (capacity > 5) capacity = capacity * 5 / 4; | |
9700 Handle<DependentCodes> new_codes = | |
9701 Handle<DependentCodes>::cast(factory->NewFixedArray(capacity)); | |
9702 // The number of codes can change after GC. | |
9703 append_index = codes->number_of_codes(); | |
9704 new_codes->set_number_of_codes(append_index + 1); | |
9705 for (int i = 0; i < append_index; i++) { | |
9706 new_codes->set_code_at(i, codes->code_at(i)); | |
9707 codes->clear_code_at(i); | |
9708 } | |
Michael Starzinger
2013/01/21 10:31:48
This resizing is already implemented in Factory::C
ulan
2013/01/21 13:11:57
Done.
| |
9709 new_codes->set_code_at(append_index, *value); | |
9710 for (int i = append_index + 1; kCodesOffset + i < capacity; i++) { | |
9711 new_codes->clear_code_at(i); | |
9712 } | |
9713 return new_codes; | |
9714 } | |
9715 codes->set_code_at(append_index, *value); | |
9716 codes->set_number_of_codes(append_index + 1); | |
9717 return codes; | |
9718 } | |
9719 | |
9720 | |
9687 MaybeObject* JSReceiver::SetPrototype(Object* value, | 9721 MaybeObject* JSReceiver::SetPrototype(Object* value, |
9688 bool skip_hidden_prototypes) { | 9722 bool skip_hidden_prototypes) { |
9689 #ifdef DEBUG | 9723 #ifdef DEBUG |
9690 int size = Size(); | 9724 int size = Size(); |
9691 #endif | 9725 #endif |
9692 | 9726 |
9693 Heap* heap = GetHeap(); | 9727 Heap* heap = GetHeap(); |
9694 // Silently ignore the change if value is not a JSObject or null. | 9728 // Silently ignore the change if value is not a JSObject or null. |
9695 // SpiderMonkey behaves this way. | 9729 // SpiderMonkey behaves this way. |
9696 if (!value->IsJSReceiver() && !value->IsNull()) return value; | 9730 if (!value->IsJSReceiver() && !value->IsNull()) return value; |
(...skipping 4330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14027 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14061 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14028 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14062 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14029 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14063 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14030 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14064 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14031 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14065 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14032 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14066 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14033 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14067 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14034 } | 14068 } |
14035 | 14069 |
14036 } } // namespace v8::internal | 14070 } } // namespace v8::internal |
OLD | NEW |