Revision: 16179
Author: [email protected]
Date: Tue Aug 13 10:27:58 2013
Log: Fix overwriting order of object literal properties for
MATERIALIZED_LITERALs
[email protected]
Review URL: https://codereview.chromium.org/22982005
http://code.google.com/p/v8/source/detail?r=16179
Modified:
/branches/bleeding_edge/src/ast.cc
/branches/bleeding_edge/test/mjsunit/object-literal-overwrite.js
=======================================
--- /branches/bleeding_edge/src/ast.cc Tue Aug 6 06:34:51 2013
+++ /branches/bleeding_edge/src/ast.cc Tue Aug 13 10:27:58 2013
@@ -273,7 +273,8 @@
uint32_t hash = literal->Hash();
// If the key of a computed property is in the table, do not emit
// a store for the property later.
- if (property->kind() == ObjectLiteral::Property::COMPUTED &&
+ if ((property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL
||
+ property->kind() == ObjectLiteral::Property::COMPUTED) &&
table.Lookup(literal, hash, false, allocator) != NULL) {
property->set_emit_store(false);
} else {
=======================================
--- /branches/bleeding_edge/test/mjsunit/object-literal-overwrite.js Thu
Sep 1 04:28:10 2011
+++ /branches/bleeding_edge/test/mjsunit/object-literal-overwrite.js Tue
Aug 13 10:27:58 2013
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
// Check that constants and computed properties are overwriting each other
// correctly, i.e., the last initializer for any name is stored in the
object.
@@ -49,7 +51,7 @@
var foo4 = {
bar: function(b){},
- bar: 7,
+ bar: 4,
bar: function(){return 7},
};
@@ -68,6 +70,14 @@
15: 7
}
+function foo8(i) {
+ var obj = {
+ x: {a: i},
+ x: 7
+ };
+ return obj.x;
+};
+
assertEquals(7, foo1.bar);
assertEquals(7, foo2.bar);
assertEquals(7, foo3.bar);
@@ -76,6 +86,12 @@
assertEquals(7, foo6[14.31]);
assertEquals(7, foo7[15]);
+assertEquals(7, foo8(1));
+assertEquals(7, foo8(1));
+%OptimizeFunctionOnNextCall(foo8);
+assertEquals(7, foo8(1));
+
+
// Test for the classic code generator.
function fun(x) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.