Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Issue 1178703011: Reland of Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where re (Closed)

Created:
5 years, 6 months ago by Toon Verwaest
Modified:
5 years, 6 months ago
Reviewers:
Igor Sheludko, Yang
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[Closed since replaced by manual reland https://codereview.chromium.org/1180943002] Reland of Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. (patchset #1 id:1 of https://codereview.chromium.org/1181733002/) Reason: Didn't break antying Original issue's description: > Revert of Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. (patchset #3 id:40001 of https://codereview.chromium.org/1178503004/) > > Reason for revert: > Blocks revert of https://codereview.chromium.org/1175973002 > > Original issue's description: > > Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. > > > > @yangguo: please look at the debugger part of the CL. > > @ishell: please look at the rest. > > > > Additionally: > > - Ensure the LookupIterator for named properties does not accidentally get indexes in. > > - Fix the return value for typed array assignments to be the incoming value. > > > > BUG=v8:4137 > > LOG=n > > > > Committed: https://crrev.com/15aa811f8fe2708a757c3b53ca89db736aa8b222 > > Cr-Commit-Position: refs/heads/master@{#28954} > > TBR=yangguo@chromium.org,verwaest@chromium.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=v8:4137 > > Committed: https://crrev.com/62d65a347f6cbd7f1553b20dda9aacab6f0690cf > Cr-Commit-Position: refs/heads/master@{#28957} TBR=yangguo@chromium.org,ishell@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:4137

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -305 lines) Patch
M src/api.cc View 5 chunks +36 lines, -12 lines 0 comments Download
M src/api-natives.cc View 1 chunk +11 lines, -19 lines 0 comments Download
M src/bootstrapper.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M src/ic/ic.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/json-parser.h View 2 chunks +2 lines, -2 lines 0 comments Download
M src/lookup.h View 3 chunks +1 line, -7 lines 0 comments Download
M src/lookup.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M src/objects.h View 3 chunks +7 lines, -4 lines 0 comments Download
M src/objects.cc View 5 chunks +6 lines, -16 lines 0 comments Download
M src/objects-inl.h View 1 chunk +14 lines, -0 lines 0 comments Download
M src/runtime/runtime.h View 1 chunk +0 lines, -4 lines 0 comments Download
M src/runtime/runtime-classes.cc View 1 chunk +2 lines, -10 lines 0 comments Download
M src/runtime/runtime-debug.cc View 17 chunks +65 lines, -101 lines 0 comments Download
M src/runtime/runtime-object.cc View 4 chunks +30 lines, -112 lines 0 comments Download
M src/scopeinfo.cc View 2 chunks +8 lines, -10 lines 0 comments Download
M test/cctest/test-debug.cc View 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 10 (5 generated)
Toon Verwaest
Created Revert of Revert of Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant.
5 years, 6 months ago (2015-06-11 20:18:39 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1178703011/1
5 years, 6 months ago (2015-06-11 20:19:45 UTC) #4
commit-bot: I haz the power
Failed to apply patch for src/api.cc: While running git apply --index -3 -p1; error: patch ...
5 years, 6 months ago (2015-06-11 20:19:58 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1178703011/1
5 years, 6 months ago (2015-06-11 20:25:12 UTC) #8
commit-bot: I haz the power
5 years, 6 months ago (2015-06-11 20:25:29 UTC) #10
Failed to apply patch for src/api.cc:
While running git apply --index -3 -p1;
  error: patch failed: src/api.cc:3535
  Falling back to three-way merge...
  Applied patch to 'src/api.cc' with conflicts.
  U src/api.cc

Patch:       src/api.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
b8812800081d1b36ea84b5871c2a80a8d870bb93..0bd435b738b64bb11e3d6a586e7a2217f04fdbdf
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3535,7 +3535,7 @@
 
   if (it.IsFound() && !it.IsConfigurable()) return Just(false);
 
-  has_pending_exception = i::Runtime::DefineObjectProperty(
+  has_pending_exception = i::JSObject::SetOwnPropertyIgnoreAttributes(
                               self, key_obj, value_obj, NONE).is_null();
   RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
   return Just(true);
@@ -3573,9 +3573,8 @@
     return Just(false);
   }
 
-  has_pending_exception = i::Runtime::DefineObjectProperty(
-                              self, isolate->factory()->Uint32ToString(index),
-                              value_obj, NONE).is_null();
+  has_pending_exception = i::JSObject::SetOwnElementIgnoreAttributes(
+                              self, index, value_obj, NONE).is_null();
   RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
   return Just(true);
 }
@@ -3613,6 +3612,34 @@
 }
 
 
+MUST_USE_RESULT
+static i::MaybeHandle<i::Object> DefineObjectProperty(
+    i::Handle<i::JSObject> js_object, i::Handle<i::Object> key,
+    i::Handle<i::Object> value, PropertyAttributes attrs) {
+  i::Isolate* isolate = js_object->GetIsolate();
+  // Check if the given key is an array index.
+  uint32_t index = 0;
+  if (key->ToArrayIndex(&index)) {
+    return i::JSObject::SetOwnElementIgnoreAttributes(js_object, index, value,
+                                                      attrs);
+  }
+
+  i::Handle<i::Name> name;
+  if (key->IsName()) {
+    name = i::Handle<i::Name>::cast(key);
+  } else {
+    // Call-back into JavaScript to convert the key to a string.
+    i::Handle<i::Object> converted;
+    ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, converted,
+                                     i::Execution::ToString(isolate, key),
+                                     i::MaybeHandle<i::Object>());
+    name = i::Handle<i::String>::cast(converted);
+  }
+
+  return i::JSObject::DefinePropertyOrElement(js_object, name, value, attrs);
+}
+
+
 Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context,
                                  v8::Local<Value> key, v8::Local<Value> value,
                                  v8::PropertyAttribute attribs) {
@@ -3620,11 +3647,9 @@
   auto self = Utils::OpenHandle(this);
   auto key_obj = Utils::OpenHandle(*key);
   auto value_obj = Utils::OpenHandle(*value);
-  has_pending_exception = i::Runtime::DefineObjectProperty(
-      self,
-      key_obj,
-      value_obj,
-      static_cast<PropertyAttributes>(attribs)).is_null();
+  has_pending_exception =
+      DefineObjectProperty(self, key_obj, value_obj,
+                           static_cast<PropertyAttributes>(attribs)).is_null();
   RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
   return Just(true);
 }
@@ -3640,9 +3665,8 @@
   i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
   i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
   has_pending_exception =
-      i::Runtime::DefineObjectProperty(self, key_obj, value_obj,
-                                      
static_cast<PropertyAttributes>(attribs))
-          .is_null();
+      DefineObjectProperty(self, key_obj, value_obj,
+                           static_cast<PropertyAttributes>(attribs)).is_null();
   EXCEPTION_BAILOUT_CHECK_SCOPED(isolate, false);
   return true;
 }

Powered by Google App Engine
This is Rietveld 408576698