Changeset 213453 in webkit
- Timestamp:
- Mar 6, 2017 9:26:35 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r213452 r213453 1 2017-03-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Allow indexed module namespace object fields 4 https://bugs.webkit.org/show_bug.cgi?id=168870 5 6 Reviewed by Saam Barati. 7 8 * wasm/spec-tests/names.wast.js: 9 1 10 2017-03-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 11 -
trunk/JSTests/wasm/spec-tests/names.wast.js
r213067 r213453 103 103 assert_return(() => $$.exports["__malloc"](), f32(6.3125)); 104 104 assert_return(() => $$.exports["~!@#$%^&*()_+`-={}|[]\x5c:\x22;'<>?,./ "](), f32(6.34375)); 105 // FIXME exporting a property with a name that's a number doesn't work https://bugs.webkit.org/show_bug.cgi?id=168857 106 //assert_return(() => $$.exports["0"](), f32(6.359375)); 105 assert_return(() => $$.exports["0"](), f32(6.359375)); 107 106 assert_return(() => $$.exports["_"](), f32(6.375)); 108 107 assert_return(() => $$.exports["$"](), f32(6.390625)); -
trunk/Source/JavaScriptCore/ChangeLog
r213452 r213453 1 2017-03-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Allow indexed module namespace object fields 4 https://bugs.webkit.org/show_bug.cgi?id=168870 5 6 Reviewed by Saam Barati. 7 8 While JS modules cannot expose any indexed bindings, 9 Wasm modules can expose them. However, module namespace 10 object currently does not support indexed properties. 11 This patch allows module namespace objects to offer 12 indexed binding accesses. 13 14 * runtime/JSModuleNamespaceObject.cpp: 15 (JSC::JSModuleNamespaceObject::getOwnPropertySlotCommon): 16 (JSC::JSModuleNamespaceObject::getOwnPropertySlot): 17 (JSC::JSModuleNamespaceObject::getOwnPropertySlotByIndex): 18 * runtime/JSModuleNamespaceObject.h: 19 1 20 2017-03-06 Yusuke Suzuki <utatane.tea@gmail.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
r212818 r213453 114 114 } 115 115 116 bool JSModuleNamespaceObject::getOwnPropertySlot (JSObject* cell,ExecState* exec, PropertyName propertyName, PropertySlot& slot)116 bool JSModuleNamespaceObject::getOwnPropertySlotCommon(ExecState* exec, PropertyName propertyName, PropertySlot& slot) 117 117 { 118 118 VM& vm = exec->vm(); … … 120 120 121 121 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-getownproperty-p 122 123 JSModuleNamespaceObject* thisObject = jsCast<JSModuleNamespaceObject*>(cell);124 122 125 123 // step 1. … … 127 125 // It may return the descriptor with writable: true, but namespace objects does not allow it in [[Set]] / [[DefineOwnProperty]] side. 128 126 if (propertyName.isSymbol()) 129 return JSObject::getOwnPropertySlot(this Object, exec, propertyName, slot);127 return JSObject::getOwnPropertySlot(this, exec, propertyName, slot); 130 128 131 129 slot.setIsTaintedByOpaqueObject(); 132 130 133 auto iterator = thisObject->m_exports.find(propertyName.uid());134 if (iterator == thisObject->m_exports.end())131 auto iterator = m_exports.find(propertyName.uid()); 132 if (iterator == m_exports.end()) 135 133 return false; 136 134 ExportEntry& exportEntry = iterator->value; … … 139 137 case PropertySlot::InternalMethodType::GetOwnProperty: 140 138 case PropertySlot::InternalMethodType::Get: { 141 JSModuleEnvironment* environment = thisObject->moduleRecordAt(exportEntry.moduleRecordOffset)->moduleEnvironment();139 JSModuleEnvironment* environment = moduleRecordAt(exportEntry.moduleRecordOffset)->moduleEnvironment(); 142 140 ScopeOffset scopeOffset; 143 141 JSValue value = getValue(environment, exportEntry.localName, scopeOffset); … … 148 146 } 149 147 150 slot.setValueModuleNamespace(this Object, DontDelete, value, environment, scopeOffset);148 slot.setValueModuleNamespace(this, DontDelete, value, environment, scopeOffset); 151 149 return true; 152 150 } … … 156 154 // [[Get]] / [[GetOwnProperty]] onto namespace object could throw an error while [[HasProperty]] just returns true here. 157 155 // https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects-hasproperty-p 158 slot.setValue(this Object, DontDelete, jsUndefined());156 slot.setValue(this, DontDelete, jsUndefined()); 159 157 return true; 160 158 } … … 166 164 RELEASE_ASSERT_NOT_REACHED(); 167 165 return false; 166 } 167 168 bool JSModuleNamespaceObject::getOwnPropertySlot(JSObject* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 169 { 170 JSModuleNamespaceObject* thisObject = jsCast<JSModuleNamespaceObject*>(cell); 171 return thisObject->getOwnPropertySlotCommon(exec, propertyName, slot); 172 } 173 174 bool JSModuleNamespaceObject::getOwnPropertySlotByIndex(JSObject* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot) 175 { 176 JSModuleNamespaceObject* thisObject = jsCast<JSModuleNamespaceObject*>(cell); 177 return thisObject->getOwnPropertySlotCommon(exec, Identifier::from(exec, propertyName), slot); 168 178 } 169 179 -
trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h
r212818 r213453 49 49 50 50 JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); 51 JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&); 51 52 JS_EXPORT_PRIVATE static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); 52 53 JS_EXPORT_PRIVATE static bool putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); … … 71 72 static void destroy(JSCell*); 72 73 static void visitChildren(JSCell*, SlotVisitor&); 74 bool getOwnPropertySlotCommon(ExecState*, PropertyName, PropertySlot&); 73 75 74 76 WriteBarrierBase<AbstractModuleRecord>& moduleRecordAt(unsigned offset)
Note: See TracChangeset
for help on using the changeset viewer.