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/elements.cc

Issue 226153002: Callers of ElementsAccessor::Validate() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes Created 6 years, 8 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 | « src/elements.h ('k') | src/factory.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 // 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 Object* length_obj = JSArray::cast(holder)->length(); 603 Object* length_obj = JSArray::cast(holder)->length();
604 if (length_obj->IsSmi()) { 604 if (length_obj->IsSmi()) {
605 length = Smi::cast(length_obj)->value(); 605 length = Smi::cast(length_obj)->value();
606 } 606 }
607 } else { 607 } else {
608 length = fixed_array_base->length(); 608 length = fixed_array_base->length();
609 } 609 }
610 ElementsAccessorSubclass::ValidateContents(holder, length); 610 ElementsAccessorSubclass::ValidateContents(holder, length);
611 } 611 }
612 612
613 virtual void Validate(JSObject* holder) V8_FINAL V8_OVERRIDE { 613 virtual void Validate(Handle<JSObject> holder) V8_FINAL V8_OVERRIDE {
614 ElementsAccessorSubclass::ValidateImpl(holder); 614 DisallowHeapAllocation no_gc;
615 ElementsAccessorSubclass::ValidateImpl(*holder);
615 } 616 }
616 617
617 static bool HasElementImpl(Object* receiver, 618 static bool HasElementImpl(Object* receiver,
618 JSObject* holder, 619 JSObject* holder,
619 uint32_t key, 620 uint32_t key,
620 FixedArrayBase* backing_store) { 621 FixedArrayBase* backing_store) {
621 return ElementsAccessorSubclass::GetAttributesImpl( 622 return ElementsAccessorSubclass::GetAttributesImpl(
622 receiver, holder, key, backing_store) != ABSENT; 623 receiver, holder, key, backing_store) != ABSENT;
623 } 624 }
624 625
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1008 }
1008 return length_object; 1009 return length_object;
1009 } 1010 }
1010 1011
1011 // Check whether the backing store should be expanded. 1012 // Check whether the backing store should be expanded.
1012 uint32_t min = JSObject::NewElementsCapacity(old_capacity); 1013 uint32_t min = JSObject::NewElementsCapacity(old_capacity);
1013 uint32_t new_capacity = length > min ? length : min; 1014 uint32_t new_capacity = length > min ? length : min;
1014 if (!array->ShouldConvertToSlowElements(new_capacity)) { 1015 if (!array->ShouldConvertToSlowElements(new_capacity)) {
1015 FastElementsAccessorSubclass:: 1016 FastElementsAccessorSubclass::
1016 SetFastElementsCapacityAndLength(array, new_capacity, length); 1017 SetFastElementsCapacityAndLength(array, new_capacity, length);
1017 array->ValidateElements(); 1018 JSObject::ValidateElements(array);
1018 return length_object; 1019 return length_object;
1019 } 1020 }
1020 1021
1021 // Request conversion to slow elements. 1022 // Request conversion to slow elements.
1022 return isolate->factory()->undefined_value(); 1023 return isolate->factory()->undefined_value();
1023 } 1024 }
1024 1025
1025 static Handle<Object> DeleteCommon(Handle<JSObject> obj, 1026 static Handle<Object> DeleteCommon(Handle<JSObject> obj,
1026 uint32_t key, 1027 uint32_t key,
1027 JSReceiver::DeleteMode mode) { 1028 JSReceiver::DeleteMode mode) {
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 UNREACHABLE(); 2066 UNREACHABLE();
2066 break; 2067 break;
2067 } 2068 }
2068 2069
2069 array->set_elements(*elms); 2070 array->set_elements(*elms);
2070 array->set_length(Smi::FromInt(number_of_elements)); 2071 array->set_length(Smi::FromInt(number_of_elements));
2071 return array; 2072 return array;
2072 } 2073 }
2073 2074
2074 } } // namespace v8::internal 2075 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698