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

Unified Diff: src/api.cc

Issue 1181733002: Revert of Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api-natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0bd435b738b64bb11e3d6a586e7a2217f04fdbdf..b8812800081d1b36ea84b5871c2a80a8d870bb93 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::JSObject::SetOwnPropertyIgnoreAttributes(
+ has_pending_exception = i::Runtime::DefineObjectProperty(
self, key_obj, value_obj, NONE).is_null();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return Just(true);
@@ -3573,8 +3573,9 @@
return Just(false);
}
- has_pending_exception = i::JSObject::SetOwnElementIgnoreAttributes(
- self, index, value_obj, NONE).is_null();
+ has_pending_exception = i::Runtime::DefineObjectProperty(
+ self, isolate->factory()->Uint32ToString(index),
+ value_obj, NONE).is_null();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return Just(true);
}
@@ -3612,34 +3613,6 @@
}
-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) {
@@ -3647,9 +3620,11 @@
auto self = Utils::OpenHandle(this);
auto key_obj = Utils::OpenHandle(*key);
auto value_obj = Utils::OpenHandle(*value);
- has_pending_exception =
- DefineObjectProperty(self, key_obj, value_obj,
- static_cast<PropertyAttributes>(attribs)).is_null();
+ has_pending_exception = i::Runtime::DefineObjectProperty(
+ self,
+ key_obj,
+ value_obj,
+ static_cast<PropertyAttributes>(attribs)).is_null();
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
return Just(true);
}
@@ -3665,8 +3640,9 @@
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
has_pending_exception =
- DefineObjectProperty(self, key_obj, value_obj,
- static_cast<PropertyAttributes>(attribs)).is_null();
+ i::Runtime::DefineObjectProperty(self, key_obj, value_obj,
+ static_cast<PropertyAttributes>(attribs))
+ .is_null();
EXCEPTION_BAILOUT_CHECK_SCOPED(isolate, false);
return true;
}
« no previous file with comments | « no previous file | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698