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 4893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4904 if (owned.FromJust() && !target_desc.configurable()) { | 4904 if (owned.FromJust() && !target_desc.configurable()) { |
4905 isolate->Throw(*factory->NewTypeError( | 4905 isolate->Throw(*factory->NewTypeError( |
4906 MessageTemplate::kProxyDeletePropertyNonConfigurable, name)); | 4906 MessageTemplate::kProxyDeletePropertyNonConfigurable, name)); |
4907 return Nothing<bool>(); | 4907 return Nothing<bool>(); |
4908 } | 4908 } |
4909 return Just(true); | 4909 return Just(true); |
4910 } | 4910 } |
4911 | 4911 |
4912 | 4912 |
4913 // static | 4913 // static |
| 4914 MaybeHandle<JSProxy> JSProxy::New(Isolate* isolate, Handle<Object> target, |
| 4915 Handle<Object> handler) { |
| 4916 if (!target->IsJSReceiver()) { |
| 4917 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyNonObject), |
| 4918 JSProxy); |
| 4919 } |
| 4920 if (target->IsJSProxy() && JSProxy::cast(*target)->IsRevoked()) { |
| 4921 THROW_NEW_ERROR(isolate, |
| 4922 NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked), |
| 4923 JSProxy); |
| 4924 } |
| 4925 if (!handler->IsJSReceiver()) { |
| 4926 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kProxyNonObject), |
| 4927 JSProxy); |
| 4928 } |
| 4929 if (handler->IsJSProxy() && JSProxy::cast(*handler)->IsRevoked()) { |
| 4930 THROW_NEW_ERROR(isolate, |
| 4931 NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked), |
| 4932 JSProxy); |
| 4933 } |
| 4934 return isolate->factory()->NewJSProxy(Handle<JSReceiver>::cast(target), |
| 4935 Handle<JSReceiver>::cast(handler)); |
| 4936 } |
| 4937 |
| 4938 |
| 4939 // static |
4914 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { | 4940 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { |
4915 DCHECK(proxy->map()->is_constructor()); | 4941 DCHECK(proxy->map()->is_constructor()); |
4916 if (proxy->IsRevoked()) { | 4942 if (proxy->IsRevoked()) { |
4917 THROW_NEW_ERROR(proxy->GetIsolate(), | 4943 THROW_NEW_ERROR(proxy->GetIsolate(), |
4918 NewTypeError(MessageTemplate::kProxyRevoked), Context); | 4944 NewTypeError(MessageTemplate::kProxyRevoked), Context); |
4919 } | 4945 } |
4920 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); | 4946 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); |
4921 return JSReceiver::GetFunctionRealm(target); | 4947 return JSReceiver::GetFunctionRealm(target); |
4922 } | 4948 } |
4923 | 4949 |
(...skipping 14531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19455 if (cell->value() != *new_value) { | 19481 if (cell->value() != *new_value) { |
19456 cell->set_value(*new_value); | 19482 cell->set_value(*new_value); |
19457 Isolate* isolate = cell->GetIsolate(); | 19483 Isolate* isolate = cell->GetIsolate(); |
19458 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19484 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19459 isolate, DependentCode::kPropertyCellChangedGroup); | 19485 isolate, DependentCode::kPropertyCellChangedGroup); |
19460 } | 19486 } |
19461 } | 19487 } |
19462 | 19488 |
19463 } // namespace internal | 19489 } // namespace internal |
19464 } // namespace v8 | 19490 } // namespace v8 |
OLD | NEW |