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.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 Handle<JSFunction> target = args.target(); | 1774 Handle<JSFunction> target = args.target(); |
1775 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); | 1775 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); |
1776 Handle<Object> length = args.at<Object>(1); | 1776 Handle<Object> length = args.at<Object>(1); |
1777 DCHECK(*target == target->native_context()->array_buffer_fun() || | 1777 DCHECK(*target == target->native_context()->array_buffer_fun() || |
1778 *target == target->native_context()->shared_array_buffer_fun()); | 1778 *target == target->native_context()->shared_array_buffer_fun()); |
1779 // The ConstructStub is executed in the context of the caller, so we need | 1779 // The ConstructStub is executed in the context of the caller, so we need |
1780 // to enter the callee context first before raising an exception. | 1780 // to enter the callee context first before raising an exception. |
1781 isolate->set_context(args.target()->context()); | 1781 isolate->set_context(args.target()->context()); |
1782 Handle<Object> number_length; | 1782 Handle<Object> number_length; |
1783 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length, | 1783 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length, |
1784 Object::ToInteger(isolate, length)); | 1784 Object::ToNumber(length)); |
1785 size_t byte_length; | 1785 size_t byte_length; |
1786 if (!TryNumberToSize(isolate, *number_length, &byte_length)) { | 1786 if (!TryNumberToSize(isolate, *number_length, &byte_length)) { |
1787 THROW_NEW_ERROR_RETURN_FAILURE( | 1787 THROW_NEW_ERROR_RETURN_FAILURE( |
1788 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); | 1788 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); |
1789 } | 1789 } |
1790 Handle<Map> initial_map; | 1790 Handle<Map> initial_map; |
1791 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1791 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1792 isolate, initial_map, | 1792 isolate, initial_map, |
1793 JSFunction::GetDerivedMap(isolate, target, new_target)); | 1793 JSFunction::GetDerivedMap(isolate, target, new_target)); |
1794 Handle<JSArrayBuffer> result = Handle<JSArrayBuffer>::cast( | 1794 Handle<JSArrayBuffer> result = Handle<JSArrayBuffer>::cast( |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2502 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2503 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2503 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2504 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2504 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2505 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2505 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2506 #undef DEFINE_BUILTIN_ACCESSOR_C | 2506 #undef DEFINE_BUILTIN_ACCESSOR_C |
2507 #undef DEFINE_BUILTIN_ACCESSOR_A | 2507 #undef DEFINE_BUILTIN_ACCESSOR_A |
2508 | 2508 |
2509 | 2509 |
2510 } // namespace internal | 2510 } // namespace internal |
2511 } // namespace v8 | 2511 } // namespace v8 |
OLD | NEW |