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/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 918 |
919 // ES6 section 7.4.7 CreateIterResultObject ( value, done ) | 919 // ES6 section 7.4.7 CreateIterResultObject ( value, done ) |
920 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { | 920 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { |
921 HandleScope scope(isolate); | 921 HandleScope scope(isolate); |
922 DCHECK_EQ(2, args.length()); | 922 DCHECK_EQ(2, args.length()); |
923 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 923 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
924 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); | 924 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); |
925 return *isolate->factory()->NewJSIteratorResult(value, done->BooleanValue()); | 925 return *isolate->factory()->NewJSIteratorResult(value, done->BooleanValue()); |
926 } | 926 } |
927 | 927 |
| 928 RUNTIME_FUNCTION(Runtime_CreateKeyValueArray) { |
| 929 HandleScope scope(isolate); |
| 930 DCHECK_EQ(2, args.length()); |
| 931 CONVERT_ARG_HANDLE_CHECKED(Object, key, 0); |
| 932 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 933 Handle<FixedArray> elements = isolate->factory()->NewFixedArray(2); |
| 934 elements->set(0, *key); |
| 935 elements->set(1, *value); |
| 936 return *isolate->factory()->NewJSArrayWithElements(elements, FAST_ELEMENTS, |
| 937 2); |
| 938 } |
928 | 939 |
929 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { | 940 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { |
930 SealHandleScope shs(isolate); | 941 SealHandleScope shs(isolate); |
931 DCHECK_EQ(1, args.length()); | 942 DCHECK_EQ(1, args.length()); |
932 CONVERT_ARG_CHECKED(Object, object, 0); | 943 CONVERT_ARG_CHECKED(Object, object, 0); |
933 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); | 944 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); |
934 } | 945 } |
935 | 946 |
936 | 947 |
937 RUNTIME_FUNCTION(Runtime_CreateDataProperty) { | 948 RUNTIME_FUNCTION(Runtime_CreateDataProperty) { |
938 HandleScope scope(isolate); | 949 HandleScope scope(isolate); |
939 DCHECK(args.length() == 3); | 950 DCHECK(args.length() == 3); |
940 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0); | 951 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0); |
941 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 952 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
942 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 953 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
943 bool success; | 954 bool success; |
944 LookupIterator it = LookupIterator::PropertyOrElement( | 955 LookupIterator it = LookupIterator::PropertyOrElement( |
945 isolate, o, key, &success, LookupIterator::OWN); | 956 isolate, o, key, &success, LookupIterator::OWN); |
946 if (!success) return isolate->heap()->exception(); | 957 if (!success) return isolate->heap()->exception(); |
947 MAYBE_RETURN( | 958 MAYBE_RETURN( |
948 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 959 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
949 isolate->heap()->exception()); | 960 isolate->heap()->exception()); |
950 return *value; | 961 return *value; |
951 } | 962 } |
952 | 963 |
953 | 964 |
954 } // namespace internal | 965 } // namespace internal |
955 } // namespace v8 | 966 } // namespace v8 |
OLD | NEW |