MIPS: Store transitioned JSArray maps in global context
Port r10523 (79463). BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/9298011 Patch from Daniel Kalmar <kalmard@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10537 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
7bc6526e64
commit
1c254fb59c
@ -116,9 +116,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
|
||||
Label* gc_required) {
|
||||
const int initial_capacity = JSArray::kPreallocatedArrayElements;
|
||||
STATIC_ASSERT(initial_capacity >= 0);
|
||||
// Load the initial map from the array function.
|
||||
__ lw(scratch1, FieldMemOperand(array_function,
|
||||
JSFunction::kPrototypeOrInitialMapOffset));
|
||||
__ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, scratch1);
|
||||
|
||||
// Allocate the JSArray object together with space for a fixed array with the
|
||||
// requested elements.
|
||||
@ -214,9 +212,8 @@ static void AllocateJSArray(MacroAssembler* masm,
|
||||
bool fill_with_hole,
|
||||
Label* gc_required) {
|
||||
// Load the initial map from the array function.
|
||||
__ lw(elements_array_storage,
|
||||
FieldMemOperand(array_function,
|
||||
JSFunction::kPrototypeOrInitialMapOffset));
|
||||
__ LoadGlobalInitialConstructedArrayMap(array_function, scratch2,
|
||||
elements_array_storage);
|
||||
|
||||
if (FLAG_debug_code) { // Assert that array size is not zero.
|
||||
__ Assert(
|
||||
|
@ -4279,6 +4279,31 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadGlobalInitialConstructedArrayMap(
|
||||
Register function_in, Register scratch, Register map_out) {
|
||||
ASSERT(!function_in.is(map_out));
|
||||
Label done;
|
||||
lw(map_out, FieldMemOperand(function_in,
|
||||
JSFunction::kPrototypeOrInitialMapOffset));
|
||||
if (!FLAG_smi_only_arrays) {
|
||||
// Load the global or builtins object from the current context.
|
||||
lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
||||
lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
|
||||
|
||||
// Check that the function's map is same as the cached map.
|
||||
lw(at, MemOperand(
|
||||
scratch, Context::SlotOffset(Context::SMI_JS_ARRAY_MAP_INDEX)));
|
||||
Branch(&done, ne, map_out, Operand(at));
|
||||
|
||||
// Use the cached transitioned map.
|
||||
lw(map_out,
|
||||
MemOperand(scratch,
|
||||
Context::SlotOffset(Context::OBJECT_JS_ARRAY_MAP_INDEX)));
|
||||
}
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadGlobalFunction(int index, Register function) {
|
||||
// Load the global or builtins object from the current context.
|
||||
lw(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
||||
|
@ -772,6 +772,11 @@ class MacroAssembler: public Assembler {
|
||||
|
||||
void LoadContext(Register dst, int context_chain_length);
|
||||
|
||||
// Load the initial map for new Arrays of a given type.
|
||||
void LoadGlobalInitialConstructedArrayMap(Register function_in,
|
||||
Register scratch,
|
||||
Register map_out);
|
||||
|
||||
void LoadGlobalFunction(int index, Register function);
|
||||
|
||||
// Load the initial map from the global function. The registers
|
||||
|
Loading…
Reference in New Issue
Block a user