| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 | 23 |
| 24 RUNTIME_FUNCTION(Runtime_ArrayBufferSliceImpl) { | 24 RUNTIME_FUNCTION(Runtime_ArrayBufferSliceImpl) { |
| 25 HandleScope scope(isolate); | 25 HandleScope scope(isolate); |
| 26 DCHECK(args.length() == 4); | 26 DCHECK(args.length() == 4); |
| 27 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, source, 0); | 27 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, source, 0); |
| 28 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, target, 1); | 28 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, target, 1); |
| 29 CONVERT_NUMBER_ARG_HANDLE_CHECKED(first, 2); | 29 CONVERT_NUMBER_ARG_HANDLE_CHECKED(first, 2); |
| 30 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); | 30 CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3); |
| 31 |
| 32 if (source->was_neutered() || target->was_neutered()) { |
| 33 THROW_NEW_ERROR_RETURN_FAILURE( |
| 34 isolate, NewTypeError(MessageTemplate::kDetachedOperation, |
| 35 isolate->factory()->NewStringFromAsciiChecked( |
| 36 "ArrayBuffer.prototype.slice"))); |
| 37 } |
| 38 |
| 31 RUNTIME_ASSERT(!source.is_identical_to(target)); | 39 RUNTIME_ASSERT(!source.is_identical_to(target)); |
| 32 size_t start = 0, target_length = 0; | 40 size_t start = 0, target_length = 0; |
| 33 RUNTIME_ASSERT(TryNumberToSize(isolate, *first, &start)); | 41 RUNTIME_ASSERT(TryNumberToSize(isolate, *first, &start)); |
| 34 RUNTIME_ASSERT(TryNumberToSize(isolate, *new_length, &target_length)); | 42 RUNTIME_ASSERT(TryNumberToSize(isolate, *new_length, &target_length)); |
| 35 RUNTIME_ASSERT(NumberToSize(isolate, target->byte_length()) >= target_length); | 43 RUNTIME_ASSERT(NumberToSize(isolate, target->byte_length()) >= target_length); |
| 36 | 44 |
| 37 if (target_length == 0) return isolate->heap()->undefined_value(); | 45 if (target_length == 0) return isolate->heap()->undefined_value(); |
| 38 | 46 |
| 39 size_t source_byte_length = NumberToSize(isolate, source->byte_length()); | 47 size_t source_byte_length = NumberToSize(isolate, source->byte_length()); |
| 40 RUNTIME_ASSERT(start <= source_byte_length); | 48 RUNTIME_ASSERT(start <= source_byte_length); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 DATA_VIEW_SETTER(Uint16, uint16_t) | 635 DATA_VIEW_SETTER(Uint16, uint16_t) |
| 628 DATA_VIEW_SETTER(Int16, int16_t) | 636 DATA_VIEW_SETTER(Int16, int16_t) |
| 629 DATA_VIEW_SETTER(Uint32, uint32_t) | 637 DATA_VIEW_SETTER(Uint32, uint32_t) |
| 630 DATA_VIEW_SETTER(Int32, int32_t) | 638 DATA_VIEW_SETTER(Int32, int32_t) |
| 631 DATA_VIEW_SETTER(Float32, float) | 639 DATA_VIEW_SETTER(Float32, float) |
| 632 DATA_VIEW_SETTER(Float64, double) | 640 DATA_VIEW_SETTER(Float64, double) |
| 633 | 641 |
| 634 #undef DATA_VIEW_SETTER | 642 #undef DATA_VIEW_SETTER |
| 635 } // namespace internal | 643 } // namespace internal |
| 636 } // namespace v8 | 644 } // namespace v8 |
| OLD | NEW |