| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 __ test(Operand(r0, r1, times_4, kDetailsOffset - kHeapObjectTag), | 144 __ test(Operand(r0, r1, times_4, kDetailsOffset - kHeapObjectTag), |
| 145 Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 145 Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); |
| 146 __ j(not_zero, miss_label, not_taken); | 146 __ j(not_zero, miss_label, not_taken); |
| 147 | 147 |
| 148 // Get the value at the masked, scaled index. | 148 // Get the value at the masked, scaled index. |
| 149 const int kValueOffset = kElementsStartOffset + kPointerSize; | 149 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 150 __ mov(r1, Operand(r0, r1, times_4, kValueOffset - kHeapObjectTag)); | 150 __ mov(r1, Operand(r0, r1, times_4, kValueOffset - kHeapObjectTag)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 // Helper function used to check that a value is either not an object | |
| 155 // or is loaded if it is an object. | |
| 156 static void GenerateCheckNonObjectOrLoaded(MacroAssembler* masm, Label* miss, | |
| 157 Register value, Register scratch) { | |
| 158 Label done; | |
| 159 // Check if the value is a Smi. | |
| 160 __ test(value, Immediate(kSmiTagMask)); | |
| 161 __ j(zero, &done, not_taken); | |
| 162 // Check if the object has been loaded. | |
| 163 __ mov(scratch, FieldOperand(value, JSFunction::kMapOffset)); | |
| 164 __ mov(scratch, FieldOperand(scratch, Map::kBitField2Offset)); | |
| 165 __ test(scratch, Immediate(1 << Map::kNeedsLoading)); | |
| 166 __ j(not_zero, miss, not_taken); | |
| 167 __ bind(&done); | |
| 168 } | |
| 169 | |
| 170 | |
| 171 // The offset from the inlined patch site to the start of the | 154 // The offset from the inlined patch site to the start of the |
| 172 // inlined load instruction. It is 7 bytes (test eax, imm) plus | 155 // inlined load instruction. It is 7 bytes (test eax, imm) plus |
| 173 // 6 bytes (jne slow_label). | 156 // 6 bytes (jne slow_label). |
| 174 const int LoadIC::kOffsetToLoadInstruction = 13; | 157 const int LoadIC::kOffsetToLoadInstruction = 13; |
| 175 | 158 |
| 176 | 159 |
| 177 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 160 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
| 178 // ----------- S t a t e ------------- | 161 // ----------- S t a t e ------------- |
| 179 // -- ecx : name | 162 // -- ecx : name |
| 180 // -- esp[0] : return address | 163 // -- esp[0] : return address |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // Do a quick inline probe of the receiver's dictionary, if it | 345 // Do a quick inline probe of the receiver's dictionary, if it |
| 363 // exists. | 346 // exists. |
| 364 __ bind(&probe_dictionary); | 347 __ bind(&probe_dictionary); |
| 365 GenerateDictionaryLoad(masm, | 348 GenerateDictionaryLoad(masm, |
| 366 &slow, | 349 &slow, |
| 367 ebx, | 350 ebx, |
| 368 ecx, | 351 ecx, |
| 369 edx, | 352 edx, |
| 370 eax, | 353 eax, |
| 371 DICTIONARY_CHECK_DONE); | 354 DICTIONARY_CHECK_DONE); |
| 372 GenerateCheckNonObjectOrLoaded(masm, &slow, ecx, edx); | |
| 373 __ mov(eax, Operand(ecx)); | 355 __ mov(eax, Operand(ecx)); |
| 374 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 356 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); |
| 375 __ ret(0); | 357 __ ret(0); |
| 376 | 358 |
| 377 // If the hash field contains an array index pick it out. The assert checks | 359 // If the hash field contains an array index pick it out. The assert checks |
| 378 // that the constants for the maximum number of digits for an array index | 360 // that the constants for the maximum number of digits for an array index |
| 379 // cached in the hash field and the number of bits reserved for it does not | 361 // cached in the hash field and the number of bits reserved for it does not |
| 380 // conflict. | 362 // conflict. |
| 381 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 363 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
| 382 (1 << String::kArrayIndexValueBits)); | 364 (1 << String::kArrayIndexValueBits)); |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 GenerateDictionaryLoad(masm, miss, eax, edi, ebx, ecx, CHECK_DICTIONARY); | 986 GenerateDictionaryLoad(masm, miss, eax, edi, ebx, ecx, CHECK_DICTIONARY); |
| 1005 | 987 |
| 1006 // Check that the result is not a smi. | 988 // Check that the result is not a smi. |
| 1007 __ test(edi, Immediate(kSmiTagMask)); | 989 __ test(edi, Immediate(kSmiTagMask)); |
| 1008 __ j(zero, miss, not_taken); | 990 __ j(zero, miss, not_taken); |
| 1009 | 991 |
| 1010 // Check that the value is a JavaScript function, fetching its map into eax. | 992 // Check that the value is a JavaScript function, fetching its map into eax. |
| 1011 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); | 993 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); |
| 1012 __ j(not_equal, miss, not_taken); | 994 __ j(not_equal, miss, not_taken); |
| 1013 | 995 |
| 1014 // Check that the function has been loaded. eax holds function's map. | |
| 1015 __ mov(eax, FieldOperand(eax, Map::kBitField2Offset)); | |
| 1016 __ test(eax, Immediate(1 << Map::kNeedsLoading)); | |
| 1017 __ j(not_zero, miss, not_taken); | |
| 1018 | |
| 1019 // Patch the receiver on stack with the global proxy if necessary. | 996 // Patch the receiver on stack with the global proxy if necessary. |
| 1020 if (is_global_object) { | 997 if (is_global_object) { |
| 1021 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 998 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
| 1022 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 999 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
| 1023 } | 1000 } |
| 1024 | 1001 |
| 1025 // Invoke the function. | 1002 // Invoke the function. |
| 1026 ParameterCount actual(argc); | 1003 ParameterCount actual(argc); |
| 1027 __ InvokeFunction(edi, actual, JUMP_FUNCTION); | 1004 __ InvokeFunction(edi, actual, JUMP_FUNCTION); |
| 1028 } | 1005 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 __ j(equal, &global, not_taken); | 1173 __ j(equal, &global, not_taken); |
| 1197 | 1174 |
| 1198 // Check for non-global object that requires access check. | 1175 // Check for non-global object that requires access check. |
| 1199 __ movzx_b(ebx, FieldOperand(ebx, Map::kBitFieldOffset)); | 1176 __ movzx_b(ebx, FieldOperand(ebx, Map::kBitFieldOffset)); |
| 1200 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 1177 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); |
| 1201 __ j(not_zero, &miss, not_taken); | 1178 __ j(not_zero, &miss, not_taken); |
| 1202 | 1179 |
| 1203 // Search the dictionary placing the result in eax. | 1180 // Search the dictionary placing the result in eax. |
| 1204 __ bind(&probe); | 1181 __ bind(&probe); |
| 1205 GenerateDictionaryLoad(masm, &miss, edx, eax, ebx, ecx, CHECK_DICTIONARY); | 1182 GenerateDictionaryLoad(masm, &miss, edx, eax, ebx, ecx, CHECK_DICTIONARY); |
| 1206 GenerateCheckNonObjectOrLoaded(masm, &miss, eax, edx); | |
| 1207 __ ret(0); | 1183 __ ret(0); |
| 1208 | 1184 |
| 1209 // Global object access: Check access rights. | 1185 // Global object access: Check access rights. |
| 1210 __ bind(&global); | 1186 __ bind(&global); |
| 1211 __ CheckAccessGlobalProxy(eax, edx, &miss); | 1187 __ CheckAccessGlobalProxy(eax, edx, &miss); |
| 1212 __ jmp(&probe); | 1188 __ jmp(&probe); |
| 1213 | 1189 |
| 1214 // Cache miss: Restore receiver from stack and jump to runtime. | 1190 // Cache miss: Restore receiver from stack and jump to runtime. |
| 1215 __ bind(&miss); | 1191 __ bind(&miss); |
| 1216 __ mov(eax, Operand(esp, 1 * kPointerSize)); | 1192 __ mov(eax, Operand(esp, 1 * kPointerSize)); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 | 1447 |
| 1472 // Do tail-call to runtime routine. | 1448 // Do tail-call to runtime routine. |
| 1473 __ TailCallRuntime( | 1449 __ TailCallRuntime( |
| 1474 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1450 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1475 } | 1451 } |
| 1476 | 1452 |
| 1477 #undef __ | 1453 #undef __ |
| 1478 | 1454 |
| 1479 | 1455 |
| 1480 } } // namespace v8::internal | 1456 } } // namespace v8::internal |
| OLD | NEW |