| 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 |
| 59 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) { | 65 RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) { |
| 60 HandleScope scope(isolate); | 66 HandleScope scope(isolate); |
| 61 DCHECK_EQ(1, args.length()); | 67 DCHECK_EQ(1, args.length()); |
| 62 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); | 68 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); |
| 63 return *holder->GetBuffer(); | 69 return *holder->GetBuffer(); |
| 64 } | 70 } |
| 65 | 71 |
| 66 | 72 |
| 67 // Return codes for Runtime_TypedArraySetFastCases. | 73 // Return codes for Runtime_TypedArraySetFastCases. |
| 68 // Should be synchronized with typedarray.js natives. | 74 // Should be synchronized with typedarray.js natives. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); | 213 return Smi::FromInt(FLAG_typed_array_max_size_in_heap); |
| 208 } | 214 } |
| 209 | 215 |
| 210 | 216 |
| 211 RUNTIME_FUNCTION(Runtime_IsTypedArray) { | 217 RUNTIME_FUNCTION(Runtime_IsTypedArray) { |
| 212 HandleScope scope(isolate); | 218 HandleScope scope(isolate); |
| 213 DCHECK_EQ(1, args.length()); | 219 DCHECK_EQ(1, args.length()); |
| 214 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); | 220 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); |
| 215 } | 221 } |
| 216 | 222 |
| 217 | |
| 218 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { | 223 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { |
| 219 HandleScope scope(isolate); | 224 HandleScope scope(isolate); |
| 220 DCHECK_EQ(1, args.length()); | 225 DCHECK_EQ(1, args.length()); |
| 221 return isolate->heap()->ToBoolean( | 226 return isolate->heap()->ToBoolean( |
| 222 args[0]->IsJSTypedArray() && | 227 args[0]->IsJSTypedArray() && |
| 223 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); | 228 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); |
| 224 } | 229 } |
| 225 | 230 |
| 226 | 231 |
| 227 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { | 232 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 246 return isolate->heap()->false_value(); | 251 return isolate->heap()->false_value(); |
| 247 } | 252 } |
| 248 | 253 |
| 249 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); | 254 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); |
| 250 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && | 255 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && |
| 251 obj->type() == kExternalInt32Array); | 256 obj->type() == kExternalInt32Array); |
| 252 } | 257 } |
| 253 | 258 |
| 254 } // namespace internal | 259 } // namespace internal |
| 255 } // namespace v8 | 260 } // namespace v8 |
| OLD | NEW |