| 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/messages.h" | 8 #include "src/messages.h" |
| 9 #include "src/runtime/runtime-utils.h" | 9 #include "src/runtime/runtime-utils.h" |
| 10 | 10 |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 JSObject::NormalizeElements(array); | 1216 JSObject::NormalizeElements(array); |
| 1217 return *array; | 1217 return *array; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 | 1220 |
| 1221 // GrowArrayElements returns a sentinel Smi if the object was normalized. | 1221 // GrowArrayElements returns a sentinel Smi if the object was normalized. |
| 1222 RUNTIME_FUNCTION(Runtime_GrowArrayElements) { | 1222 RUNTIME_FUNCTION(Runtime_GrowArrayElements) { |
| 1223 HandleScope scope(isolate); | 1223 HandleScope scope(isolate); |
| 1224 DCHECK(args.length() == 3); | 1224 DCHECK(args.length() == 3); |
| 1225 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 1225 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 1226 CONVERT_SMI_ARG_CHECKED(key, 1); | 1226 CONVERT_NUMBER_CHECKED(int, key, Int32, args[1]); |
| 1227 | 1227 |
| 1228 if (key < 0) { | 1228 if (key < 0) { |
| 1229 return object->elements(); | 1229 return object->elements(); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); | 1232 uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); |
| 1233 uint32_t index = static_cast<uint32_t>(key); | 1233 uint32_t index = static_cast<uint32_t>(key); |
| 1234 | 1234 |
| 1235 if (index >= capacity) { | 1235 if (index >= capacity) { |
| 1236 if (object->WouldConvertToSlowElements(index)) { | 1236 if (object->WouldConvertToSlowElements(index)) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 | 1392 |
| 1393 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1393 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
| 1394 SealHandleScope shs(isolate); | 1394 SealHandleScope shs(isolate); |
| 1395 DCHECK(args.length() == 2); | 1395 DCHECK(args.length() == 2); |
| 1396 // Returning undefined means that this fast path fails and one has to resort | 1396 // Returning undefined means that this fast path fails and one has to resort |
| 1397 // to a slow path. | 1397 // to a slow path. |
| 1398 return isolate->heap()->undefined_value(); | 1398 return isolate->heap()->undefined_value(); |
| 1399 } | 1399 } |
| 1400 } | 1400 } |
| 1401 } // namespace v8::internal | 1401 } // namespace v8::internal |
| OLD | NEW |