Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index fcc06fada7fa2886125a5db80bdb1d1d5cfee12a..f70d5238f95f825f4c0cf9eaceaf6c3410386404 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -726,6 +726,29 @@ void BaseStoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, |
} |
+// Generate code to check that a global property cell is empty. Create |
+// the property cell at compilation time if no cell exists for the |
+// property. |
+static void GenerateCheckPropertyCell(MacroAssembler* masm, |
+ Handle<GlobalObject> global, |
+ Handle<Name> name, |
+ Register scratch, |
+ Label* miss) { |
+ Handle<JSGlobalPropertyCell> cell = |
+ GlobalObject::EnsurePropertyCell(global, name); |
+ ASSERT(cell->value()->IsTheHole()); |
+ Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); |
+ if (Serializer::enabled()) { |
+ __ mov(scratch, Immediate(cell)); |
+ __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), |
+ Immediate(the_hole)); |
+ } else { |
+ __ cmp(Operand::Cell(cell), Immediate(the_hole)); |
+ } |
+ __ j(not_equal, miss); |
+} |
+ |
+ |
// Both name_reg and receiver_reg are preserved on jumps to miss_label, |
// but may be destroyed if store is successful. |
void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
@@ -771,12 +794,18 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
// If no property was found, and the holder (the last object in the |
// prototype chain) is in slow mode, we need to do a negative lookup on the |
// holder. |
- if (lookup->holder() == *object && |
- !holder->HasFastProperties() && |
- !holder->IsJSGlobalProxy() && |
- !holder->IsJSGlobalObject()) { |
- GenerateDictionaryNegativeLookup( |
- masm, miss_restore_name, holder_reg, name, scratch1, scratch2); |
+ if (lookup->holder() == *object) { |
+ if (holder->IsJSGlobalObject()) { |
+ GenerateCheckPropertyCell( |
+ masm, |
+ Handle<GlobalObject>(GlobalObject::cast(holder)), |
+ name, |
+ scratch1, |
+ miss_restore_name); |
+ } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { |
+ GenerateDictionaryNegativeLookup( |
+ masm, miss_restore_name, holder_reg, name, scratch1, scratch2); |
+ } |
} |
} |
@@ -864,29 +893,6 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
} |
-// Generate code to check that a global property cell is empty. Create |
-// the property cell at compilation time if no cell exists for the |
-// property. |
-static void GenerateCheckPropertyCell(MacroAssembler* masm, |
- Handle<GlobalObject> global, |
- Handle<Name> name, |
- Register scratch, |
- Label* miss) { |
- Handle<JSGlobalPropertyCell> cell = |
- GlobalObject::EnsurePropertyCell(global, name); |
- ASSERT(cell->value()->IsTheHole()); |
- Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); |
- if (Serializer::enabled()) { |
- __ mov(scratch, Immediate(cell)); |
- __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), |
- Immediate(the_hole)); |
- } else { |
- __ cmp(Operand::Cell(cell), Immediate(the_hole)); |
- } |
- __ j(not_equal, miss); |
-} |
- |
- |
// Calls GenerateCheckPropertyCell for each global object in the prototype chain |
// from object to (but not including) holder. |
static void GenerateCheckPropertyCells(MacroAssembler* masm, |