Reviewers: Yang,

Message:
PTAL

Description:
Fixed a couple of proxies-related unhandled exceptions.

BUG=chromium:506956, chromium:505907
LOG=N

Please review this at https://codereview.chromium.org/1215463012/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+17, -7 lines):
  M src/objects.cc
  M src/runtime/runtime-scopes.cc
  A + test/mjsunit/regress/regress-crbug-505907.js
  A + test/mjsunit/regress/regress-crbug-506956.js


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 24b54c0d4a3710160d5cde7b57d2bb9a732c2a86..a2220df152731341d093e11f71360f70259b02f6 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4003,7 +4003,7 @@ Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler(
     Handle<Object> error = isolate->factory()->NewTypeError(
         MessageTemplate::kProxyPropNotConfigurable, handler, name, trap);
     isolate->Throw(*error);
-    return Just(NONE);
+    return Nothing<PropertyAttributes>();
   }

   int attributes = NONE;
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 700925db622d718cd1497707de9058aa6c691337..d2d202c08d7b856fd91fe7c1a8e49602105b27b5 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -230,6 +230,8 @@ RUNTIME_FUNCTION(Runtime_DeclareLookupSlot) {
   BindingFlags binding_flags;
   Handle<Object> holder =
       context->Lookup(name, flags, &index, &attributes, &binding_flags);
+  // In case of JSProxy, an exception might have been thrown.
+ if (isolate->has_pending_exception()) return isolate->heap()->exception();

   Handle<JSObject> object;
   Handle<Object> value =
@@ -308,6 +310,8 @@ RUNTIME_FUNCTION(Runtime_InitializeLegacyConstLookupSlot) {
   BindingFlags binding_flags;
   Handle<Object> holder =
       context->Lookup(name, flags, &index, &attributes, &binding_flags);
+  // In case of JSProxy, an exception might have been thrown.
+ if (isolate->has_pending_exception()) return isolate->heap()->exception();

   if (index >= 0) {
     DCHECK(holder->IsContext());
@@ -855,6 +859,8 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {

   // If the slot was not found the result is true.
   if (holder.is_null()) {
+    // In case of JSProxy, an exception might have been thrown.
+ if (isolate->has_pending_exception()) return isolate->heap()->exception();
     return isolate->heap()->true_value();
   }

Index: test/mjsunit/regress/regress-crbug-505907.js
diff --git a/test/mjsunit/regress/regress-449070.js b/test/mjsunit/regress/regress-crbug-505907.js
similarity index 53%
copy from test/mjsunit/regress/regress-449070.js
copy to test/mjsunit/regress/regress-crbug-505907.js
index 7a0f0a838cdd25817ab6a2d8f63c1ef9fbe6e526..761261eca0f75e0ec2bcb8b63ae857cb7a3e5b68 100644
--- a/test/mjsunit/regress/regress-449070.js
+++ b/test/mjsunit/regress/regress-crbug-505907.js
@@ -1,10 +1,12 @@
 // Copyright 2015 the V8 project authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-//
-// Flags: --allow-natives-syntax
+
+// Flags: --harmony-proxies

 try {
-  %NormalizeElements(this);
+ var p = Proxy.create({ getPropertyDescriptor: function() { return [] } });
+  var o = Object.create(p);
+  with (o) { unresolved_name() }
 } catch(e) {
 }
Index: test/mjsunit/regress/regress-crbug-506956.js
diff --git a/test/mjsunit/regress/regress-449070.js b/test/mjsunit/regress/regress-crbug-506956.js
similarity index 51%
copy from test/mjsunit/regress/regress-449070.js
copy to test/mjsunit/regress/regress-crbug-506956.js
index 7a0f0a838cdd25817ab6a2d8f63c1ef9fbe6e526..5862ddb296747f4622778a82db65ae2eda1e58c1 100644
--- a/test/mjsunit/regress/regress-449070.js
+++ b/test/mjsunit/regress/regress-crbug-506956.js
@@ -1,10 +1,12 @@
 // Copyright 2015 the V8 project authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-//
-// Flags: --allow-natives-syntax
+
+// Flags: --harmony-proxies

 try {
-  %NormalizeElements(this);
+ var p = Proxy.create({ getPropertyDescriptor: function() { throw "boom"; } });
+  var o = Object.create(p);
+  with (o) { delete unresolved_name; }
 } catch(e) {
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to