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

Side by Side Diff: src/builtins/mips/builtins-mips.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 unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 void Builtins::Generate_Apply(MacroAssembler* masm) { 2124 void Builtins::Generate_Apply(MacroAssembler* masm) {
2125 // ----------- S t a t e ------------- 2125 // ----------- S t a t e -------------
2126 // -- a0 : argumentsList 2126 // -- a0 : argumentsList
2127 // -- a1 : target 2127 // -- a1 : target
2128 // -- a3 : new.target (checked to be constructor or undefined) 2128 // -- a3 : new.target (checked to be constructor or undefined)
2129 // -- sp[0] : thisArgument 2129 // -- sp[0] : thisArgument
2130 // ----------------------------------- 2130 // -----------------------------------
2131 2131
2132 // Create the list of arguments from the array-like argumentsList. 2132 // Create the list of arguments from the array-like argumentsList.
2133 { 2133 {
2134 Label create_arguments, create_array, create_runtime, done_create; 2134 Label create_arguments, create_array, create_holey_array, create_runtime,
2135 done_create;
2135 __ JumpIfSmi(a0, &create_runtime); 2136 __ JumpIfSmi(a0, &create_runtime);
2136 2137
2137 // Load the map of argumentsList into a2. 2138 // Load the map of argumentsList into a2.
2138 __ lw(a2, FieldMemOperand(a0, HeapObject::kMapOffset)); 2139 __ lw(a2, FieldMemOperand(a0, HeapObject::kMapOffset));
2139 2140
2140 // Load native context into t0. 2141 // Load native context into t0.
2141 __ lw(t0, NativeContextMemOperand()); 2142 __ lw(t0, NativeContextMemOperand());
2142 2143
2143 // Check if argumentsList is an (unmodified) arguments object. 2144 // Check if argumentsList is an (unmodified) arguments object.
2144 __ lw(at, ContextMemOperand(t0, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); 2145 __ lw(at, ContextMemOperand(t0, Context::SLOPPY_ARGUMENTS_MAP_INDEX));
(...skipping 22 matching lines...) Expand all
2167 // Try to create the list from an arguments object. 2168 // Try to create the list from an arguments object.
2168 __ bind(&create_arguments); 2169 __ bind(&create_arguments);
2169 __ lw(a2, FieldMemOperand(a0, JSArgumentsObject::kLengthOffset)); 2170 __ lw(a2, FieldMemOperand(a0, JSArgumentsObject::kLengthOffset));
2170 __ lw(t0, FieldMemOperand(a0, JSObject::kElementsOffset)); 2171 __ lw(t0, FieldMemOperand(a0, JSObject::kElementsOffset));
2171 __ lw(at, FieldMemOperand(t0, FixedArray::kLengthOffset)); 2172 __ lw(at, FieldMemOperand(t0, FixedArray::kLengthOffset));
2172 __ Branch(&create_runtime, ne, a2, Operand(at)); 2173 __ Branch(&create_runtime, ne, a2, Operand(at));
2173 __ SmiUntag(a2); 2174 __ SmiUntag(a2);
2174 __ mov(a0, t0); 2175 __ mov(a0, t0);
2175 __ Branch(&done_create); 2176 __ Branch(&done_create);
2176 2177
2178 // For holey JSArrays we need to check that the array prototype chain
2179 // protector is intact and our prototype is the Array.prototype actually.
2180 __ bind(&create_holey_array);
Ilija.Pavlovic1 2016/12/02 10:32:52 Missing __ lw(a2, FieldMemOperand(a0, HeapObject:
Marija Antic 2016/12/02 11:48:08 Value FieldMemOperand(a0, HeapObject::kMapOffset)
2181 __ lw(a2, FieldMemOperand(a2, Map::kPrototypeOffset));
2182 __ lw(at, ContextMemOperand(t0, Context::INITIAL_ARRAY_PROTOTYPE_INDEX));
2183 __ Branch(&create_runtime, ne, a2, Operand(at));
2184 __ LoadRoot(t0, Heap::kArrayProtectorRootIndex);
2185 __ lw(a2, FieldMemOperand(t0, PropertyCell::kValueOffset));
Ilija.Pavlovic1 2016/12/02 10:32:52 Maybe to change into __ LoadRoot(at, Heap::kArray
Marija Antic 2016/12/02 11:48:08 Done.
2186 __ Branch(&create_runtime, ne, a2,
2187 Operand(Smi::FromInt(Isolate::kProtectorValid)));
2188 __ lw(a2, FieldMemOperand(a0, JSArray::kLengthOffset));
Ilija.Pavlovic1 2016/12/02 10:32:52 Maybe to change into __ lw(t0, FieldMemOperand(a0
Marija Antic 2016/12/02 11:48:07 Length should be in a2 after we are finished (line
2189 __ lw(a0, FieldMemOperand(a0, JSArray::kElementsOffset));
2190 __ SmiUntag(a2);
2191 __ Branch(&done_create);
2192
2177 // Try to create the list from a JSArray object. 2193 // Try to create the list from a JSArray object.
2178 __ bind(&create_array); 2194 __ bind(&create_array);
2179 __ lw(a2, FieldMemOperand(a2, Map::kBitField2Offset)); 2195 __ lw(a2, FieldMemOperand(a2, Map::kBitField2Offset));
2180 __ DecodeField<Map::ElementsKindBits>(a2); 2196 __ DecodeField<Map::ElementsKindBits>(a2);
2181 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 2197 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
2182 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 2198 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
2183 STATIC_ASSERT(FAST_ELEMENTS == 2); 2199 STATIC_ASSERT(FAST_ELEMENTS == 2);
2200 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
2201 __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_SMI_ELEMENTS));
2202 __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_ELEMENTS));
2184 __ Branch(&create_runtime, hi, a2, Operand(FAST_ELEMENTS)); 2203 __ Branch(&create_runtime, hi, a2, Operand(FAST_ELEMENTS));
2185 __ Branch(&create_runtime, eq, a2, Operand(FAST_HOLEY_SMI_ELEMENTS));
2186 __ lw(a2, FieldMemOperand(a0, JSArray::kLengthOffset)); 2204 __ lw(a2, FieldMemOperand(a0, JSArray::kLengthOffset));
2187 __ lw(a0, FieldMemOperand(a0, JSArray::kElementsOffset)); 2205 __ lw(a0, FieldMemOperand(a0, JSArray::kElementsOffset));
2188 __ SmiUntag(a2); 2206 __ SmiUntag(a2);
2189 2207
2190 __ bind(&done_create); 2208 __ bind(&done_create);
2191 } 2209 }
2192 2210
2193 // Check for stack overflow. 2211 // Check for stack overflow.
2194 { 2212 {
2195 // Check the stack for overflow. We are not trying to catch interruptions 2213 // Check the stack for overflow. We are not trying to catch interruptions
(...skipping 14 matching lines...) Expand all
2210 // -- a1 : target 2228 // -- a1 : target
2211 // -- a0 : args (a FixedArray built from argumentsList) 2229 // -- a0 : args (a FixedArray built from argumentsList)
2212 // -- a2 : len (number of elements to push from args) 2230 // -- a2 : len (number of elements to push from args)
2213 // -- a3 : new.target (checked to be constructor or undefined) 2231 // -- a3 : new.target (checked to be constructor or undefined)
2214 // -- sp[0] : thisArgument 2232 // -- sp[0] : thisArgument
2215 // ----------------------------------- 2233 // -----------------------------------
2216 2234
2217 // Push arguments onto the stack (thisArgument is already on the stack). 2235 // Push arguments onto the stack (thisArgument is already on the stack).
2218 { 2236 {
2219 __ mov(t0, zero_reg); 2237 __ mov(t0, zero_reg);
2220 Label done, loop; 2238 Label done, push, loop;
2239 __ LoadRoot(t1, Heap::kTheHoleValueRootIndex);
2221 __ bind(&loop); 2240 __ bind(&loop);
2222 __ Branch(&done, eq, t0, Operand(a2)); 2241 __ Branch(&done, eq, t0, Operand(a2));
2223 __ Lsa(at, a0, t0, kPointerSizeLog2); 2242 __ Lsa(at, a0, t0, kPointerSizeLog2);
2224 __ lw(at, FieldMemOperand(at, FixedArray::kHeaderSize)); 2243 __ lw(at, FieldMemOperand(at, FixedArray::kHeaderSize));
2244 __ Branch(&push, ne, t1, Operand(at));
2245 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
2246 __ bind(&push);
2225 __ Push(at); 2247 __ Push(at);
2226 __ Addu(t0, t0, Operand(1)); 2248 __ Addu(t0, t0, Operand(1));
2227 __ Branch(&loop); 2249 __ Branch(&loop);
2228 __ bind(&done); 2250 __ bind(&done);
2229 __ Move(a0, t0); 2251 __ Move(a0, t0);
2230 } 2252 }
2231 2253
2232 // Dispatch to Call or Construct depending on whether new.target is undefined. 2254 // Dispatch to Call or Construct depending on whether new.target is undefined.
2233 { 2255 {
2234 Label construct; 2256 Label construct;
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 __ break_(0xCC); 2966 __ break_(0xCC);
2945 } 2967 }
2946 } 2968 }
2947 2969
2948 #undef __ 2970 #undef __
2949 2971
2950 } // namespace internal 2972 } // namespace internal
2951 } // namespace v8 2973 } // namespace v8
2952 2974
2953 #endif // V8_TARGET_ARCH_MIPS 2975 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698