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

Side by Side Diff: src/elements.cc

Issue 23273004: Cleanup FooSpace::VerifyObject and ElementsAccessor::Validate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/spaces.cc » ('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 // 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 virtual ElementsKind kind() const { return ElementsTraits::Kind; } 574 virtual ElementsKind kind() const { return ElementsTraits::Kind; }
575 575
576 static void ValidateContents(JSObject* holder, int length) { 576 static void ValidateContents(JSObject* holder, int length) {
577 } 577 }
578 578
579 static void ValidateImpl(JSObject* holder) { 579 static void ValidateImpl(JSObject* holder) {
580 FixedArrayBase* fixed_array_base = holder->elements(); 580 FixedArrayBase* fixed_array_base = holder->elements();
581 // When objects are first allocated, its elements are Failures. 581 // When objects are first allocated, its elements are Failures.
582 if (fixed_array_base->IsFailure()) return; 582 if (fixed_array_base->IsFailure()) return;
583 if (!fixed_array_base->IsHeapObject()) return; 583 if (!fixed_array_base->IsHeapObject()) return;
584 Map* map = fixed_array_base->map();
585 // Arrays that have been shifted in place can't be verified. 584 // Arrays that have been shifted in place can't be verified.
586 Heap* heap = holder->GetHeap(); 585 if (fixed_array_base->IsFiller()) return;
587 if (map == heap->one_pointer_filler_map() ||
588 map == heap->two_pointer_filler_map() ||
589 map == heap->free_space_map()) {
590 return;
591 }
592 int length = 0; 586 int length = 0;
593 if (holder->IsJSArray()) { 587 if (holder->IsJSArray()) {
594 Object* length_obj = JSArray::cast(holder)->length(); 588 Object* length_obj = JSArray::cast(holder)->length();
595 if (length_obj->IsSmi()) { 589 if (length_obj->IsSmi()) {
596 length = Smi::cast(length_obj)->value(); 590 length = Smi::cast(length_obj)->value();
597 } 591 }
598 } else { 592 } else {
599 length = fixed_array_base->length(); 593 length = fixed_array_base->length();
600 } 594 }
601 ElementsAccessorSubclass::ValidateContents(holder, length); 595 ElementsAccessorSubclass::ValidateContents(holder, length);
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 UNREACHABLE(); 2058 UNREACHABLE();
2065 break; 2059 break;
2066 } 2060 }
2067 2061
2068 array->set_elements(elms); 2062 array->set_elements(elms);
2069 array->set_length(Smi::FromInt(number_of_elements)); 2063 array->set_length(Smi::FromInt(number_of_elements));
2070 return array; 2064 return array;
2071 } 2065 }
2072 2066
2073 } } // namespace v8::internal 2067 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698