| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 247   __ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), | 247   __ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), | 
| 248           Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 248           Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 
| 249   __ j(not_zero, miss); | 249   __ j(not_zero, miss); | 
| 250 | 250 | 
| 251   // Get the value at the masked, scaled index. | 251   // Get the value at the masked, scaled index. | 
| 252   const int kValueOffset = kElementsStartOffset + kPointerSize; | 252   const int kValueOffset = kElementsStartOffset + kPointerSize; | 
| 253   __ mov(key, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); | 253   __ mov(key, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); | 
| 254 } | 254 } | 
| 255 | 255 | 
| 256 | 256 | 
| 257 // Helper function used to check that a value is either not an object |  | 
| 258 // or is loaded if it is an object. |  | 
| 259 static void GenerateCheckNonObjectOrLoaded(MacroAssembler* masm, Label* miss, |  | 
| 260                                            Register value, Register scratch) { |  | 
| 261   Label done; |  | 
| 262   // Check if the value is a Smi. |  | 
| 263   __ test(value, Immediate(kSmiTagMask)); |  | 
| 264   __ j(zero, &done, not_taken); |  | 
| 265   // Check if the object has been loaded. |  | 
| 266   __ mov(scratch, FieldOperand(value, JSFunction::kMapOffset)); |  | 
| 267   __ mov(scratch, FieldOperand(scratch, Map::kBitField2Offset)); |  | 
| 268   __ test(scratch, Immediate(1 << Map::kNeedsLoading)); |  | 
| 269   __ j(not_zero, miss, not_taken); |  | 
| 270   __ bind(&done); |  | 
| 271 } |  | 
| 272 |  | 
| 273 |  | 
| 274 // The offset from the inlined patch site to the start of the | 257 // The offset from the inlined patch site to the start of the | 
| 275 // inlined load instruction.  It is 7 bytes (test eax, imm) plus | 258 // inlined load instruction.  It is 7 bytes (test eax, imm) plus | 
| 276 // 6 bytes (jne slow_label). | 259 // 6 bytes (jne slow_label). | 
| 277 const int LoadIC::kOffsetToLoadInstruction = 13; | 260 const int LoadIC::kOffsetToLoadInstruction = 13; | 
| 278 | 261 | 
| 279 | 262 | 
| 280 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 263 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 
| 281   // ----------- S t a t e ------------- | 264   // ----------- S t a t e ------------- | 
| 282   //  -- eax    : receiver | 265   //  -- eax    : receiver | 
| 283   //  -- ecx    : name | 266   //  -- ecx    : name | 
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 488   // exists. | 471   // exists. | 
| 489   __ bind(&probe_dictionary); | 472   __ bind(&probe_dictionary); | 
| 490   GenerateDictionaryLoad(masm, | 473   GenerateDictionaryLoad(masm, | 
| 491                          &slow, | 474                          &slow, | 
| 492                          edx, | 475                          edx, | 
| 493                          eax, | 476                          eax, | 
| 494                          ebx, | 477                          ebx, | 
| 495                          ecx, | 478                          ecx, | 
| 496                          edi, | 479                          edi, | 
| 497                          DICTIONARY_CHECK_DONE); | 480                          DICTIONARY_CHECK_DONE); | 
| 498   GenerateCheckNonObjectOrLoaded(masm, &slow, ecx, ebx); |  | 
| 499   __ mov(eax, ecx); | 481   __ mov(eax, ecx); | 
| 500   __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 482   __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 
| 501   __ ret(0); | 483   __ ret(0); | 
| 502 | 484 | 
| 503   // If the hash field contains an array index pick it out. The assert checks | 485   // If the hash field contains an array index pick it out. The assert checks | 
| 504   // that the constants for the maximum number of digits for an array index | 486   // that the constants for the maximum number of digits for an array index | 
| 505   // cached in the hash field and the number of bits reserved for it does not | 487   // cached in the hash field and the number of bits reserved for it does not | 
| 506   // conflict. | 488   // conflict. | 
| 507   ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 489   ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 
| 508          (1 << String::kArrayIndexValueBits)); | 490          (1 << String::kArrayIndexValueBits)); | 
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1139   GenerateDictionaryLoad(masm, miss, edx, ecx, eax, edi, ebx, CHECK_DICTIONARY); | 1121   GenerateDictionaryLoad(masm, miss, edx, ecx, eax, edi, ebx, CHECK_DICTIONARY); | 
| 1140 | 1122 | 
| 1141   // Check that the result is not a smi. | 1123   // Check that the result is not a smi. | 
| 1142   __ test(edi, Immediate(kSmiTagMask)); | 1124   __ test(edi, Immediate(kSmiTagMask)); | 
| 1143   __ j(zero, miss, not_taken); | 1125   __ j(zero, miss, not_taken); | 
| 1144 | 1126 | 
| 1145   // Check that the value is a JavaScript function, fetching its map into eax. | 1127   // Check that the value is a JavaScript function, fetching its map into eax. | 
| 1146   __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); | 1128   __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); | 
| 1147   __ j(not_equal, miss, not_taken); | 1129   __ j(not_equal, miss, not_taken); | 
| 1148 | 1130 | 
| 1149   // Check that the function has been loaded.  eax holds function's map. |  | 
| 1150   __ mov(eax, FieldOperand(eax, Map::kBitField2Offset)); |  | 
| 1151   __ test(eax, Immediate(1 << Map::kNeedsLoading)); |  | 
| 1152   __ j(not_zero, miss, not_taken); |  | 
| 1153 |  | 
| 1154   // Patch the receiver on stack with the global proxy if necessary. | 1131   // Patch the receiver on stack with the global proxy if necessary. | 
| 1155   if (is_global_object) { | 1132   if (is_global_object) { | 
| 1156     __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1133     __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 
| 1157     __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1134     __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 
| 1158   } | 1135   } | 
| 1159 | 1136 | 
| 1160   // Invoke the function. | 1137   // Invoke the function. | 
| 1161   ParameterCount actual(argc); | 1138   ParameterCount actual(argc); | 
| 1162   __ InvokeFunction(edi, actual, JUMP_FUNCTION); | 1139   __ InvokeFunction(edi, actual, JUMP_FUNCTION); | 
| 1163 } | 1140 } | 
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1334   // Search the dictionary placing the result in eax. | 1311   // Search the dictionary placing the result in eax. | 
| 1335   __ bind(&probe); | 1312   __ bind(&probe); | 
| 1336   GenerateDictionaryLoad(masm, | 1313   GenerateDictionaryLoad(masm, | 
| 1337                          &miss, | 1314                          &miss, | 
| 1338                          eax, | 1315                          eax, | 
| 1339                          ecx, | 1316                          ecx, | 
| 1340                          edx, | 1317                          edx, | 
| 1341                          edi, | 1318                          edi, | 
| 1342                          ebx, | 1319                          ebx, | 
| 1343                          CHECK_DICTIONARY); | 1320                          CHECK_DICTIONARY); | 
| 1344   GenerateCheckNonObjectOrLoaded(masm, &miss, edi, edx); |  | 
| 1345   __ mov(eax, edi); | 1321   __ mov(eax, edi); | 
| 1346   __ ret(0); | 1322   __ ret(0); | 
| 1347 | 1323 | 
| 1348   // Global object access: Check access rights. | 1324   // Global object access: Check access rights. | 
| 1349   __ bind(&global); | 1325   __ bind(&global); | 
| 1350   __ CheckAccessGlobalProxy(eax, edx, &miss); | 1326   __ CheckAccessGlobalProxy(eax, edx, &miss); | 
| 1351   __ jmp(&probe); | 1327   __ jmp(&probe); | 
| 1352 | 1328 | 
| 1353   // Cache miss: Restore receiver from stack and jump to runtime. | 1329   // Cache miss: Restore receiver from stack and jump to runtime. | 
| 1354   __ bind(&miss); | 1330   __ bind(&miss); | 
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1635 | 1611 | 
| 1636   // Do tail-call to runtime routine. | 1612   // Do tail-call to runtime routine. | 
| 1637   ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1613   ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 
| 1638   __ TailCallExternalReference(ref, 3, 1); | 1614   __ TailCallExternalReference(ref, 3, 1); | 
| 1639 } | 1615 } | 
| 1640 | 1616 | 
| 1641 #undef __ | 1617 #undef __ | 
| 1642 | 1618 | 
| 1643 | 1619 | 
| 1644 } }  // namespace v8::internal | 1620 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|