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