OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 void Builtins::Generate_Apply(MacroAssembler* masm) { | 2167 void Builtins::Generate_Apply(MacroAssembler* masm) { |
2168 // ----------- S t a t e ------------- | 2168 // ----------- S t a t e ------------- |
2169 // -- r2 : argumentsList | 2169 // -- r2 : argumentsList |
2170 // -- r3 : target | 2170 // -- r3 : target |
2171 // -- r5 : new.target (checked to be constructor or undefined) | 2171 // -- r5 : new.target (checked to be constructor or undefined) |
2172 // -- sp[0] : thisArgument | 2172 // -- sp[0] : thisArgument |
2173 // ----------------------------------- | 2173 // ----------------------------------- |
2174 | 2174 |
2175 // Create the list of arguments from the array-like argumentsList. | 2175 // Create the list of arguments from the array-like argumentsList. |
2176 { | 2176 { |
2177 Label create_arguments, create_array, create_runtime, done_create; | 2177 Label create_arguments, create_array, create_holey_array, create_runtime, |
| 2178 done_create; |
2178 __ JumpIfSmi(r2, &create_runtime); | 2179 __ JumpIfSmi(r2, &create_runtime); |
2179 | 2180 |
2180 // Load the map of argumentsList into r4. | 2181 // Load the map of argumentsList into r4. |
2181 __ LoadP(r4, FieldMemOperand(r2, HeapObject::kMapOffset)); | 2182 __ LoadP(r4, FieldMemOperand(r2, HeapObject::kMapOffset)); |
2182 | 2183 |
2183 // Load native context into r6. | 2184 // Load native context into r6. |
2184 __ LoadP(r6, NativeContextMemOperand()); | 2185 __ LoadP(r6, NativeContextMemOperand()); |
2185 | 2186 |
2186 // Check if argumentsList is an (unmodified) arguments object. | 2187 // Check if argumentsList is an (unmodified) arguments object. |
2187 __ LoadP(ip, ContextMemOperand(r6, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); | 2188 __ LoadP(ip, ContextMemOperand(r6, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
(...skipping 23 matching lines...) Expand all Loading... |
2211 __ bind(&create_arguments); | 2212 __ bind(&create_arguments); |
2212 __ LoadP(r4, FieldMemOperand(r2, JSArgumentsObject::kLengthOffset)); | 2213 __ LoadP(r4, FieldMemOperand(r2, JSArgumentsObject::kLengthOffset)); |
2213 __ LoadP(r6, FieldMemOperand(r2, JSObject::kElementsOffset)); | 2214 __ LoadP(r6, FieldMemOperand(r2, JSObject::kElementsOffset)); |
2214 __ LoadP(ip, FieldMemOperand(r6, FixedArray::kLengthOffset)); | 2215 __ LoadP(ip, FieldMemOperand(r6, FixedArray::kLengthOffset)); |
2215 __ CmpP(r4, ip); | 2216 __ CmpP(r4, ip); |
2216 __ bne(&create_runtime); | 2217 __ bne(&create_runtime); |
2217 __ SmiUntag(r4); | 2218 __ SmiUntag(r4); |
2218 __ LoadRR(r2, r6); | 2219 __ LoadRR(r2, r6); |
2219 __ b(&done_create); | 2220 __ b(&done_create); |
2220 | 2221 |
| 2222 // For holey JSArrays we need to check that the array prototype chain |
| 2223 // protector is intact and our prototype is the Array.prototype actually. |
| 2224 __ bind(&create_holey_array); |
| 2225 __ LoadP(r4, FieldMemOperand(r4, Map::kPrototypeOffset)); |
| 2226 __ LoadP(r6, ContextMemOperand(r6, Context::INITIAL_ARRAY_PROTOTYPE_INDEX)); |
| 2227 __ CmpP(r4, r6); |
| 2228 __ bne(&create_runtime); |
| 2229 __ LoadRoot(r6, Heap::kArrayProtectorRootIndex); |
| 2230 __ LoadP(r4, FieldMemOperand(r6, PropertyCell::kValueOffset)); |
| 2231 __ CmpSmiLiteral(r4, Smi::FromInt(Isolate::kProtectorValid), r0); |
| 2232 __ bne(&create_runtime); |
| 2233 __ LoadP(r4, FieldMemOperand(r2, JSArray::kLengthOffset)); |
| 2234 __ LoadP(r2, FieldMemOperand(r2, JSArray::kElementsOffset)); |
| 2235 __ SmiUntag(r4); |
| 2236 __ b(&done_create); |
| 2237 |
2221 // Try to create the list from a JSArray object. | 2238 // Try to create the list from a JSArray object. |
| 2239 // -- r4 and r6 must be preserved till bne create_holey_array. |
2222 __ bind(&create_array); | 2240 __ bind(&create_array); |
2223 __ LoadlB(r4, FieldMemOperand(r4, Map::kBitField2Offset)); | 2241 __ LoadlB(r7, FieldMemOperand(r4, Map::kBitField2Offset)); |
2224 __ DecodeField<Map::ElementsKindBits>(r4); | 2242 __ DecodeField<Map::ElementsKindBits>(r7); |
2225 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | 2243 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
2226 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 2244 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
2227 STATIC_ASSERT(FAST_ELEMENTS == 2); | 2245 STATIC_ASSERT(FAST_ELEMENTS == 2); |
2228 __ CmpP(r4, Operand(FAST_ELEMENTS)); | 2246 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
| 2247 __ CmpP(r7, Operand(FAST_HOLEY_ELEMENTS)); |
2229 __ bgt(&create_runtime); | 2248 __ bgt(&create_runtime); |
2230 __ CmpP(r4, Operand(FAST_HOLEY_SMI_ELEMENTS)); | 2249 // Only FAST_XXX after this point, FAST_HOLEY_XXX are odd values. |
2231 __ beq(&create_runtime); | 2250 __ TestBit(r7, Map::kHasNonInstancePrototype, r0); |
| 2251 __ bne(&create_holey_array); |
| 2252 // FAST_SMI_ELEMENTS or FAST_ELEMENTS after this point. |
2232 __ LoadP(r4, FieldMemOperand(r2, JSArray::kLengthOffset)); | 2253 __ LoadP(r4, FieldMemOperand(r2, JSArray::kLengthOffset)); |
2233 __ LoadP(r2, FieldMemOperand(r2, JSArray::kElementsOffset)); | 2254 __ LoadP(r2, FieldMemOperand(r2, JSArray::kElementsOffset)); |
2234 __ SmiUntag(r4); | 2255 __ SmiUntag(r4); |
2235 | 2256 |
2236 __ bind(&done_create); | 2257 __ bind(&done_create); |
2237 } | 2258 } |
2238 | 2259 |
2239 // Check for stack overflow. | 2260 // Check for stack overflow. |
2240 { | 2261 { |
2241 // Check the stack for overflow. We are not trying to catch interruptions | 2262 // Check the stack for overflow. We are not trying to catch interruptions |
(...skipping 14 matching lines...) Expand all Loading... |
2256 // ----------- S t a t e ------------- | 2277 // ----------- S t a t e ------------- |
2257 // -- r3 : target | 2278 // -- r3 : target |
2258 // -- r2 : args (a FixedArray built from argumentsList) | 2279 // -- r2 : args (a FixedArray built from argumentsList) |
2259 // -- r4 : len (number of elements to push from args) | 2280 // -- r4 : len (number of elements to push from args) |
2260 // -- r5 : new.target (checked to be constructor or undefined) | 2281 // -- r5 : new.target (checked to be constructor or undefined) |
2261 // -- sp[0] : thisArgument | 2282 // -- sp[0] : thisArgument |
2262 // ----------------------------------- | 2283 // ----------------------------------- |
2263 | 2284 |
2264 // Push arguments onto the stack (thisArgument is already on the stack). | 2285 // Push arguments onto the stack (thisArgument is already on the stack). |
2265 { | 2286 { |
2266 Label loop, no_args; | 2287 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); |
| 2288 Label loop, no_args, skip; |
2267 __ CmpP(r4, Operand::Zero()); | 2289 __ CmpP(r4, Operand::Zero()); |
2268 __ beq(&no_args); | 2290 __ beq(&no_args); |
2269 __ AddP(r2, r2, | 2291 __ AddP(r2, r2, |
2270 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 2292 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
2271 __ LoadRR(r1, r4); | 2293 __ LoadRR(r1, r4); |
2272 __ bind(&loop); | 2294 __ bind(&loop); |
2273 __ LoadP(r0, MemOperand(r2, kPointerSize)); | 2295 __ LoadP(ip, MemOperand(r2, kPointerSize)); |
2274 __ la(r2, MemOperand(r2, kPointerSize)); | 2296 __ la(r2, MemOperand(r2, kPointerSize)); |
2275 __ push(r0); | 2297 __ CompareRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2298 __ bne(&skip, Label::kNear); |
| 2299 __ LoadRR(ip, r8); |
| 2300 __ bind(&skip); |
| 2301 __ push(ip); |
2276 __ BranchOnCount(r1, &loop); | 2302 __ BranchOnCount(r1, &loop); |
2277 __ bind(&no_args); | 2303 __ bind(&no_args); |
2278 __ LoadRR(r2, r4); | 2304 __ LoadRR(r2, r4); |
2279 } | 2305 } |
2280 | 2306 |
2281 // Dispatch to Call or Construct depending on whether new.target is undefined. | 2307 // Dispatch to Call or Construct depending on whether new.target is undefined. |
2282 { | 2308 { |
2283 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); | 2309 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); |
2284 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); | 2310 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); |
2285 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 2311 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 __ bkpt(0); | 2984 __ bkpt(0); |
2959 } | 2985 } |
2960 } | 2986 } |
2961 | 2987 |
2962 #undef __ | 2988 #undef __ |
2963 | 2989 |
2964 } // namespace internal | 2990 } // namespace internal |
2965 } // namespace v8 | 2991 } // namespace v8 |
2966 | 2992 |
2967 #endif // V8_TARGET_ARCH_S390 | 2993 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |