Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/builtins/mips64/builtins-mips64.cc

Issue 2550503003: MIPS: Port '[x86] Also deal with holey arrays in the Apply builtin.' (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/builtins/mips/builtins-mips.cc ('K') | « src/builtins/mips/builtins-mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/mips64/builtins-mips64.cc
diff --git a/src/builtins/mips64/builtins-mips64.cc b/src/builtins/mips64/builtins-mips64.cc
index cec12edb754a4d3d0e0cb8e482d95c822412f545..cc608e1f6781f5395d0145ba0e15a784353acaf7 100644
--- a/src/builtins/mips64/builtins-mips64.cc
+++ b/src/builtins/mips64/builtins-mips64.cc
@@ -2144,7 +2144,8 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
// Create the list of arguments from the array-like argumentsList.
{
- Label create_arguments, create_array, create_runtime, done_create;
+ Label create_arguments, create_array, create_holey_array, create_runtime,
+ done_create;
__ JumpIfSmi(arguments_list, &create_runtime);
// Load the map of argumentsList into a2.
@@ -2192,12 +2193,29 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
__ Branch(&done_create);
+ // For holey JSArrays we need to check that the array prototype chain
+ // protector is intact and our prototype is the Array.prototype actually.
+ __ bind(&create_holey_array);
+ __ ld(a2, FieldMemOperand(a2, Map::kPrototypeOffset));
+ __ ld(at, ContextMemOperand(t0, Context::INITIAL_ARRAY_PROTOTYPE_INDEX));
+ __ Branch(&create_runtime, ne, a2, Operand(at));
+ __ LoadRoot(t0, Heap::kArrayProtectorRootIndex);
+ __ lw(a2, UntagSmiFieldMemOperand(t0, PropertyCell::kValueOffset));
+ __ Branch(&create_runtime, ne, a2,
+ Operand(Smi::FromInt(Isolate::kProtectorValid)));
+ __ lw(a2, UntagSmiFieldMemOperand(a0, JSArray::kLengthOffset));
+ __ ld(a0, FieldMemOperand(a0, JSArray::kElementsOffset));
+ __ Branch(&done_create);
+
// Try to create the list from a JSArray object.
__ bind(&create_array);
__ ld(a2, FieldMemOperand(a2, Map::kBitField2Offset));
__ DecodeField<Map::ElementsKindBits>(a2);
STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
STATIC_ASSERT(FAST_ELEMENTS == 2);
+ STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
+ __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_SMI_ELEMENTS));
+ __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_ELEMENTS));
__ andi(a2, a2, uint16_t(~FAST_ELEMENTS)); // works if enum ElementsKind
// has less than 2^16 elements
__ Branch(&create_runtime, ne, a2, Operand(int64_t(0)));
@@ -2233,7 +2251,7 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
// Push arguments onto the stack (thisArgument is already on the stack).
{
- Label done, loop;
+ Label done, push, loop;
Register src = a4;
Register scratch = len;
@@ -2242,8 +2260,12 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
__ mov(a0, len); // The 'len' argument for Call() or Construct().
__ dsll(scratch, len, kPointerSizeLog2);
__ Dsubu(scratch, sp, Operand(scratch));
+ __ LoadRoot(t1, Heap::kTheHoleValueRootIndex);
__ bind(&loop);
__ ld(a5, MemOperand(src));
+ __ Branch(&push, ne, a5, Operand(t1));
+ __ LoadRoot(a5, Heap::kUndefinedValueRootIndex);
+ __ bind(&push);
__ daddiu(src, src, kPointerSize);
__ Push(a5);
__ Branch(&loop, ne, scratch, Operand(sp));
« src/builtins/mips/builtins-mips.cc ('K') | « src/builtins/mips/builtins-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698