Chromium Code Reviews| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 __ bind(&done); // t1 == t0 + 4*index | 120 __ bind(&done); // t1 == t0 + 4*index |
| 121 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); | 121 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); |
| 122 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 122 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); |
| 123 __ b(ne, miss); | 123 __ b(ne, miss); |
| 124 | 124 |
| 125 // Get the value at the masked, scaled index and return. | 125 // Get the value at the masked, scaled index and return. |
| 126 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); | 126 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 // Helper function used to check that a value is either not a function | 130 // Helper function used to check that a value is either not an object |
| 131 // or is loaded if it is a function. | 131 // or is loaded if it is an object. |
| 132 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, | 132 static void GenerateCheckNonObjectOrLoaded(MacroAssembler* masm, |
| 133 Label* miss, | 133 Label* miss, |
| 134 Register value, | 134 Register value, |
| 135 Register scratch) { | 135 Register scratch) { |
| 136 Label done; | 136 Label done; |
| 137 // Check if the value is a Smi. | 137 // Check if the value is a Smi. |
| 138 __ tst(value, Operand(kSmiTagMask)); | 138 __ tst(value, Operand(kSmiTagMask)); |
| 139 __ b(eq, &done); | 139 __ b(eq, &done); |
| 140 // Check if the value is a function. | |
| 141 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); | |
| 142 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
| 143 __ cmp(scratch, Operand(JS_FUNCTION_TYPE)); | |
| 144 __ b(ne, &done); | |
| 145 // Check if the function has been loaded. | 140 // Check if the function has been loaded. |
|
Mads Ager (chromium)
2009/04/23 19:09:25
function -> object
| |
| 146 __ ldr(scratch, | 141 __ ldr(scratch, FieldMemOperand(value, JSObject::kMapOffset)); |
| 147 FieldMemOperand(value, JSFunction::kSharedFunctionInfoOffset)); | 142 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); |
| 148 __ ldr(scratch, | 143 __ tst(scratch, Operand(1 << Map::kNeedsLoading)); |
| 149 FieldMemOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset)); | |
| 150 __ cmp(scratch, Operand(Factory::undefined_value())); | |
| 151 __ b(ne, miss); | 144 __ b(ne, miss); |
| 152 __ bind(&done); | 145 __ bind(&done); |
| 153 } | 146 } |
| 154 | 147 |
| 155 | 148 |
| 156 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 149 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
| 157 // ----------- S t a t e ------------- | 150 // ----------- S t a t e ------------- |
| 158 // -- r2 : name | 151 // -- r2 : name |
| 159 // -- lr : return address | 152 // -- lr : return address |
| 160 // -- [sp] : receiver | 153 // -- [sp] : receiver |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 int argc, | 263 int argc, |
| 271 bool is_global_object, | 264 bool is_global_object, |
| 272 Label* miss) { | 265 Label* miss) { |
| 273 // Search dictionary - put result in register r1. | 266 // Search dictionary - put result in register r1. |
| 274 GenerateDictionaryLoad(masm, miss, r0, r1); | 267 GenerateDictionaryLoad(masm, miss, r0, r1); |
| 275 | 268 |
| 276 // Check that the value isn't a smi. | 269 // Check that the value isn't a smi. |
| 277 __ tst(r1, Operand(kSmiTagMask)); | 270 __ tst(r1, Operand(kSmiTagMask)); |
| 278 __ b(eq, miss); | 271 __ b(eq, miss); |
| 279 | 272 |
| 280 // Check that the value is a JSFunction. | |
|
Mads Ager (chromium)
2009/04/23 19:09:25
We need this JSFunction check. We invoke r1 below
Christian Plesner Hansen
2009/04/24 08:11:22
Oh, good point.
| |
| 281 __ ldr(r0, FieldMemOperand(r1, HeapObject::kMapOffset)); | |
| 282 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | |
| 283 __ cmp(r0, Operand(JS_FUNCTION_TYPE)); | |
| 284 __ b(ne, miss); | |
| 285 | |
| 286 // Check that the function has been loaded. | 273 // Check that the function has been loaded. |
| 287 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 274 __ ldr(r0, FieldMemOperand(r1, JSObject::kMapOffset)); |
| 288 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kLazyLoadDataOffset)); | 275 __ ldrb(r0, FieldMemOperand(r0, Map::kBitField2Offset)); |
| 289 __ cmp(r0, Operand(Factory::undefined_value())); | 276 __ tst(r0, Operand(1 << Map::kNeedsLoading)); |
| 290 __ b(ne, miss); | 277 __ b(ne, miss); |
| 291 | 278 |
| 292 // Patch the receiver with the global proxy if necessary. | 279 // Patch the receiver with the global proxy if necessary. |
| 293 if (is_global_object) { | 280 if (is_global_object) { |
| 294 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); | 281 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); |
| 295 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 282 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
| 296 __ str(r2, MemOperand(sp, argc * kPointerSize)); | 283 __ str(r2, MemOperand(sp, argc * kPointerSize)); |
| 297 } | 284 } |
| 298 | 285 |
| 299 // Invoke the function. | 286 // Invoke the function. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 450 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
| 464 __ b(eq, &global); | 451 __ b(eq, &global); |
| 465 | 452 |
| 466 // Check for non-global object that requires access check. | 453 // Check for non-global object that requires access check. |
| 467 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); | 454 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 468 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); | 455 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 469 __ b(ne, &miss); | 456 __ b(ne, &miss); |
| 470 | 457 |
| 471 __ bind(&probe); | 458 __ bind(&probe); |
| 472 GenerateDictionaryLoad(masm, &miss, r1, r0); | 459 GenerateDictionaryLoad(masm, &miss, r1, r0); |
| 473 GenerateCheckNonFunctionOrLoaded(masm, &miss, r0, r1); | 460 GenerateCheckNonObjectOrLoaded(masm, &miss, r0, r1); |
| 474 __ Ret(); | 461 __ Ret(); |
| 475 | 462 |
| 476 // Global object access: Check access rights. | 463 // Global object access: Check access rights. |
| 477 __ bind(&global); | 464 __ bind(&global); |
| 478 __ CheckAccessGlobalProxy(r0, r1, &miss); | 465 __ CheckAccessGlobalProxy(r0, r1, &miss); |
| 479 __ b(&probe); | 466 __ b(&probe); |
| 480 | 467 |
| 481 // Cache miss: Restore receiver from stack and jump to runtime. | 468 // Cache miss: Restore receiver from stack and jump to runtime. |
| 482 __ bind(&miss); | 469 __ bind(&miss); |
| 483 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 470 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 | 781 |
| 795 // Perform tail call to the entry. | 782 // Perform tail call to the entry. |
| 796 __ TailCallRuntime(f, 3); | 783 __ TailCallRuntime(f, 3); |
| 797 } | 784 } |
| 798 | 785 |
| 799 | 786 |
| 800 #undef __ | 787 #undef __ |
| 801 | 788 |
| 802 | 789 |
| 803 } } // namespace v8::internal | 790 } } // namespace v8::internal |
| OLD | NEW |