| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 GenerateDictionaryLoad(masm, miss, r0, r1); | 267 GenerateDictionaryLoad(masm, miss, r0, r1); |
| 287 | 268 |
| 288 // Check that the value isn't a smi. | 269 // Check that the value isn't a smi. |
| 289 __ tst(r1, Operand(kSmiTagMask)); | 270 __ tst(r1, Operand(kSmiTagMask)); |
| 290 __ b(eq, miss); | 271 __ b(eq, miss); |
| 291 | 272 |
| 292 // Check that the value is a JSFunction. | 273 // Check that the value is a JSFunction. |
| 293 __ CompareObjectType(r1, r0, r0, JS_FUNCTION_TYPE); | 274 __ CompareObjectType(r1, r0, r0, JS_FUNCTION_TYPE); |
| 294 __ b(ne, miss); | 275 __ b(ne, miss); |
| 295 | 276 |
| 296 // Check that the function has been loaded. | |
| 297 __ ldr(r0, FieldMemOperand(r1, JSObject::kMapOffset)); | |
| 298 __ ldrb(r0, FieldMemOperand(r0, Map::kBitField2Offset)); | |
| 299 __ tst(r0, Operand(1 << Map::kNeedsLoading)); | |
| 300 __ b(ne, miss); | |
| 301 | |
| 302 // Patch the receiver with the global proxy if necessary. | 277 // Patch the receiver with the global proxy if necessary. |
| 303 if (is_global_object) { | 278 if (is_global_object) { |
| 304 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); | 279 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); |
| 305 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 280 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
| 306 __ str(r2, MemOperand(sp, argc * kPointerSize)); | 281 __ str(r2, MemOperand(sp, argc * kPointerSize)); |
| 307 } | 282 } |
| 308 | 283 |
| 309 // Invoke the function. | 284 // Invoke the function. |
| 310 ParameterCount actual(argc); | 285 ParameterCount actual(argc); |
| 311 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 286 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 440 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
| 466 __ b(eq, &global); | 441 __ b(eq, &global); |
| 467 | 442 |
| 468 // Check for non-global object that requires access check. | 443 // Check for non-global object that requires access check. |
| 469 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 444 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 470 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); | 445 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 471 __ b(ne, &miss); | 446 __ b(ne, &miss); |
| 472 | 447 |
| 473 __ bind(&probe); | 448 __ bind(&probe); |
| 474 GenerateDictionaryLoad(masm, &miss, r1, r0); | 449 GenerateDictionaryLoad(masm, &miss, r1, r0); |
| 475 GenerateCheckNonObjectOrLoaded(masm, &miss, r0, r1); | |
| 476 __ Ret(); | 450 __ Ret(); |
| 477 | 451 |
| 478 // Global object access: Check access rights. | 452 // Global object access: Check access rights. |
| 479 __ bind(&global); | 453 __ bind(&global); |
| 480 __ CheckAccessGlobalProxy(r0, r1, &miss); | 454 __ CheckAccessGlobalProxy(r0, r1, &miss); |
| 481 __ b(&probe); | 455 __ b(&probe); |
| 482 | 456 |
| 483 // Cache miss: Restore receiver from stack and jump to runtime. | 457 // Cache miss: Restore receiver from stack and jump to runtime. |
| 484 __ bind(&miss); | 458 __ bind(&miss); |
| 485 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 459 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 818 |
| 845 // Perform tail call to the entry. | 819 // Perform tail call to the entry. |
| 846 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); | 820 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); |
| 847 } | 821 } |
| 848 | 822 |
| 849 | 823 |
| 850 #undef __ | 824 #undef __ |
| 851 | 825 |
| 852 | 826 |
| 853 } } // namespace v8::internal | 827 } } // namespace v8::internal |
| OLD | NEW |