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

Side by Side Diff: src/elements.h

Issue 9663002: Use CopyElements for SetFastDoubleElementsCapacityAndLength (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 9 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/builtins.cc ('k') | src/elements.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // EcmaScript 5.1 semantics. 81 // EcmaScript 5.1 semantics.
82 virtual MaybeObject* SetCapacityAndLength(JSArray* array, 82 virtual MaybeObject* SetCapacityAndLength(JSArray* array,
83 int capacity, 83 int capacity,
84 int length) = 0; 84 int length) = 0;
85 85
86 // Deletes an element in an object, returning a new elements backing store. 86 // Deletes an element in an object, returning a new elements backing store.
87 virtual MaybeObject* Delete(JSObject* holder, 87 virtual MaybeObject* Delete(JSObject* holder,
88 uint32_t key, 88 uint32_t key,
89 JSReceiver::DeleteMode mode) = 0; 89 JSReceiver::DeleteMode mode) = 0;
90 90
91 // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all
92 // of elements from source after source_start to the destination array.
93 static const int kCopyToEnd = -1;
94 // If kCopyToEndAndInitializeToHole is specified as the copy_size to
95 // CopyElements, it copies all of elements from source after source_start to
96 // destination array, padding any remaining uninitialized elements in the
97 // destination array with the hole.
98 static const int kCopyToEndAndInitializeToHole = -2;
99
91 // Copy elements from one backing store to another. Typically, callers specify 100 // Copy elements from one backing store to another. Typically, callers specify
92 // the source JSObject or JSArray in source_holder. If the holder's backing 101 // the source JSObject or JSArray in source_holder. If the holder's backing
93 // store is available, it can be passed in source and source_holder is 102 // store is available, it can be passed in source and source_holder is
94 // ignored. 103 // ignored.
95 virtual MaybeObject* CopyElements(JSObject* source_holder, 104 virtual MaybeObject* CopyElements(JSObject* source_holder,
96 uint32_t source_start, 105 uint32_t source_start,
97 FixedArrayBase* destination, 106 FixedArrayBase* destination,
98 ElementsKind destination_kind, 107 ElementsKind destination_kind,
99 uint32_t destination_start, 108 uint32_t destination_start,
100 int copy_size, 109 int copy_size,
110 WriteBarrierMode mode,
101 FixedArrayBase* source = NULL) = 0; 111 FixedArrayBase* source = NULL) = 0;
102 112
103 MaybeObject* CopyElements(JSObject* from_holder, 113 MaybeObject* CopyElements(JSObject* from_holder,
104 FixedArrayBase* to, 114 FixedArrayBase* to,
105 ElementsKind to_kind, 115 ElementsKind to_kind,
116 WriteBarrierMode mode,
106 FixedArrayBase* from = NULL) { 117 FixedArrayBase* from = NULL) {
107 return CopyElements(from_holder, 0, to, to_kind, 0, -1, from); 118 return CopyElements(from_holder, 0, to, to_kind, 0,
119 kCopyToEndAndInitializeToHole, mode, from);
108 } 120 }
109 121
110 virtual MaybeObject* AddElementsToFixedArray(Object* receiver, 122 virtual MaybeObject* AddElementsToFixedArray(Object* receiver,
111 JSObject* holder, 123 JSObject* holder,
112 FixedArray* to, 124 FixedArray* to,
113 FixedArrayBase* from = NULL) = 0; 125 FixedArrayBase* from = NULL) = 0;
114 126
115 // Returns a shared ElementsAccessor for the specified ElementsKind. 127 // Returns a shared ElementsAccessor for the specified ElementsKind.
116 static ElementsAccessor* ForKind(ElementsKind elements_kind) { 128 static ElementsAccessor* ForKind(ElementsKind elements_kind) {
117 ASSERT(elements_kind < kElementsKindCount); 129 ASSERT(elements_kind < kElementsKindCount);
(...skipping 21 matching lines...) Expand all
139 uint32_t index) = 0; 151 uint32_t index) = 0;
140 152
141 private: 153 private:
142 static ElementsAccessor** elements_accessors_; 154 static ElementsAccessor** elements_accessors_;
143 const char* name_; 155 const char* name_;
144 156
145 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); 157 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor);
146 }; 158 };
147 159
148 160
149 void CopyObjectToObjectElements(AssertNoAllocation* no_gc, 161 void CopyObjectToObjectElements(FixedArray* from_obj,
150 FixedArray* from_obj,
151 ElementsKind from_kind, 162 ElementsKind from_kind,
152 uint32_t from_start, 163 uint32_t from_start,
153 FixedArray* to_obj, 164 FixedArray* to_obj,
154 ElementsKind to_kind, 165 ElementsKind to_kind,
155 uint32_t to_start, 166 uint32_t to_start,
156 int copy_size); 167 int copy_size,
168 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
157 169
158 170
159 } } // namespace v8::internal 171 } } // namespace v8::internal
160 172
161 #endif // V8_ELEMENTS_H_ 173 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698