Revision: 5071
Author: [email protected]
Date: Wed Jul 14 23:17:45 2010
Log: Fix GenerateNegativeLookup to work with non-symbols as a dictionary
key.
Review URL: http://codereview.chromium.org/2928009
http://code.google.com/p/v8/source/detail?r=5071
Modified:
/branches/bleeding_edge/src/arm/stub-cache-arm.cc
/branches/bleeding_edge/src/ia32/stub-cache-ia32.cc
/branches/bleeding_edge/src/x64/stub-cache-x64.cc
/branches/bleeding_edge/test/mjsunit/call-stub.js
=======================================
--- /branches/bleeding_edge/src/arm/stub-cache-arm.cc Tue Jul 13 03:02:11
2010
+++ /branches/bleeding_edge/src/arm/stub-cache-arm.cc Wed Jul 14 23:17:45
2010
@@ -176,6 +176,13 @@
__ cmp(entity_name, Operand(Handle<String>(name)));
__ b(eq, miss_label);
+ // Check if the entry name is not a symbol.
+ __ ldr(entity_name, FieldMemOperand(entity_name,
HeapObject::kMapOffset));
+ __ ldrb(entity_name,
+ FieldMemOperand(entity_name, Map::kInstanceTypeOffset));
+ __ tst(entity_name, Operand(kIsSymbolMask));
+ __ b(eq, miss_label);
+
// Restore the properties.
__ ldr(properties,
FieldMemOperand(receiver, JSObject::kPropertiesOffset));
=======================================
--- /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Tue Jul 13 03:02:11
2010
+++ /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Wed Jul 14 23:17:45
2010
@@ -184,6 +184,12 @@
// Stop if found the property.
__ cmp(entity_name, Handle<String>(name));
__ j(equal, miss_label, not_taken);
+
+ // Check if the entry name is not a symbol.
+ __ mov(entity_name, FieldOperand(entity_name,
HeapObject::kMapOffset));
+ __ test_b(FieldOperand(entity_name, Map::kInstanceTypeOffset),
+ kIsSymbolMask);
+ __ j(zero, miss_label, not_taken);
} else {
// Give up probing if still not found the undefined value.
__ j(not_equal, miss_label, not_taken);
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Tue Jul 13 03:02:11
2010
+++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Wed Jul 14 23:17:45
2010
@@ -164,6 +164,12 @@
// Stop if found the property.
__ Cmp(entity_name, Handle<String>(name));
__ j(equal, miss_label);
+
+ // Check if the entry name is not a symbol.
+ __ movq(entity_name, FieldOperand(entity_name,
HeapObject::kMapOffset));
+ __ testb(FieldOperand(entity_name, Map::kInstanceTypeOffset),
+ Immediate(kIsSymbolMask));
+ __ j(zero, miss_label);
} else {
// Give up probing if still not found the undefined value.
__ j(not_equal, miss_label);
=======================================
--- /branches/bleeding_edge/test/mjsunit/call-stub.js Fri Jul 2 07:15:04
2010
+++ /branches/bleeding_edge/test/mjsunit/call-stub.js Wed Jul 14 23:17:45
2010
@@ -49,3 +49,18 @@
}
assertEquals(i < 50 || i >= 70 ? 1 : 2, h.m());
}
+
+
+var nonsymbol = 'wwwww '.split(' ')[0];
+Hash.prototype.wwwww = Hash.prototype.m;
+
+for (var i = 1; i < 100; i++) {
+ if (i == 50) {
+ h[nonsymbol] = function() {
+ return 2;
+ };
+ } else if (i == 70) {
+ delete h[nonsymbol];
+ }
+ assertEquals(i < 50 || i >= 70 ? 1 : 2, h.wwwww());
+}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev