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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 202063003: MIPS: Fixed spec violation of storing to length of a frozen object. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 9 months 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/mips/stub-cache-mips.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 receiver = a0; 2217 receiver = a0;
2218 } 2218 }
2219 2219
2220 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, t0, &miss); 2220 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, t0, &miss);
2221 __ bind(&miss); 2221 __ bind(&miss);
2222 StubCompiler::TailCallBuiltin( 2222 StubCompiler::TailCallBuiltin(
2223 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); 2223 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
2224 } 2224 }
2225 2225
2226 2226
2227 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
2228 // This accepts as a receiver anything JSArray::SetElementsLength accepts
2229 // (currently anything except for external arrays which means anything with
2230 // elements of FixedArray type). Value must be a number, but only smis are
2231 // accepted as the most common case.
2232 Label miss;
2233
2234 Register receiver;
2235 Register value;
2236 if (kind() == Code::KEYED_STORE_IC) {
2237 // ----------- S t a t e -------------
2238 // -- ra : return address
2239 // -- a0 : value
2240 // -- a1 : key
2241 // -- a2 : receiver
2242 // -----------------------------------
2243 __ Branch(&miss, ne, a1,
2244 Operand(masm->isolate()->factory()->length_string()));
2245 receiver = a2;
2246 value = a0;
2247 } else {
2248 ASSERT(kind() == Code::STORE_IC);
2249 // ----------- S t a t e -------------
2250 // -- ra : return address
2251 // -- a0 : value
2252 // -- a1 : receiver
2253 // -- a2 : key
2254 // -----------------------------------
2255 receiver = a1;
2256 value = a0;
2257 }
2258 Register scratch = a3;
2259
2260 // Check that the receiver isn't a smi.
2261 __ JumpIfSmi(receiver, &miss);
2262
2263 // Check that the object is a JS array.
2264 __ GetObjectType(receiver, scratch, scratch);
2265 __ Branch(&miss, ne, scratch, Operand(JS_ARRAY_TYPE));
2266
2267 // Check that elements are FixedArray.
2268 // We rely on StoreIC_ArrayLength below to deal with all types of
2269 // fast elements (including COW).
2270 __ lw(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
2271 __ GetObjectType(scratch, scratch, scratch);
2272 __ Branch(&miss, ne, scratch, Operand(FIXED_ARRAY_TYPE));
2273
2274 // Check that the array has fast properties, otherwise the length
2275 // property might have been redefined.
2276 __ lw(scratch, FieldMemOperand(receiver, JSArray::kPropertiesOffset));
2277 __ lw(scratch, FieldMemOperand(scratch, FixedArray::kMapOffset));
2278 __ LoadRoot(at, Heap::kHashTableMapRootIndex);
2279 __ Branch(&miss, eq, scratch, Operand(at));
2280
2281 // Check that value is a smi.
2282 __ JumpIfNotSmi(value, &miss);
2283
2284 // Prepare tail call to StoreIC_ArrayLength.
2285 __ Push(receiver, value);
2286
2287 ExternalReference ref =
2288 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
2289 __ TailCallExternalReference(ref, 2, 1);
2290
2291 __ bind(&miss);
2292
2293 StubCompiler::TailCallBuiltin(
2294 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
2295 }
2296
2297
2298 Register InstanceofStub::left() { return a0; } 2227 Register InstanceofStub::left() { return a0; }
2299 2228
2300 2229
2301 Register InstanceofStub::right() { return a1; } 2230 Register InstanceofStub::right() { return a1; }
2302 2231
2303 2232
2304 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2233 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2305 // The displacement is the offset of the last parameter (if any) 2234 // The displacement is the offset of the last parameter (if any)
2306 // relative to the frame pointer. 2235 // relative to the frame pointer.
2307 const int kDisplacement = 2236 const int kDisplacement =
(...skipping 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after
5747 MemOperand(fp, 6 * kPointerSize), 5676 MemOperand(fp, 6 * kPointerSize),
5748 NULL); 5677 NULL);
5749 } 5678 }
5750 5679
5751 5680
5752 #undef __ 5681 #undef __
5753 5682
5754 } } // namespace v8::internal 5683 } } // namespace v8::internal
5755 5684
5756 #endif // V8_TARGET_ARCH_MIPS 5685 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698