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.h" | 9 #include "src/runtime/runtime.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 | 469 |
470 | 470 |
471 RUNTIME_FUNCTION(Runtime_IsTypedArray) { | 471 RUNTIME_FUNCTION(Runtime_IsTypedArray) { |
472 HandleScope scope(isolate); | 472 HandleScope scope(isolate); |
473 DCHECK(args.length() == 1); | 473 DCHECK(args.length() == 1); |
474 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); | 474 return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray()); |
475 } | 475 } |
476 | 476 |
477 | 477 |
| 478 RUNTIME_FUNCTION(Runtime_IsSharedTypedArray) { |
| 479 HandleScope scope(isolate); |
| 480 DCHECK(args.length() == 1); |
| 481 return isolate->heap()->ToBoolean( |
| 482 args[0]->IsJSTypedArray() && |
| 483 JSTypedArray::cast(args[0])->GetBuffer()->is_shared()); |
| 484 } |
| 485 |
| 486 |
| 487 RUNTIME_FUNCTION(Runtime_IsSharedIntegerTypedArray) { |
| 488 HandleScope scope(isolate); |
| 489 DCHECK(args.length() == 1); |
| 490 if (!args[0]->IsJSTypedArray()) { |
| 491 return isolate->heap()->false_value(); |
| 492 } |
| 493 |
| 494 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); |
| 495 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && |
| 496 obj->type() != kExternalFloat32Array && |
| 497 obj->type() != kExternalFloat64Array); |
| 498 } |
| 499 |
| 500 |
478 RUNTIME_FUNCTION(Runtime_DataViewInitialize) { | 501 RUNTIME_FUNCTION(Runtime_DataViewInitialize) { |
479 HandleScope scope(isolate); | 502 HandleScope scope(isolate); |
480 DCHECK(args.length() == 4); | 503 DCHECK(args.length() == 4); |
481 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); | 504 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); |
482 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 1); | 505 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 1); |
483 CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_offset, 2); | 506 CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_offset, 2); |
484 CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_length, 3); | 507 CONVERT_NUMBER_ARG_HANDLE_CHECKED(byte_length, 3); |
485 | 508 |
486 DCHECK(holder->GetInternalFieldCount() == | 509 DCHECK(holder->GetInternalFieldCount() == |
487 v8::ArrayBufferView::kInternalFieldCount); | 510 v8::ArrayBufferView::kInternalFieldCount); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 DATA_VIEW_SETTER(Uint16, uint16_t) | 746 DATA_VIEW_SETTER(Uint16, uint16_t) |
724 DATA_VIEW_SETTER(Int16, int16_t) | 747 DATA_VIEW_SETTER(Int16, int16_t) |
725 DATA_VIEW_SETTER(Uint32, uint32_t) | 748 DATA_VIEW_SETTER(Uint32, uint32_t) |
726 DATA_VIEW_SETTER(Int32, int32_t) | 749 DATA_VIEW_SETTER(Int32, int32_t) |
727 DATA_VIEW_SETTER(Float32, float) | 750 DATA_VIEW_SETTER(Float32, float) |
728 DATA_VIEW_SETTER(Float64, double) | 751 DATA_VIEW_SETTER(Float64, double) |
729 | 752 |
730 #undef DATA_VIEW_SETTER | 753 #undef DATA_VIEW_SETTER |
731 } // namespace internal | 754 } // namespace internal |
732 } // namespace v8 | 755 } // namespace v8 |
OLD | NEW |