Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

chakrashim: Enable new Get/Has/Set etc. Property from String #422

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

obastemur
Copy link
Contributor

Update chakrasim to enable chakra-core/ChakraCore#3875

  • Needs ChakraCore latest master. (There are other incompatibilities within CC/master, gonna send a PR to CC)
  • Critical test fails with (Intl..) when update to latest chakracore master. Needs those are fixed to test this with default build.

@@ -66,16 +66,11 @@ bool Object::Set(Handle<Value> key, Handle<Value> value) {

Maybe<bool> Object::Set(Handle<Value> key, Handle<Value> value,
PropertyAttribute attribs, bool force) {
JsPropertyIdRef idRef;

if (jsrt::GetPropertyIdFromValue((JsValueRef)*key, &idRef) != JsNoError) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this code path worked for Symbols as well as strings; do you know if that is ever used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it also tried to work for all values, and would stringify things that weren't strings or symbols.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider symbol is there. I'm not sure if we should! support other types though.

@@ -66,16 +66,11 @@ bool Object::Set(Handle<Value> key, Handle<Value> value) {

Maybe<bool> Object::Set(Handle<Value> key, Handle<Value> value,
PropertyAttribute attribs, bool force) {
JsPropertyIdRef idRef;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this idRef is used twice, is the overhead of invoking GetOrAddPropertyRecord twice (once per JsObject*Property method) smaller than the additional JSRT calls involved in fetching the id ref up front?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, not if it's literal or prop string. considering createString will create literalstring and presumably user will call set via a string variable that was also created on native land...

bool result = false;
if (JsDefineProperty(object, propertyIdRef, descriptor, &result)
if (JsObjectDefineProperty(object, prop, descriptor, &result)
Copy link
Contributor

@MSLaguana MSLaguana Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this isn't quite right; Right now this code path isn't going to be used until we fix our handling of vm.runInContext, but when it is used it is perfectly allowable for prop to be a Symbol, which would not be handled with this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, Symbol support should be in master no time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants