OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 8030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8041 | 8041 |
8042 // static | 8042 // static |
8043 MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver, | 8043 MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver, |
8044 ToPrimitiveHint hint) { | 8044 ToPrimitiveHint hint) { |
8045 Isolate* const isolate = receiver->GetIsolate(); | 8045 Isolate* const isolate = receiver->GetIsolate(); |
8046 Handle<Object> exotic_to_prim; | 8046 Handle<Object> exotic_to_prim; |
8047 ASSIGN_RETURN_ON_EXCEPTION( | 8047 ASSIGN_RETURN_ON_EXCEPTION( |
8048 isolate, exotic_to_prim, | 8048 isolate, exotic_to_prim, |
8049 GetMethod(receiver, isolate->factory()->to_primitive_symbol()), Object); | 8049 GetMethod(receiver, isolate->factory()->to_primitive_symbol()), Object); |
8050 if (!exotic_to_prim->IsUndefined(isolate)) { | 8050 if (!exotic_to_prim->IsUndefined(isolate)) { |
8051 Handle<Object> hint_string; | 8051 Handle<Object> hint_string = |
8052 switch (hint) { | 8052 isolate->factory()->ToPrimitiveHintString(hint); |
8053 case ToPrimitiveHint::kDefault: | |
8054 hint_string = isolate->factory()->default_string(); | |
8055 break; | |
8056 case ToPrimitiveHint::kNumber: | |
8057 hint_string = isolate->factory()->number_string(); | |
8058 break; | |
8059 case ToPrimitiveHint::kString: | |
8060 hint_string = isolate->factory()->string_string(); | |
8061 break; | |
8062 } | |
8063 Handle<Object> result; | 8053 Handle<Object> result; |
8064 ASSIGN_RETURN_ON_EXCEPTION( | 8054 ASSIGN_RETURN_ON_EXCEPTION( |
8065 isolate, result, | 8055 isolate, result, |
8066 Execution::Call(isolate, exotic_to_prim, receiver, 1, &hint_string), | 8056 Execution::Call(isolate, exotic_to_prim, receiver, 1, &hint_string), |
8067 Object); | 8057 Object); |
8068 if (result->IsPrimitive()) return result; | 8058 if (result->IsPrimitive()) return result; |
8069 THROW_NEW_ERROR(isolate, | 8059 THROW_NEW_ERROR(isolate, |
8070 NewTypeError(MessageTemplate::kCannotConvertToPrimitive), | 8060 NewTypeError(MessageTemplate::kCannotConvertToPrimitive), |
8071 Object); | 8061 Object); |
8072 } | 8062 } |
(...skipping 10861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18934 | 18924 |
18935 Object* data_obj = | 18925 Object* data_obj = |
18936 constructor->shared()->get_api_func_data()->access_check_info(); | 18926 constructor->shared()->get_api_func_data()->access_check_info(); |
18937 if (data_obj->IsUndefined(isolate)) return nullptr; | 18927 if (data_obj->IsUndefined(isolate)) return nullptr; |
18938 | 18928 |
18939 return AccessCheckInfo::cast(data_obj); | 18929 return AccessCheckInfo::cast(data_obj); |
18940 } | 18930 } |
18941 | 18931 |
18942 } // namespace internal | 18932 } // namespace internal |
18943 } // namespace v8 | 18933 } // namespace v8 |
OLD | NEW |