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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 597006: Fix error introduced in version 3820 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 | « no previous file | src/ia32/stub-cache-ia32.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Check that the object is a JS array. 182 // Check that the object is a JS array.
183 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE); 183 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE);
184 __ b(ne, miss_label); 184 __ b(ne, miss_label);
185 185
186 // Load length directly from the JS array. 186 // Load length directly from the JS array.
187 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 187 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset));
188 __ Ret(); 188 __ Ret();
189 } 189 }
190 190
191 191
192 // Generate code to check if an object is a string. If the object is 192 // Generate code to check if an object is a string. If the object is a
193 // a string, the map's instance type is left in the scratch1 register. 193 // heap object, its map's instance type is left in the scratch1 register.
194 // If this is not needed, scratch1 and scratch2 may be the same register.
194 static void GenerateStringCheck(MacroAssembler* masm, 195 static void GenerateStringCheck(MacroAssembler* masm,
195 Register receiver, 196 Register receiver,
196 Register scratch1, 197 Register scratch1,
197 Register scratch2, 198 Register scratch2,
198 Label* smi, 199 Label* smi,
199 Label* non_string_object) { 200 Label* non_string_object) {
200 // Check that the receiver isn't a smi. 201 // Check that the receiver isn't a smi.
201 __ tst(receiver, Operand(kSmiTagMask)); 202 __ tst(receiver, Operand(kSmiTagMask));
202 __ b(eq, smi); 203 __ b(eq, smi);
203 204
204 // Check that the object is a string. 205 // Check that the object is a string.
205 __ ldr(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset)); 206 __ ldr(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset));
206 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 207 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
207 __ and_(scratch2, scratch1, Operand(kIsNotStringMask)); 208 __ and_(scratch2, scratch1, Operand(kIsNotStringMask));
208 // The cast is to resolve the overload for the argument of 0x0. 209 // The cast is to resolve the overload for the argument of 0x0.
209 __ cmp(scratch2, Operand(static_cast<int32_t>(kStringTag))); 210 __ cmp(scratch2, Operand(static_cast<int32_t>(kStringTag)));
210 __ b(ne, non_string_object); 211 __ b(ne, non_string_object);
211 } 212 }
212 213
213 214
214 // Generate code to load the length from a string object and return the length. 215 // Generate code to load the length from a string object and return the length.
215 // If the receiver object is not a string or a wrapped string object the 216 // If the receiver object is not a string or a wrapped string object the
216 // execution continues at the miss label. The register containing the 217 // execution continues at the miss label. The register containing the
217 // receiver is potentially clobbered. 218 // receiver is potentially clobbered.
218 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, 219 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
219 Register receiver, 220 Register receiver,
220 Register scratch1, 221 Register scratch1,
221 Register scratch2, 222 Register scratch2,
222 Label* miss) { 223 Label* miss) {
223 Label check_string, check_wrapper; 224 Label check_wrapper;
224 225
225 __ bind(&check_string);
226 // Check if the object is a string leaving the instance type in the 226 // Check if the object is a string leaving the instance type in the
227 // scratch1 register. 227 // scratch1 register.
228 GenerateStringCheck(masm, receiver, scratch1, scratch2, 228 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper);
229 miss, &check_wrapper);
230 229
231 // Load length directly from the string. 230 // Load length directly from the string.
232 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); 231 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset));
233 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); 232 __ mov(r0, Operand(r0, LSL, kSmiTagSize));
234 __ Ret(); 233 __ Ret();
235 234
236 // Check if the object is a JSValue wrapper. 235 // Check if the object is a JSValue wrapper.
237 __ bind(&check_wrapper); 236 __ bind(&check_wrapper);
238 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); 237 __ cmp(scratch1, Operand(JS_VALUE_TYPE));
239 __ b(ne, miss); 238 __ b(ne, miss);
240 239
241 // Unwrap the value in place and check if the wrapped value is a string. 240 // Unwrap the value and check if the wrapped value is a string.
242 __ ldr(receiver, FieldMemOperand(receiver, JSValue::kValueOffset)); 241 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset));
243 __ b(&check_string); 242 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss);
243 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset));
244 __ mov(r0, Operand(r0, LSL, kSmiTagSize));
245 __ Ret();
244 } 246 }
245 247
246 248
247 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, 249 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
248 Register receiver, 250 Register receiver,
249 Register scratch1, 251 Register scratch1,
250 Register scratch2, 252 Register scratch2,
251 Label* miss_label) { 253 Label* miss_label) {
252 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
253 __ mov(r0, scratch1); 255 __ mov(r0, scratch1);
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1876 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1875 1877
1876 // Return the generated code. 1878 // Return the generated code.
1877 return GetCode(); 1879 return GetCode();
1878 } 1880 }
1879 1881
1880 1882
1881 #undef __ 1883 #undef __
1882 1884
1883 } } // namespace v8::internal 1885 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698