Commit 1b9391be authored by serya@chromium.org's avatar serya@chromium.org

Fix GenerateNegativeLookup to work with non-symbols as a dictionary key.

Review URL: http://codereview.chromium.org/2928009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5071 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cb1eedd2
...@@ -176,6 +176,13 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -176,6 +176,13 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
__ cmp(entity_name, Operand(Handle<String>(name))); __ cmp(entity_name, Operand(Handle<String>(name)));
__ b(eq, miss_label); __ 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. // Restore the properties.
__ ldr(properties, __ ldr(properties,
FieldMemOperand(receiver, JSObject::kPropertiesOffset)); FieldMemOperand(receiver, JSObject::kPropertiesOffset));
......
...@@ -184,6 +184,12 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -184,6 +184,12 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
// Stop if found the property. // Stop if found the property.
__ cmp(entity_name, Handle<String>(name)); __ cmp(entity_name, Handle<String>(name));
__ j(equal, miss_label, not_taken); __ 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 { } else {
// Give up probing if still not found the undefined value. // Give up probing if still not found the undefined value.
__ j(not_equal, miss_label, not_taken); __ j(not_equal, miss_label, not_taken);
......
...@@ -164,6 +164,12 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, ...@@ -164,6 +164,12 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
// Stop if found the property. // Stop if found the property.
__ Cmp(entity_name, Handle<String>(name)); __ Cmp(entity_name, Handle<String>(name));
__ j(equal, miss_label); __ 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 { } else {
// Give up probing if still not found the undefined value. // Give up probing if still not found the undefined value.
__ j(not_equal, miss_label); __ j(not_equal, miss_label);
......
...@@ -49,3 +49,18 @@ for (var i = 1; i < 100; i++) { ...@@ -49,3 +49,18 @@ for (var i = 1; i < 100; i++) {
} }
assertEquals(i < 50 || i >= 70 ? 1 : 2, h.m()); 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());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment