| 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/elements.h" | 8 #include "src/elements.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ | 49 CONVERT_ARG_HANDLE_CHECKED(JS##Type, holder, 0); \ |
| 50 return holder->accessor(); \ | 50 return holder->accessor(); \ |
| 51 } | 51 } |
| 52 | 52 |
| 53 BUFFER_VIEW_GETTER(ArrayBufferView, ByteLength, byte_length) | 53 BUFFER_VIEW_GETTER(ArrayBufferView, ByteLength, byte_length) |
| 54 BUFFER_VIEW_GETTER(ArrayBufferView, ByteOffset, byte_offset) | 54 BUFFER_VIEW_GETTER(ArrayBufferView, ByteOffset, byte_offset) |
| 55 BUFFER_VIEW_GETTER(TypedArray, Length, length) | 55 BUFFER_VIEW_GETTER(TypedArray, Length, length) |
| 56 | 56 |
| 57 #undef BUFFER_VIEW_GETTER | 57 #undef BUFFER_VIEW_GETTER |
| 58 | 58 |
| 59 RUNTIME_FUNCTION(Runtime_ArrayBufferViewWasNeutered) { | |
| 60 HandleScope scope(isolate); | |
| 61 DCHECK_EQ(1, args.length()); | |
| 62 return isolate->heap()->ToBoolean(JSTypedArray::cast(args[0])->WasNeutered()); | |
| 63 } | |
| 64 | |
| 65 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) { | 59 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) { |
| 66 HandleScope scope(isolate); | 60 HandleScope scope(isolate); |
| 67 DCHECK_EQ(1, args.length()); | 61 DCHECK_EQ(1, args.length()); |
| 68 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); | 62 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); |
| 69 return *holder->GetBuffer(); | 63 return *holder->GetBuffer(); |
| 70 } | 64 } |
| 71 | 65 |
| 72 | 66 |
| 73 // Return codes for Runtime_TypedArraySetFastCases. | 67 // Return codes for Runtime_TypedArraySetFastCases. |
| 74 // Should be synchronized with typedarray.js natives. | 68 // Should be synchronized with typedarray.js natives. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); | 207 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); |
| 214 } | 208 } |
| 215 | 209 |
| 216 | 210 |
| 217 RUNTIME_FUNCTION(Runtime_IsTypedArray) { | 211 RUNTIME_FUNCTION(Runtime_IsTypedArray) { |
| 218 HandleScope scope(isolate); | 212 HandleScope scope(isolate); |
| 219 DCHECK_EQ(1, args.length()); | 213 DCHECK_EQ(1, args.length()); |
| 220 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); | 214 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); |
| 221 } | 215 } |
| 222 | 216 |
| 217 |
| 223 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { | 218 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { |
| 224 HandleScope scope(isolate); | 219 HandleScope scope(isolate); |
| 225 DCHECK_EQ(1, args.length()); | 220 DCHECK_EQ(1, args.length()); |
| 226 return isolate->heap()->ToBoolean( | 221 return isolate->heap()->ToBoolean( |
| 227 args[0]->IsJSTypedArray() && | 222 args[0]->IsJSTypedArray() && |
| 228 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); | 223 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); |
| 229 } | 224 } |
| 230 | 225 |
| 231 | 226 |
| 232 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { | 227 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 251 return isolate->heap()->false_value(); | 246 return isolate->heap()->false_value(); |
| 252 } | 247 } |
| 253 | 248 |
| 254 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); | 249 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); |
| 255 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && | 250 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && |
| 256 obj->type() == kExternalInt32Array); | 251 obj->type() == kExternalInt32Array); |
| 257 } | 252 } |
| 258 | 253 |
| 259 } // namespace internal | 254 } // namespace internal |
| 260 } // namespace v8 | 255 } // namespace v8 |
| OLD | NEW |