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

Side by Side Diff: src/elements.cc

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/deoptimizer.cc ('k') | src/factory.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 // 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/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 if (new_length <= static_cast<uint32_t>(receiver->elements()->length()) && 1963 if (new_length <= static_cast<uint32_t>(receiver->elements()->length()) &&
1964 IsFastSmiOrObjectElementsKind(kind)) { 1964 IsFastSmiOrObjectElementsKind(kind)) {
1965 HandleScope scope(isolate); 1965 HandleScope scope(isolate);
1966 JSObject::EnsureWritableFastElements(receiver); 1966 JSObject::EnsureWritableFastElements(receiver);
1967 } 1967 }
1968 1968
1969 Handle<FixedArrayBase> backing_store(receiver->elements(), isolate); 1969 Handle<FixedArrayBase> backing_store(receiver->elements(), isolate);
1970 1970
1971 if (new_length == 0) { 1971 if (new_length == 0) {
1972 receiver->set_elements(heap->empty_fixed_array()); 1972 receiver->set_elements(heap->empty_fixed_array());
1973 receiver->set_length(Smi::kZero); 1973 receiver->set_length(Smi::FromInt(0));
1974 return isolate->factory()->NewJSArrayWithElements( 1974 return isolate->factory()->NewJSArrayWithElements(
1975 backing_store, KindTraits::Kind, delete_count); 1975 backing_store, KindTraits::Kind, delete_count);
1976 } 1976 }
1977 1977
1978 // Construct the result array which holds the deleted elements. 1978 // Construct the result array which holds the deleted elements.
1979 Handle<JSArray> deleted_elements = isolate->factory()->NewJSArray( 1979 Handle<JSArray> deleted_elements = isolate->factory()->NewJSArray(
1980 KindTraits::Kind, delete_count, delete_count); 1980 KindTraits::Kind, delete_count, delete_count);
1981 if (delete_count > 0) { 1981 if (delete_count > 0) {
1982 DisallowHeapAllocation no_gc; 1982 DisallowHeapAllocation no_gc;
1983 Subclass::CopyElementsImpl(*backing_store, start, 1983 Subclass::CopyElementsImpl(*backing_store, start,
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 insertion_index += len; 3735 insertion_index += len;
3736 } 3736 }
3737 3737
3738 DCHECK_EQ(insertion_index, result_len); 3738 DCHECK_EQ(insertion_index, result_len);
3739 return result_array; 3739 return result_array;
3740 } 3740 }
3741 3741
3742 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3742 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3743 } // namespace internal 3743 } // namespace internal
3744 } // namespace v8 3744 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698