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

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

Issue 196653015: Fixed spec violation of storing to length of a frozen object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/stub-cache-a64.cc ('k') | src/arm/stub-cache-arm.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 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 receiver = r0; 2113 receiver = r0;
2114 } 2114 }
2115 2115
2116 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r3, r4, &miss); 2116 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r3, r4, &miss);
2117 __ bind(&miss); 2117 __ bind(&miss);
2118 StubCompiler::TailCallBuiltin( 2118 StubCompiler::TailCallBuiltin(
2119 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); 2119 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
2120 } 2120 }
2121 2121
2122 2122
2123 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
2124 // This accepts as a receiver anything JSArray::SetElementsLength accepts
2125 // (currently anything except for external arrays which means anything with
2126 // elements of FixedArray type). Value must be a number, but only smis are
2127 // accepted as the most common case.
2128 Label miss;
2129
2130 Register receiver;
2131 Register value;
2132 if (kind() == Code::KEYED_STORE_IC) {
2133 // ----------- S t a t e -------------
2134 // -- lr : return address
2135 // -- r0 : value
2136 // -- r1 : key
2137 // -- r2 : receiver
2138 // -----------------------------------
2139 __ cmp(r1, Operand(masm->isolate()->factory()->length_string()));
2140 __ b(ne, &miss);
2141 receiver = r2;
2142 value = r0;
2143 } else {
2144 ASSERT(kind() == Code::STORE_IC);
2145 // ----------- S t a t e -------------
2146 // -- lr : return address
2147 // -- r0 : value
2148 // -- r1 : receiver
2149 // -- r2 : key
2150 // -----------------------------------
2151 receiver = r1;
2152 value = r0;
2153 }
2154 Register scratch = r3;
2155
2156 // Check that the receiver isn't a smi.
2157 __ JumpIfSmi(receiver, &miss);
2158
2159 // Check that the object is a JS array.
2160 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE);
2161 __ b(ne, &miss);
2162
2163 // Check that elements are FixedArray.
2164 // We rely on StoreIC_ArrayLength below to deal with all types of
2165 // fast elements (including COW).
2166 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset));
2167 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE);
2168 __ b(ne, &miss);
2169
2170 // Check that the array has fast properties, otherwise the length
2171 // property might have been redefined.
2172 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kPropertiesOffset));
2173 __ ldr(scratch, FieldMemOperand(scratch, FixedArray::kMapOffset));
2174 __ CompareRoot(scratch, Heap::kHashTableMapRootIndex);
2175 __ b(eq, &miss);
2176
2177 // Check that value is a smi.
2178 __ JumpIfNotSmi(value, &miss);
2179
2180 // Prepare tail call to StoreIC_ArrayLength.
2181 __ Push(receiver, value);
2182
2183 ExternalReference ref =
2184 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
2185 __ TailCallExternalReference(ref, 2, 1);
2186
2187 __ bind(&miss);
2188
2189 StubCompiler::TailCallBuiltin(
2190 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
2191 }
2192
2193
2194 Register InstanceofStub::left() { return r0; } 2123 Register InstanceofStub::left() { return r0; }
2195 2124
2196 2125
2197 Register InstanceofStub::right() { return r1; } 2126 Register InstanceofStub::right() { return r1; }
2198 2127
2199 2128
2200 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2129 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2201 // The displacement is the offset of the last parameter (if any) 2130 // The displacement is the offset of the last parameter (if any)
2202 // relative to the frame pointer. 2131 // relative to the frame pointer.
2203 const int kDisplacement = 2132 const int kDisplacement =
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after
5568 MemOperand(fp, 6 * kPointerSize), 5497 MemOperand(fp, 6 * kPointerSize),
5569 NULL); 5498 NULL);
5570 } 5499 }
5571 5500
5572 5501
5573 #undef __ 5502 #undef __
5574 5503
5575 } } // namespace v8::internal 5504 } } // namespace v8::internal
5576 5505
5577 #endif // V8_TARGET_ARCH_ARM 5506 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/a64/stub-cache-a64.cc ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698