OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/transitions.h" | 5 #include "src/transitions.h" |
6 | 6 |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 #include "src/transitions-inl.h" | 8 #include "src/transitions-inl.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 | 10 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 // Private static helper functions. | 389 // Private static helper functions. |
390 | 390 |
391 Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate, | 391 Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate, |
392 int number_of_transitions, | 392 int number_of_transitions, |
393 int slack) { | 393 int slack) { |
394 Handle<FixedArray> array = isolate->factory()->NewTransitionArray( | 394 Handle<FixedArray> array = isolate->factory()->NewTransitionArray( |
395 LengthFor(number_of_transitions + slack)); | 395 LengthFor(number_of_transitions + slack)); |
396 array->set(kNextLinkIndex, isolate->heap()->undefined_value()); | |
397 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); | 396 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); |
398 array->set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); | 397 array->set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); |
399 return Handle<TransitionArray>::cast(array); | 398 return Handle<TransitionArray>::cast(array); |
400 } | 399 } |
401 | 400 |
402 | 401 |
403 // static | 402 // static |
404 void TransitionArray::ZapTransitionArray(TransitionArray* transitions) { | 403 void TransitionArray::ZapTransitionArray(TransitionArray* transitions) { |
405 // Do not zap the next link that is used by GC. | 404 // Do not zap the next link that is used by GC. |
406 STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex); | 405 STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 PropertyAttributes attributes, | 544 PropertyAttributes attributes, |
546 int* out_insertion_index) { | 545 int* out_insertion_index) { |
547 int transition = SearchName(name, out_insertion_index); | 546 int transition = SearchName(name, out_insertion_index); |
548 if (transition == kNotFound) { | 547 if (transition == kNotFound) { |
549 return kNotFound; | 548 return kNotFound; |
550 } | 549 } |
551 return SearchDetails(transition, kind, attributes, out_insertion_index); | 550 return SearchDetails(transition, kind, attributes, out_insertion_index); |
552 } | 551 } |
553 } // namespace internal | 552 } // namespace internal |
554 } // namespace v8 | 553 } // namespace v8 |
OLD | NEW |