Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 65b1524b981933a6a829a4fe084918bddd0e16ff..be85da80d823925dd70182152db2d5b8ac655a76 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -747,12 +747,24 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it, |
} |
+#define STACK_CHECK(result_value) \ |
+ do { \ |
+ StackLimitCheck stack_check(isolate); \ |
+ if (stack_check.HasOverflowed()) { \ |
+ isolate->Throw(*isolate->factory()->NewRangeError( \ |
+ MessageTemplate::kStackOverflow)); \ |
+ return result_value; \ |
+ } \ |
+ } while (false) |
+ |
+ |
// static |
MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, |
Handle<JSProxy> proxy, |
Handle<Name> name, |
Handle<Object> receiver, |
LanguageMode language_mode) { |
+ STACK_CHECK(MaybeHandle<Object>()); |
Handle<Name> trap_name = isolate->factory()->get_string(); |
// 1. Assert: IsPropertyKey(P) is true. |
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
@@ -964,6 +976,8 @@ MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) { |
Isolate* isolate = proxy->GetIsolate(); |
Handle<String> trap_name = isolate->factory()->getPrototypeOf_string(); |
+ STACK_CHECK(MaybeHandle<Object>()); |
+ |
// 1. Let handler be the value of the [[ProxyHandler]] internal slot. |
// 2. If handler is null, throw a TypeError exception. |
// 3. Assert: Type(handler) is Object. |
@@ -4624,6 +4638,7 @@ void JSProxy::Revoke(Handle<JSProxy> proxy) { |
Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy, |
Handle<Name> name) { |
+ STACK_CHECK(Nothing<bool>()); |
// 1. (Assert) |
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
Handle<Object> handler(proxy->handler(), isolate); |
@@ -4691,6 +4706,7 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name, |
Handle<Object> value, Handle<Object> receiver, |
LanguageMode language_mode) { |
Isolate* isolate = proxy->GetIsolate(); |
+ STACK_CHECK(Nothing<bool>()); |
Factory* factory = isolate->factory(); |
Handle<String> trap_name = factory->set_string(); |
ShouldThrow should_throw = |
@@ -4760,6 +4776,7 @@ Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy, |
ShouldThrow should_throw = |
is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR; |
Isolate* isolate = proxy->GetIsolate(); |
+ STACK_CHECK(Nothing<bool>()); |
Factory* factory = isolate->factory(); |
Handle<String> trap_name = factory->deleteProperty_string(); |
@@ -6798,6 +6815,7 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, |
Handle<Object> key, |
PropertyDescriptor* desc, |
ShouldThrow should_throw) { |
+ STACK_CHECK(Nothing<bool>()); |
Handle<String> trap_name = isolate->factory()->defineProperty_string(); |
// 1. Assert: IsPropertyKey(P) is true. |
DCHECK(key->IsName() || key->IsNumber()); |
@@ -6976,6 +6994,7 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate, |
Handle<JSProxy> proxy, |
Handle<Name> name, |
PropertyDescriptor* desc) { |
+ STACK_CHECK(Nothing<bool>()); |
Handle<String> trap_name = |
isolate->factory()->getOwnPropertyDescriptor_string(); |
// 1. (Assert) |
@@ -7331,6 +7350,7 @@ Maybe<bool> JSReceiver::PreventExtensions(Handle<JSReceiver> object, |
Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy, |
ShouldThrow should_throw) { |
Isolate* isolate = proxy->GetIsolate(); |
+ STACK_CHECK(Nothing<bool>()); |
Factory* factory = isolate->factory(); |
Handle<String> trap_name = factory->preventExtensions_string(); |
@@ -7440,6 +7460,7 @@ Maybe<bool> JSReceiver::IsExtensible(Handle<JSReceiver> object) { |
Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) { |
Isolate* isolate = proxy->GetIsolate(); |
+ STACK_CHECK(Nothing<bool>()); |
Factory* factory = isolate->factory(); |
Handle<String> trap_name = factory->isExtensible_string(); |
@@ -8391,6 +8412,7 @@ static Maybe<bool> GetKeys_Internal(Isolate* isolate, |
Maybe<bool> JSProxy::Enumerate(Isolate* isolate, Handle<JSReceiver> receiver, |
Handle<JSProxy> proxy, |
KeyAccumulator* accumulator) { |
+ STACK_CHECK(Nothing<bool>()); |
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
Handle<Object> handler(proxy->handler(), isolate); |
// 2. If handler is null, throw a TypeError exception. |
@@ -8498,6 +8520,7 @@ Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate, |
Handle<JSProxy> proxy, |
PropertyFilter filter, |
KeyAccumulator* accumulator) { |
+ STACK_CHECK(Nothing<bool>()); |
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
Handle<Object> handler(proxy->handler(), isolate); |
// 2. If handler is null, throw a TypeError exception. |
@@ -15134,6 +15157,7 @@ Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value, |
bool from_javascript, |
ShouldThrow should_throw) { |
Isolate* isolate = proxy->GetIsolate(); |
+ STACK_CHECK(Nothing<bool>()); |
Handle<Name> trap_name = isolate->factory()->setPrototypeOf_string(); |
// 1. Assert: Either Type(V) is Object or Type(V) is Null. |
DCHECK(value->IsJSReceiver() || value->IsNull()); |