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 #include "src/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 5604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5615 : SharedFlag::kShared; | 5615 : SharedFlag::kShared; |
5616 if (!JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer>::cast(result), | 5616 if (!JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer>::cast(result), |
5617 isolate, byte_length, true, | 5617 isolate, byte_length, true, |
5618 shared_flag)) { | 5618 shared_flag)) { |
5619 THROW_NEW_ERROR_RETURN_FAILURE( | 5619 THROW_NEW_ERROR_RETURN_FAILURE( |
5620 isolate, NewRangeError(MessageTemplate::kArrayBufferAllocationFailed)); | 5620 isolate, NewRangeError(MessageTemplate::kArrayBufferAllocationFailed)); |
5621 } | 5621 } |
5622 return *result; | 5622 return *result; |
5623 } | 5623 } |
5624 | 5624 |
| 5625 // ES6 section 24.1.4.1 get ArrayBuffer.prototype.byteLength |
| 5626 BUILTIN(ArrayBufferPrototypeGetByteLength) { |
| 5627 HandleScope scope(isolate); |
| 5628 CHECK_RECEIVER(JSArrayBuffer, array_buffer, |
| 5629 "get ArrayBuffer.prototype.byteLength"); |
| 5630 // TODO(franzih): According to the ES6 spec, we should throw a TypeError |
| 5631 // here if the JSArrayBuffer is detached. |
| 5632 return array_buffer->byte_length(); |
| 5633 } |
5625 | 5634 |
5626 // ES6 section 24.1.3.1 ArrayBuffer.isView ( arg ) | 5635 // ES6 section 24.1.3.1 ArrayBuffer.isView ( arg ) |
5627 BUILTIN(ArrayBufferIsView) { | 5636 BUILTIN(ArrayBufferIsView) { |
5628 SealHandleScope shs(isolate); | 5637 SealHandleScope shs(isolate); |
5629 DCHECK_EQ(2, args.length()); | 5638 DCHECK_EQ(2, args.length()); |
5630 Object* arg = args[1]; | 5639 Object* arg = args[1]; |
5631 return isolate->heap()->ToBoolean(arg->IsJSArrayBufferView()); | 5640 return isolate->heap()->ToBoolean(arg->IsJSArrayBufferView()); |
5632 } | 5641 } |
5633 | 5642 |
5634 | 5643 |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6706 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 6715 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
6707 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 6716 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
6708 #undef DEFINE_BUILTIN_ACCESSOR_C | 6717 #undef DEFINE_BUILTIN_ACCESSOR_C |
6709 #undef DEFINE_BUILTIN_ACCESSOR_A | 6718 #undef DEFINE_BUILTIN_ACCESSOR_A |
6710 #undef DEFINE_BUILTIN_ACCESSOR_T | 6719 #undef DEFINE_BUILTIN_ACCESSOR_T |
6711 #undef DEFINE_BUILTIN_ACCESSOR_S | 6720 #undef DEFINE_BUILTIN_ACCESSOR_S |
6712 #undef DEFINE_BUILTIN_ACCESSOR_H | 6721 #undef DEFINE_BUILTIN_ACCESSOR_H |
6713 | 6722 |
6714 } // namespace internal | 6723 } // namespace internal |
6715 } // namespace v8 | 6724 } // namespace v8 |
OLD | NEW |