Reviewers: rossberg,

Message:
PTAL

Description:
Remove IgnoreAttributesAndSetProperty and replace uses by DefineProperty

BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -49 lines):
  M src/messages.js
  M src/runtime.h
  M src/runtime.cc
  M src/v8natives.js
  M test/cctest/test-api.cc
  D test/mjsunit/runtime-gen/ignoreattributesandsetproperty.js
  M tools/generate-runtime-tests.py


Index: test/mjsunit/runtime-gen/ignoreattributesandsetproperty.js
diff --git a/test/mjsunit/runtime-gen/ignoreattributesandsetproperty.js b/test/mjsunit/runtime-gen/ignoreattributesandsetproperty.js
deleted file mode 100644
index 0c828092a23777d5e228029b10e2ada679e6d094..0000000000000000000000000000000000000000
--- a/test/mjsunit/runtime-gen/ignoreattributesandsetproperty.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
-// Flags: --allow-natives-syntax --harmony
-var _object = new Object();
-var _name = "name";
-var _value = new Object();
-var _unchecked_value = 1;
-%IgnoreAttributesAndSetProperty(_object, _name, _value, _unchecked_value);
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 3446402ff9506037dc496589a6115aa46816806a..4b0e7507925746b38b8d88d1546b5866da72f40c 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -1205,10 +1205,9 @@ function SetUpError() {
         // Define all the expected properties directly on the error
         // object. This avoids going through getters and setters defined
         // on prototype objects.
- %IgnoreAttributesAndSetProperty(this, 'stack', UNDEFINED, DONT_ENUM);
+        %DefineProperty(this, 'stack', UNDEFINED, DONT_ENUM);
         if (!IS_UNDEFINED(m)) {
-          %IgnoreAttributesAndSetProperty(
-            this, 'message', ToString(m), DONT_ENUM);
+          %DefineProperty(this, 'message', ToString(m), DONT_ENUM);
         }
         captureStackTrace(this, f);
       } else {
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index b0af9e77e3b44ab1c12619e027f0f2b40234abd3..7a2049e3cd0198cc4ff43d58330908586afc9185 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5539,32 +5539,6 @@ RUNTIME_FUNCTION(Runtime_DebugPromiseHandleEpilogue) {
 }


-// Set an own property, even if it is READ_ONLY.  If the property does not
-// exist, it will be added with attributes NONE.
-RUNTIME_FUNCTION(Runtime_IgnoreAttributesAndSetProperty) {
-  HandleScope scope(isolate);
-  RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
-  CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-  CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
-  CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
-  // Compute attributes.
-  PropertyAttributes attributes = NONE;
-  if (args.length() == 4) {
-    CONVERT_SMI_ARG_CHECKED(unchecked_value, 3);
-    // Only attribute bits should be set.
-    RUNTIME_ASSERT(
-        (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
-    attributes = static_cast<PropertyAttributes>(unchecked_value);
-  }
-  Handle<Object> result;
-  ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
-      isolate, result,
-      JSObject::SetOwnPropertyIgnoreAttributes(
-          object, name, value, attributes));
-  return *result;
-}
-
-
 RUNTIME_FUNCTION(Runtime_DeleteProperty) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 3);
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index 255b19061bafd5365f495d66ef196b10af1a0e3c..aff6ffaeaf092ecf80b0e4cf29a6add63fc60947 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -228,7 +228,6 @@ namespace internal {
   F(SetProperty, 4, 1) \
   F(DefineOrRedefineDataProperty, 4, 1) \
   F(DefineOrRedefineAccessorProperty, 5, 1) \
-  F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \
   F(GetDataProperty, 2, 1) \
   F(SetHiddenProperty, 3, 1) \
   \
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 214fa29428948fb1a2600b8cca1c4a4b76a2f9ae..626f1e1fc9727123b12c6edaf0e6466e205cd183 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -386,24 +386,22 @@ function FromGenericPropertyDescriptor(desc) {
   var obj = new $Object();

   if (desc.hasValue()) {
-    %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
+    %DefineProperty(obj, "value", desc.getValue(), NONE);
   }
   if (desc.hasWritable()) {
- %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
+    %DefineProperty(obj, "writable", desc.isWritable(), NONE);
   }
   if (desc.hasGetter()) {
-    %IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
+    %DefineProperty(obj, "get", desc.getGet(), NONE);
   }
   if (desc.hasSetter()) {
-    %IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
+    %DefineProperty(obj, "set", desc.getSet(), NONE);
   }
   if (desc.hasEnumerable()) {
-    %IgnoreAttributesAndSetProperty(obj, "enumerable",
-                                    desc.isEnumerable(), NONE);
+    %DefineProperty(obj, "enumerable", desc.isEnumerable(), NONE);
   }
   if (desc.hasConfigurable()) {
-    %IgnoreAttributesAndSetProperty(obj, "configurable",
-                                    desc.isConfigurable(), NONE);
+    %DefineProperty(obj, "configurable", desc.isConfigurable(), NONE);
   }
   return obj;
 }
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index dccfbd05f043964569c0582cdbd481b74a90acce..d2dce9a48cf4d26e2f4e6dd0fc7aa7b1f7889e0d 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21720,7 +21720,7 @@ TEST(AccessCheckThrows) {
   CheckCorrectThrow("has_own_property(other, 'x')");
   CheckCorrectThrow("%GetProperty(other, 'x')");
   CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)");
-  CheckCorrectThrow("%IgnoreAttributesAndSetProperty(other, 'x', 'foo')");
+  CheckCorrectThrow("%DefineProperty(other, 'x', 'foo', 1)");
   CheckCorrectThrow("%DeleteProperty(other, 'x', 0)");
   CheckCorrectThrow("%DeleteProperty(other, '1', 0)");
   CheckCorrectThrow("%HasOwnProperty(other, 'x')");
Index: tools/generate-runtime-tests.py
diff --git a/tools/generate-runtime-tests.py b/tools/generate-runtime-tests.py index 4cd8270c802d35e002f25347144f3c5c3f6bc63b..226fe73acf652954aaddbdb4ad0a5c996a517e78 100755
--- a/tools/generate-runtime-tests.py
+++ b/tools/generate-runtime-tests.py
@@ -47,8 +47,8 @@ EXPAND_MACROS = [
# that the parser doesn't bit-rot. Change the values as needed when you add, # remove or change runtime functions, but make sure we don't lose our ability
 # to parse them!
-EXPECTED_FUNCTION_COUNT = 359
-EXPECTED_FUZZABLE_COUNT = 327
+EXPECTED_FUNCTION_COUNT = 358
+EXPECTED_FUZZABLE_COUNT = 326
 EXPECTED_CCTEST_COUNT = 6
 EXPECTED_UNKNOWN_COUNT = 4
 EXPECTED_BUILTINS_COUNT = 798


--
--
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