Commit 06869e75 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Always check global property cells for readonliness before storing. Add...

MIPS: Always check global property cells for readonliness before storing. Add check when the global object is the last in the chain.

Port r14173 (97683cb2)

BUG=

Review URL: https://codereview.chromium.org/13887004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14194 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 64f34cb7
...@@ -410,6 +410,25 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, ...@@ -410,6 +410,25 @@ 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());
__ li(scratch, Operand(cell));
__ lw(scratch,
FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
__ Branch(miss, ne, scratch, Operand(at));
}
// Generate StoreField code, value is passed in a0 register. // Generate StoreField code, value is passed in a0 register.
// After executing generated code, the receiver_reg and name_reg // After executing generated code, the receiver_reg and name_reg
// may be clobbered. // may be clobbered.
...@@ -458,14 +477,20 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, ...@@ -458,14 +477,20 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
// If no property was found, and the holder (the last object in the // 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 // prototype chain) is in slow mode, we need to do a negative lookup on the
// holder. // holder.
if (lookup->holder() == *object && if (lookup->holder() == *object) {
!holder->HasFastProperties() && if (holder->IsJSGlobalObject()) {
!holder->IsJSGlobalProxy() && GenerateCheckPropertyCell(
!holder->IsJSGlobalObject()) { masm,
Handle<GlobalObject>(GlobalObject::cast(holder)),
name,
scratch1,
miss_restore_name);
} else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
GenerateDictionaryNegativeLookup( GenerateDictionaryNegativeLookup(
masm, miss_restore_name, holder_reg, name, scratch1, scratch2); masm, miss_restore_name, holder_reg, name, scratch1, scratch2);
} }
} }
}
// Stub never generated for non-global objects that require access // Stub never generated for non-global objects that require access
// checks. // checks.
...@@ -926,26 +951,6 @@ class CallInterceptorCompiler BASE_EMBEDDED { ...@@ -926,26 +951,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());
__ li(scratch, Operand(cell));
__ lw(scratch,
FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
__ Branch(miss, ne, scratch, Operand(at));
}
// Calls GenerateCheckPropertyCell for each global object in the prototype chain // Calls GenerateCheckPropertyCell for each global object in the prototype chain
// from object to (but not including) holder. // from object to (but not including) holder.
static void GenerateCheckPropertyCells(MacroAssembler* masm, static void GenerateCheckPropertyCells(MacroAssembler* masm,
......
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