| 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 21 matching lines...) Expand all Loading... |
| 32 #include "utils.h" | 32 #include "utils.h" |
| 33 | 33 |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 | 37 |
| 38 MaybeObject* TransitionArray::Allocate(int number_of_transitions) { | 38 MaybeObject* TransitionArray::Allocate(int number_of_transitions) { |
| 39 Heap* heap = Isolate::Current()->heap(); | 39 Heap* heap = Isolate::Current()->heap(); |
| 40 // Use FixedArray to not use DescriptorArray::cast on incomplete object. | 40 // Use FixedArray to not use DescriptorArray::cast on incomplete object. |
| 41 FixedArray* array; | 41 FixedArray* array; |
| 42 { MaybeObject* maybe_array = | 42 MaybeObject* maybe_array = |
| 43 heap->AllocateFixedArray(ToKeyIndex(number_of_transitions)); | 43 heap->AllocateFixedArray(ToKeyIndex(number_of_transitions)); |
| 44 if (!maybe_array->To(&array)) return maybe_array; | 44 if (!maybe_array->To(&array)) return maybe_array; |
| 45 } | |
| 46 | 45 |
| 47 array->set(kElementsTransitionIndex, Smi::FromInt(0)); | 46 array->set(kElementsTransitionIndex, Smi::FromInt(0)); |
| 48 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); | 47 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); |
| 49 return array; | 48 return array; |
| 50 } | 49 } |
| 51 | 50 |
| 52 | 51 |
| 53 void TransitionArray::CopyFrom(TransitionArray* origin, | 52 void TransitionArray::CopyFrom(TransitionArray* origin, |
| 54 int origin_transition, | 53 int origin_transition, |
| 55 int target_transition, | 54 int target_transition, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 for (; insertion_index < number_of_transitions; ++insertion_index) { | 120 for (; insertion_index < number_of_transitions; ++insertion_index) { |
| 122 result->CopyFrom(this, insertion_index, insertion_index + 1, witness); | 121 result->CopyFrom(this, insertion_index, insertion_index + 1, witness); |
| 123 } | 122 } |
| 124 | 123 |
| 125 return result; | 124 return result; |
| 126 } | 125 } |
| 127 | 126 |
| 128 | 127 |
| 129 } } // namespace v8::internal | 128 } } // namespace v8::internal |
| OLD | NEW |