OLD | NEW |
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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 6902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6913 CHECK(Object::cast(READ_FIELD(this, kLengthOffset))->ToArrayLength(&index)); | 6913 CHECK(Object::cast(READ_FIELD(this, kLengthOffset))->ToArrayLength(&index)); |
6914 return index; | 6914 return index; |
6915 } | 6915 } |
6916 | 6916 |
6917 | 6917 |
6918 void JSTypedArray::set_length(Object* value, WriteBarrierMode mode) { | 6918 void JSTypedArray::set_length(Object* value, WriteBarrierMode mode) { |
6919 WRITE_FIELD(this, kLengthOffset, value); | 6919 WRITE_FIELD(this, kLengthOffset, value); |
6920 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kLengthOffset, value, mode); | 6920 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kLengthOffset, value, mode); |
6921 } | 6921 } |
6922 | 6922 |
| 6923 // static |
| 6924 MaybeHandle<JSTypedArray> JSTypedArray::Validate(Isolate* isolate, |
| 6925 Handle<Object> receiver, |
| 6926 const char* method_name) { |
| 6927 if (V8_UNLIKELY(!receiver->IsJSTypedArray())) { |
| 6928 const MessageTemplate::Template message = MessageTemplate::kNotTypedArray; |
| 6929 THROW_NEW_ERROR(isolate, NewTypeError(message), JSTypedArray); |
| 6930 } |
| 6931 |
| 6932 // TODO(caitp): throw if array.[[ViewedArrayBuffer]] is neutered (per v8:4648) |
| 6933 return Handle<JSTypedArray>::cast(receiver); |
| 6934 } |
6923 | 6935 |
6924 #ifdef VERIFY_HEAP | 6936 #ifdef VERIFY_HEAP |
6925 ACCESSORS(JSTypedArray, raw_length, Object, kLengthOffset) | 6937 ACCESSORS(JSTypedArray, raw_length, Object, kLengthOffset) |
6926 #endif | 6938 #endif |
6927 | 6939 |
6928 ACCESSORS(JSPromiseCapability, promise, Object, kPromiseOffset) | 6940 ACCESSORS(JSPromiseCapability, promise, Object, kPromiseOffset) |
6929 ACCESSORS(JSPromiseCapability, resolve, Object, kResolveOffset) | 6941 ACCESSORS(JSPromiseCapability, resolve, Object, kResolveOffset) |
6930 ACCESSORS(JSPromiseCapability, reject, Object, kRejectOffset) | 6942 ACCESSORS(JSPromiseCapability, reject, Object, kRejectOffset) |
6931 | 6943 |
6932 SMI_ACCESSORS(JSPromise, status, kStatusOffset) | 6944 SMI_ACCESSORS(JSPromise, status, kStatusOffset) |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8255 #undef WRITE_INT64_FIELD | 8267 #undef WRITE_INT64_FIELD |
8256 #undef READ_BYTE_FIELD | 8268 #undef READ_BYTE_FIELD |
8257 #undef WRITE_BYTE_FIELD | 8269 #undef WRITE_BYTE_FIELD |
8258 #undef NOBARRIER_READ_BYTE_FIELD | 8270 #undef NOBARRIER_READ_BYTE_FIELD |
8259 #undef NOBARRIER_WRITE_BYTE_FIELD | 8271 #undef NOBARRIER_WRITE_BYTE_FIELD |
8260 | 8272 |
8261 } // namespace internal | 8273 } // namespace internal |
8262 } // namespace v8 | 8274 } // namespace v8 |
8263 | 8275 |
8264 #endif // V8_OBJECTS_INL_H_ | 8276 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |