[webkit-changes] cvs commit: LayoutTests/fast/js
activation-proto-expected.txt activation-proto.html
Maciej
mjs at opensource.apple.com
Fri Jan 6 00:32:20 PST 2006
mjs 06/01/06 00:32:20
Modified: . ChangeLog
kjs function.cpp function.h property_map.cpp
property_map.h
. ChangeLog
Added: fast/js activation-proto-expected.txt activation-proto.html
Log:
JavaScriptCore:
Reviewed by Eric.
- fix remaining performance regression from Getter/Setter change
http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
- Activation objects should not have __proto__ property
http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
* kjs/function.cpp:
(KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
skipping getter/setter handling and __proto__ handling, as well
as inlining needed superclass stuff.
(KJS::ActivationImp::put): Implement directly, skipping getter/setter,
__proto__, and do canPut directly in PropertyMap::put since there's no
static property table either.
* kjs/function.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::put): Allow optionally inlining canPut check.
* kjs/property_map.h:
LayoutTests:
Reviewed by Eric.
- test case for 6396: Activation objects should not have __proto__ property
http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
* fast/js/activation-proto-expected.txt: Added.
* fast/js/activation-proto.html: Added.
Revision Changes Path
1.947 +22 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.946
retrieving revision 1.947
diff -u -r1.946 -r1.947
--- ChangeLog 4 Jan 2006 21:44:23 -0000 1.946
+++ ChangeLog 6 Jan 2006 08:32:15 -0000 1.947
@@ -1,3 +1,25 @@
+2006-01-05 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Eric.
+
+ - fix remaining performance regression from Getter/Setter change
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6249
+
+ - Activation objects should not have __proto__ property
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
+
+ * kjs/function.cpp:
+ (KJS::ActivationImp::getOwnPropertySlot): Implement directly, thus
+ skipping getter/setter handling and __proto__ handling, as well
+ as inlining needed superclass stuff.
+ (KJS::ActivationImp::put): Implement directly, skipping getter/setter,
+ __proto__, and do canPut directly in PropertyMap::put since there's no
+ static property table either.
+ * kjs/function.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::put): Allow optionally inlining canPut check.
+ * kjs/property_map.h:
+
2006-01-04 Geoffrey Garen <ggaren at apple.com>
Patch by kimmo.t.kinnunen at nokia.com, reviewed by darin, tweaked by me.
1.65 +15 -1 JavaScriptCore/kjs/function.cpp
Index: function.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- function.cpp 13 Dec 2005 21:24:50 -0000 1.64
+++ function.cpp 6 Jan 2006 08:32:18 -0000 1.65
@@ -508,8 +508,13 @@
bool ActivationImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
// do this first so property map arguments property wins over the below
- if (JSObject::getOwnPropertySlot(exec, propertyName, slot))
+ // we don't call JSObject because we won't have getter/setter properties
+ // and we don't want to support __proto__
+
+ if (JSValue **location = getDirectLocation(propertyName)) {
+ slot.setValueSlot(this, location);
return true;
+ }
if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier()) {
slot.setCustom(this, getArgumentsGetter());
@@ -526,6 +531,15 @@
return JSObject::deleteProperty(exec, propertyName);
}
+void ActivationImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
+{
+ // There's no way that an activation object can have a prototype or getter/setter properties
+ assert(!_prop.hasGetterSetterProperties());
+ assert(!_proto);
+
+ _prop.put(propertyName, value, attr, (attr == None || attr == DontDelete));
+}
+
void ActivationImp::mark()
{
if (_function && !_function->marked())
1.39 +1 -0 JavaScriptCore/kjs/function.h
Index: function.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- function.h 13 Dec 2005 21:24:51 -0000 1.38
+++ function.h 6 Jan 2006 08:32:18 -0000 1.39
@@ -126,6 +126,7 @@
ActivationImp(FunctionImp *function, const List &arguments);
virtual bool getOwnPropertySlot(ExecState *exec, const Identifier &, PropertySlot&);
+ virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual const ClassInfo *classInfo() const { return &info; }
1.58 +4 -2 JavaScriptCore/kjs/property_map.cpp
Index: property_map.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- property_map.cpp 27 Dec 2005 09:24:14 -0000 1.57
+++ property_map.cpp 6 Jan 2006 08:32:18 -0000 1.58
@@ -288,7 +288,7 @@
}
#endif
-void PropertyMap::put(const Identifier &name, JSValue *value, int attributes)
+void PropertyMap::put(const Identifier &name, JSValue *value, int attributes, bool roCheck)
{
assert(!name.isNull());
assert(value != 0);
@@ -307,7 +307,7 @@
if (!_table) {
UString::Rep *key = _singleEntry.key;
if (key) {
- if (rep == key) {
+ if (rep == key && !(roCheck && (_singleEntry.attributes & ReadOnly))) {
_singleEntry.value = value;
return;
}
@@ -338,6 +338,8 @@
#endif
while (UString::Rep *key = entries[i].key) {
if (rep == key) {
+ if (roCheck && (_table->entries[i].attributes & ReadOnly))
+ return;
// Put a new value in an existing hash table entry.
entries[i].value = value;
// Attributes are intentionally not updated.
1.29 +1 -1 JavaScriptCore/kjs/property_map.h
Index: property_map.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- property_map.h 27 Dec 2005 09:24:14 -0000 1.28
+++ property_map.h 6 Jan 2006 08:32:18 -0000 1.29
@@ -75,7 +75,7 @@
void clear();
- void put(const Identifier &name, JSValue *value, int attributes);
+ void put(const Identifier &name, JSValue *value, int attributes, bool roCheck = false);
void remove(const Identifier &name);
JSValue *get(const Identifier &name) const;
JSValue *get(const Identifier &name, int &attributes) const;
1.226 +10 -0 LayoutTests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/LayoutTests/ChangeLog,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -r1.225 -r1.226
--- ChangeLog 5 Jan 2006 22:23:02 -0000 1.225
+++ ChangeLog 6 Jan 2006 08:32:19 -0000 1.226
@@ -1,3 +1,13 @@
+2006-01-05 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Eric.
+
+ - test case for 6396: Activation objects should not have __proto__ property
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6395
+
+ * fast/js/activation-proto-expected.txt: Added.
+ * fast/js/activation-proto.html: Added.
+
2006-01-06 Geoffrey Garen <ggaren at apple.com>
Layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6318
1.1 LayoutTests/fast/js/activation-proto-expected.txt
Index: activation-proto-expected.txt
===================================================================
This test checks that activation objects (the local scope for a function) don't have the special __proto__ property that lets you get and set a normal object's prototype. This is important because the impossibility of swizzling activation object prototype chains allows various optimizations.
On success, you will see a series of "PASS" messages.
PASS (function() { __proto__.testVariable = 'found'; return window.testVariable; })() is 'found'
1.1 LayoutTests/fast/js/activation-proto.html
Index: activation-proto.html
===================================================================
<html>
<head>
<style>
.pass {
font-weight: bold;
color: green;
}
.fail {
font-weight: bold;
color: red;
}
#console {
white-space: pre-wrap;
}
</style>
<script src="kde/resources/base.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function testPassed(msg)
{
document.getElementById("console").innerHTML += '<span class="pass">PASS</span> ' + msg + "<br>";
}
function testFailed(msg)
{
document.getElementById("console").innerHTML += '<span class="fail">FAIL</span> ' + msg + "</span><br>";
}
function debug(a)
{
document.getElementById("console").innerHTML += "<p>" + a + "</p>";
}
</script>
</head>
<body>
<p>This test checks that activation objects (the local scope for a
function) don't have the special __proto__ property that lets you get
and set a normal object's prototype. This is important because the
impossibility of swizzling activation object prototype chains allows
various optimizations.</p>
<p>On success, you will see a series of "PASS" messages.</p>
<div id="console">
</div>
<script>
shouldBe("(function() { __proto__.testVariable = 'found'; return window.testVariable; })()", "'found'");
</script>
</body>
</html>
More information about the webkit-changes
mailing list