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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 // Private static helper functions. | 391 // Private static helper functions. |
392 | 392 |
393 Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate, | 393 Handle<TransitionArray> TransitionArray::Allocate(Isolate* isolate, |
394 int number_of_transitions, | 394 int number_of_transitions, |
395 int slack) { | 395 int slack) { |
396 Handle<FixedArray> array = isolate->factory()->NewTransitionArray( | 396 Handle<FixedArray> array = isolate->factory()->NewTransitionArray( |
397 LengthFor(number_of_transitions + slack)); | 397 LengthFor(number_of_transitions + slack)); |
398 array->set(kNextLinkIndex, isolate->heap()->undefined_value()); | |
399 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); | 398 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); |
400 array->set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); | 399 array->set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); |
401 return Handle<TransitionArray>::cast(array); | 400 return Handle<TransitionArray>::cast(array); |
402 } | 401 } |
403 | 402 |
404 | 403 |
405 // static | 404 // static |
406 void TransitionArray::ZapTransitionArray(TransitionArray* transitions) { | 405 void TransitionArray::ZapTransitionArray(TransitionArray* transitions) { |
407 // Do not zap the next link that is used by GC. | 406 // Do not zap the next link that is used by GC. |
408 STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex); | 407 STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 544 |
546 int TransitionArray::Search(PropertyKind kind, Name* name, | 545 int TransitionArray::Search(PropertyKind kind, Name* name, |
547 PropertyAttributes attributes, | 546 PropertyAttributes attributes, |
548 int* out_insertion_index) { | 547 int* out_insertion_index) { |
549 int transition = SearchName(name, out_insertion_index); | 548 int transition = SearchName(name, out_insertion_index); |
550 if (transition == kNotFound) return kNotFound; | 549 if (transition == kNotFound) return kNotFound; |
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 |