Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 676fa0f5ea743889644c2fd26411fb4e354989ec..e509e74628c7b40965c939c711ba41f48b3d6b64 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -417,6 +417,26 @@ void StubCompiler::GenerateLoadFunctionPrototype(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()); |
+ __ mov(scratch, Operand(cell)); |
+ __ ldr(scratch, |
+ FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
+ __ cmp(scratch, ip); |
+ __ b(ne, miss); |
+} |
+ |
+ |
// Generate StoreField code, value is passed in r0 register. |
// When leaving generated code after success, the receiver_reg and name_reg |
// may be clobbered. Upon branch to miss_label, the receiver and name |
@@ -466,12 +486,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); |
+ } |
} |
} |
@@ -926,26 +952,6 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
}; |
-// 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()); |
- __ mov(scratch, Operand(cell)); |
- __ ldr(scratch, |
- FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
- __ cmp(scratch, ip); |
- __ b(ne, miss); |
-} |
- |
- |
// Calls GenerateCheckPropertyCell for each global object in the prototype chain |
// from object to (but not including) holder. |
static void GenerateCheckPropertyCells(MacroAssembler* masm, |