Revision: 10537
Author: [email protected]
Date: Fri Jan 27 06:40:42 2012
Log: MIPS: Store transitioned JSArray maps in global context
Port r10523 (79463).
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9298011
Patch from Daniel Kalmar <[email protected]>.
http://code.google.com/p/v8/source/detail?r=10537
Modified:
/branches/bleeding_edge/src/mips/builtins-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.h
=======================================
--- /branches/bleeding_edge/src/mips/builtins-mips.cc Thu Jan 26 03:26:45
2012
+++ /branches/bleeding_edge/src/mips/builtins-mips.cc Fri Jan 27 06:40:42
2012
@@ -116,9 +116,7 @@
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 @@
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(
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri Jan 20
06:17:26 2012
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri Jan 27
06:40:42 2012
@@ -4277,6 +4277,31 @@
Move(dst, cp);
}
}
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.h Fri Jan 20
06:17:26 2012
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.h Fri Jan 27
06:40:42 2012
@@ -772,6 +772,11 @@
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
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev