OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 __ bind(&done); // t1 == t0 + 4*index | 138 __ bind(&done); // t1 == t0 + 4*index |
139 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); | 139 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); |
140 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 140 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); |
141 __ b(ne, miss); | 141 __ b(ne, miss); |
142 | 142 |
143 // Get the value at the masked, scaled index and return. | 143 // Get the value at the masked, scaled index and return. |
144 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); | 144 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 // Helper function used to check that a value is either not an object | |
149 // or is loaded if it is an object. | |
150 static void GenerateCheckNonObjectOrLoaded(MacroAssembler* masm, | |
151 Label* miss, | |
152 Register value, | |
153 Register scratch) { | |
154 Label done; | |
155 // Check if the value is a Smi. | |
156 __ tst(value, Operand(kSmiTagMask)); | |
157 __ b(eq, &done); | |
158 // Check if the object has been loaded. | |
159 __ ldr(scratch, FieldMemOperand(value, JSObject::kMapOffset)); | |
160 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); | |
161 __ tst(scratch, Operand(1 << Map::kNeedsLoading)); | |
162 __ b(ne, miss); | |
163 __ bind(&done); | |
164 } | |
165 | |
166 | |
167 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 148 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
168 // ----------- S t a t e ------------- | 149 // ----------- S t a t e ------------- |
169 // -- r2 : name | 150 // -- r2 : name |
170 // -- lr : return address | 151 // -- lr : return address |
171 // -- [sp] : receiver | 152 // -- [sp] : receiver |
172 // ----------------------------------- | 153 // ----------------------------------- |
173 Label miss; | 154 Label miss; |
174 | 155 |
175 __ ldr(r0, MemOperand(sp, 0)); | 156 __ ldr(r0, MemOperand(sp, 0)); |
176 | 157 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 GenerateDictionaryLoad(masm, miss, r0, r1); | 266 GenerateDictionaryLoad(masm, miss, r0, r1); |
286 | 267 |
287 // Check that the value isn't a smi. | 268 // Check that the value isn't a smi. |
288 __ tst(r1, Operand(kSmiTagMask)); | 269 __ tst(r1, Operand(kSmiTagMask)); |
289 __ b(eq, miss); | 270 __ b(eq, miss); |
290 | 271 |
291 // Check that the value is a JSFunction. | 272 // Check that the value is a JSFunction. |
292 __ CompareObjectType(r1, r0, r0, JS_FUNCTION_TYPE); | 273 __ CompareObjectType(r1, r0, r0, JS_FUNCTION_TYPE); |
293 __ b(ne, miss); | 274 __ b(ne, miss); |
294 | 275 |
295 // Check that the function has been loaded. | |
296 __ ldr(r0, FieldMemOperand(r1, JSObject::kMapOffset)); | |
297 __ ldrb(r0, FieldMemOperand(r0, Map::kBitField2Offset)); | |
298 __ tst(r0, Operand(1 << Map::kNeedsLoading)); | |
299 __ b(ne, miss); | |
300 | |
301 // Patch the receiver with the global proxy if necessary. | 276 // Patch the receiver with the global proxy if necessary. |
302 if (is_global_object) { | 277 if (is_global_object) { |
303 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 278 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
304 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 279 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
305 __ str(r0, MemOperand(sp, argc * kPointerSize)); | 280 __ str(r0, MemOperand(sp, argc * kPointerSize)); |
306 } | 281 } |
307 | 282 |
308 // Invoke the function. | 283 // Invoke the function. |
309 ParameterCount actual(argc); | 284 ParameterCount actual(argc); |
310 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 285 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 437 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
463 __ b(eq, &global); | 438 __ b(eq, &global); |
464 | 439 |
465 // Check for non-global object that requires access check. | 440 // Check for non-global object that requires access check. |
466 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 441 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
467 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); | 442 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
468 __ b(ne, &miss); | 443 __ b(ne, &miss); |
469 | 444 |
470 __ bind(&probe); | 445 __ bind(&probe); |
471 GenerateDictionaryLoad(masm, &miss, r1, r0); | 446 GenerateDictionaryLoad(masm, &miss, r1, r0); |
472 GenerateCheckNonObjectOrLoaded(masm, &miss, r0, r1); | |
473 __ Ret(); | 447 __ Ret(); |
474 | 448 |
475 // Global object access: Check access rights. | 449 // Global object access: Check access rights. |
476 __ bind(&global); | 450 __ bind(&global); |
477 __ CheckAccessGlobalProxy(r0, r1, &miss); | 451 __ CheckAccessGlobalProxy(r0, r1, &miss); |
478 __ b(&probe); | 452 __ b(&probe); |
479 | 453 |
480 // Cache miss: Restore receiver from stack and jump to runtime. | 454 // Cache miss: Restore receiver from stack and jump to runtime. |
481 __ bind(&miss); | 455 __ bind(&miss); |
482 GenerateMiss(masm); | 456 GenerateMiss(masm); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 __ bind(&miss); | 881 __ bind(&miss); |
908 | 882 |
909 GenerateMiss(masm); | 883 GenerateMiss(masm); |
910 } | 884 } |
911 | 885 |
912 | 886 |
913 #undef __ | 887 #undef __ |
914 | 888 |
915 | 889 |
916 } } // namespace v8::internal | 890 } } // namespace v8::internal |
OLD | NEW |