OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 : isolate_(isolate), | 126 : isolate_(isolate), |
127 storage_(Handle<FixedArray>::cast( | 127 storage_(Handle<FixedArray>::cast( |
128 isolate->global_handles()->Create(*storage))), | 128 isolate->global_handles()->Create(*storage))), |
129 index_offset_(0u), | 129 index_offset_(0u), |
130 bit_field_(FastElementsField::encode(fast_elements) | | 130 bit_field_(FastElementsField::encode(fast_elements) | |
131 ExceedsLimitField::encode(false)) {} | 131 ExceedsLimitField::encode(false)) {} |
132 | 132 |
133 ~ArrayConcatVisitor() { clear_storage(); } | 133 ~ArrayConcatVisitor() { clear_storage(); } |
134 | 134 |
135 void visit(uint32_t i, Handle<Object> elm) { | 135 void visit(uint32_t i, Handle<Object> elm) { |
136 if (i > JSObject::kMaxElementCount - index_offset_) { | 136 if (i >= JSObject::kMaxElementCount - index_offset_) { |
137 set_exceeds_array_limit(true); | 137 set_exceeds_array_limit(true); |
138 return; | 138 return; |
139 } | 139 } |
140 uint32_t index = index_offset_ + i; | 140 uint32_t index = index_offset_ + i; |
141 | 141 |
142 if (fast_elements()) { | 142 if (fast_elements()) { |
143 if (index < static_cast<uint32_t>(storage_->length())) { | 143 if (index < static_cast<uint32_t>(storage_->length())) { |
144 storage_->set(index, *elm); | 144 storage_->set(index, *elm); |
145 return; | 145 return; |
146 } | 146 } |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 | 1268 |
1269 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1269 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
1270 SealHandleScope shs(isolate); | 1270 SealHandleScope shs(isolate); |
1271 DCHECK(args.length() == 2); | 1271 DCHECK(args.length() == 2); |
1272 // Returning undefined means that this fast path fails and one has to resort | 1272 // Returning undefined means that this fast path fails and one has to resort |
1273 // to a slow path. | 1273 // to a slow path. |
1274 return isolate->heap()->undefined_value(); | 1274 return isolate->heap()->undefined_value(); |
1275 } | 1275 } |
1276 } // namespace internal | 1276 } // namespace internal |
1277 } // namespace v8 | 1277 } // namespace v8 |
OLD | NEW |