Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/transitions.cc

Issue 1483003002: Revert of Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (t->length() <= kFirstIndex) return 0; 384 if (t->length() <= kFirstIndex) return 0;
385 return (t->length() - kFirstIndex) / kTransitionSize; 385 return (t->length() - kFirstIndex) / kTransitionSize;
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()->NewFixedArray(
395 LengthFor(number_of_transitions + slack)); 395 LengthFor(number_of_transitions + slack), TENURED);
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 void ZapTransitionArray(TransitionArray* transitions) {
404 void TransitionArray::ZapTransitionArray(TransitionArray* transitions) { 403 MemsetPointer(transitions->data_start(),
405 // Do not zap the next link that is used by GC.
406 STATIC_ASSERT(kNextLinkIndex + 1 == kPrototypeTransitionsIndex);
407 MemsetPointer(transitions->data_start() + kPrototypeTransitionsIndex,
408 transitions->GetHeap()->the_hole_value(), 404 transitions->GetHeap()->the_hole_value(),
409 transitions->length() - kPrototypeTransitionsIndex); 405 transitions->length());
410 transitions->SetNumberOfTransitions(0);
411 } 406 }
412 407
413 408
414 void TransitionArray::ReplaceTransitions(Handle<Map> map, 409 void TransitionArray::ReplaceTransitions(Handle<Map> map,
415 Object* new_transitions) { 410 Object* new_transitions) {
416 Object* raw_transitions = map->raw_transitions(); 411 Object* raw_transitions = map->raw_transitions();
417 if (IsFullTransitionArray(raw_transitions)) { 412 if (IsFullTransitionArray(raw_transitions)) {
418 TransitionArray* old_transitions = TransitionArray::cast(raw_transitions); 413 TransitionArray* old_transitions = TransitionArray::cast(raw_transitions);
419 #ifdef DEBUG 414 #ifdef DEBUG
420 CheckNewTransitionsAreConsistent(map, old_transitions, new_transitions); 415 CheckNewTransitionsAreConsistent(map, old_transitions, new_transitions);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 PropertyAttributes attributes, 540 PropertyAttributes attributes,
546 int* out_insertion_index) { 541 int* out_insertion_index) {
547 int transition = SearchName(name, out_insertion_index); 542 int transition = SearchName(name, out_insertion_index);
548 if (transition == kNotFound) { 543 if (transition == kNotFound) {
549 return kNotFound; 544 return kNotFound;
550 } 545 }
551 return SearchDetails(transition, kind, attributes, out_insertion_index); 546 return SearchDetails(transition, kind, attributes, out_insertion_index);
552 } 547 }
553 } // namespace internal 548 } // namespace internal
554 } // namespace v8 549 } // namespace v8
OLDNEW
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698