[[DefineOwnProperty]] should always return true/false (or throw an exception), never...
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 Oct 2011 13:29:37 +0000 (13:29 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 19 Oct 2011 13:29:37 +0000 (13:29 +0000)
Note that this is not an observable behavior, but following the principle of
least surprise, we should follow the spec. Additional (extremely tiny) bonus:
Some ICs see fewer values => better code.
Review URL: http://codereview.chromium.org/8352004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9706 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/v8natives.js

index ec5407d..bb317dc 100644 (file)
@@ -704,7 +704,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
     if (should_throw) {
       throw MakeTypeError("define_disallowed", [p]);
     } else {
-      return;
+      return false;
     }
   }
 
@@ -734,7 +734,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
         if (should_throw) {
           throw MakeTypeError("redefine_disallowed", [p]);
         } else {
-          return;
+          return false;
         }
       }
       // Step 8
@@ -744,7 +744,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
           if (should_throw) {
             throw MakeTypeError("redefine_disallowed", [p]);
           } else {
-            return;
+            return false;
           }
         }
         // Step 10a
@@ -753,7 +753,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
             if (should_throw) {
               throw MakeTypeError("redefine_disallowed", [p]);
             } else {
-              return;
+              return false;
             }
           }
           if (!current.isWritable() && desc.hasValue() &&
@@ -761,7 +761,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
             if (should_throw) {
               throw MakeTypeError("redefine_disallowed", [p]);
             } else {
-              return;
+              return false;
             }
           }
         }
@@ -771,14 +771,14 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
             if (should_throw) {
               throw MakeTypeError("redefine_disallowed", [p]);
             } else {
-              return;
+              return false;
             }
           }
           if (desc.hasGetter() && !SameValue(desc.getGet(),current.getGet())) {
             if (should_throw) {
               throw MakeTypeError("redefine_disallowed", [p]);
             } else {
-              return;
+              return false;
             }
           }
         }
@@ -881,7 +881,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) {
       if (should_throw) {
         throw MakeTypeError("define_disallowed", [p]);
       } else {
-        return;
+        return false;
       }
     }
     if (index >= length) {