| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 Smi::FromInt(PropertyDetails::TypeField::mask())); | 144 Smi::FromInt(PropertyDetails::TypeField::mask())); |
| 145 __ j(not_zero, miss_label); | 145 __ j(not_zero, miss_label); |
| 146 | 146 |
| 147 // Get the value at the masked, scaled index. | 147 // Get the value at the masked, scaled index. |
| 148 const int kValueOffset = kElementsStartOffset + kPointerSize; | 148 const int kValueOffset = kElementsStartOffset + kPointerSize; |
| 149 __ movq(r1, | 149 __ movq(r1, |
| 150 Operand(r0, r1, times_pointer_size, kValueOffset - kHeapObjectTag)); | 150 Operand(r0, r1, times_pointer_size, 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) { | |
| 158 Label done; | |
| 159 // Check if the value is a Smi. | |
| 160 __ JumpIfSmi(value, &done); | |
| 161 // Check if the object has been loaded. | |
| 162 __ movq(kScratchRegister, FieldOperand(value, JSFunction::kMapOffset)); | |
| 163 __ testb(FieldOperand(kScratchRegister, Map::kBitField2Offset), | |
| 164 Immediate(1 << Map::kNeedsLoading)); | |
| 165 __ j(not_zero, miss); | |
| 166 __ bind(&done); | |
| 167 } | |
| 168 | |
| 169 | |
| 170 // One byte opcode for test eax,0xXXXXXXXX. | 154 // One byte opcode for test eax,0xXXXXXXXX. |
| 171 static const byte kTestEaxByte = 0xA9; | 155 static const byte kTestEaxByte = 0xA9; |
| 172 | 156 |
| 173 | 157 |
| 174 static bool PatchInlinedMapCheck(Address address, Object* map) { | 158 static bool PatchInlinedMapCheck(Address address, Object* map) { |
| 175 // Arguments are address of start of call sequence that called | 159 // Arguments are address of start of call sequence that called |
| 176 // the IC, | 160 // the IC, |
| 177 Address test_instruction_address = | 161 Address test_instruction_address = |
| 178 address + Assembler::kCallTargetAddressOffset; | 162 address + Assembler::kCallTargetAddressOffset; |
| 179 // The keyed load has a fast inlined case if the IC call instruction | 163 // The keyed load has a fast inlined case if the IC call instruction |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // Do a quick inline probe of the receiver's dictionary, if it | 367 // Do a quick inline probe of the receiver's dictionary, if it |
| 384 // exists. | 368 // exists. |
| 385 __ bind(&probe_dictionary); | 369 __ bind(&probe_dictionary); |
| 386 GenerateDictionaryLoad(masm, | 370 GenerateDictionaryLoad(masm, |
| 387 &slow, | 371 &slow, |
| 388 rbx, | 372 rbx, |
| 389 rcx, | 373 rcx, |
| 390 rdx, | 374 rdx, |
| 391 rax, | 375 rax, |
| 392 DICTIONARY_CHECK_DONE); | 376 DICTIONARY_CHECK_DONE); |
| 393 GenerateCheckNonObjectOrLoaded(masm, &slow, rcx); | |
| 394 __ movq(rax, rcx); | 377 __ movq(rax, rcx); |
| 395 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 378 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); |
| 396 __ ret(0); | 379 __ ret(0); |
| 397 // If the hash field contains an array index pick it out. The assert checks | 380 // If the hash field contains an array index pick it out. The assert checks |
| 398 // that the constants for the maximum number of digits for an array index | 381 // that the constants for the maximum number of digits for an array index |
| 399 // cached in the hash field and the number of bits reserved for it does not | 382 // cached in the hash field and the number of bits reserved for it does not |
| 400 // conflict. | 383 // conflict. |
| 401 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 384 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
| 402 (1 << String::kArrayIndexValueBits)); | 385 (1 << String::kArrayIndexValueBits)); |
| 403 __ bind(&index_string); | 386 __ bind(&index_string); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 // Search dictionary - put result in register rdx. | 1029 // Search dictionary - put result in register rdx. |
| 1047 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); | 1030 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); |
| 1048 | 1031 |
| 1049 // Move the result to register rdi and check that it isn't a smi. | 1032 // Move the result to register rdi and check that it isn't a smi. |
| 1050 __ movq(rdi, rdx); | 1033 __ movq(rdi, rdx); |
| 1051 __ JumpIfSmi(rdx, miss); | 1034 __ JumpIfSmi(rdx, miss); |
| 1052 | 1035 |
| 1053 // Check that the value is a JavaScript function. | 1036 // Check that the value is a JavaScript function. |
| 1054 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx); | 1037 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx); |
| 1055 __ j(not_equal, miss); | 1038 __ j(not_equal, miss); |
| 1056 // Check that the function has been loaded. | |
| 1057 __ testb(FieldOperand(rdx, Map::kBitField2Offset), | |
| 1058 Immediate(1 << Map::kNeedsLoading)); | |
| 1059 __ j(not_zero, miss); | |
| 1060 | 1039 |
| 1061 // Patch the receiver with the global proxy if necessary. | 1040 // Patch the receiver with the global proxy if necessary. |
| 1062 if (is_global_object) { | 1041 if (is_global_object) { |
| 1063 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1042 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
| 1064 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1043 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 1065 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1044 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 1066 } | 1045 } |
| 1067 | 1046 |
| 1068 // Invoke the function. | 1047 // Invoke the function. |
| 1069 ParameterCount actual(argc); | 1048 ParameterCount actual(argc); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 __ j(equal, &global); | 1239 __ j(equal, &global); |
| 1261 | 1240 |
| 1262 // Check for non-global object that requires access check. | 1241 // Check for non-global object that requires access check. |
| 1263 __ testl(FieldOperand(rbx, Map::kBitFieldOffset), | 1242 __ testl(FieldOperand(rbx, Map::kBitFieldOffset), |
| 1264 Immediate(1 << Map::kIsAccessCheckNeeded)); | 1243 Immediate(1 << Map::kIsAccessCheckNeeded)); |
| 1265 __ j(not_zero, &miss); | 1244 __ j(not_zero, &miss); |
| 1266 | 1245 |
| 1267 // Search the dictionary placing the result in rax. | 1246 // Search the dictionary placing the result in rax. |
| 1268 __ bind(&probe); | 1247 __ bind(&probe); |
| 1269 GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx, CHECK_DICTIONARY); | 1248 GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx, CHECK_DICTIONARY); |
| 1270 GenerateCheckNonObjectOrLoaded(masm, &miss, rax); | |
| 1271 __ ret(0); | 1249 __ ret(0); |
| 1272 | 1250 |
| 1273 // Global object access: Check access rights. | 1251 // Global object access: Check access rights. |
| 1274 __ bind(&global); | 1252 __ bind(&global); |
| 1275 __ CheckAccessGlobalProxy(rax, rdx, &miss); | 1253 __ CheckAccessGlobalProxy(rax, rdx, &miss); |
| 1276 __ jmp(&probe); | 1254 __ jmp(&probe); |
| 1277 | 1255 |
| 1278 // Cache miss: Restore receiver from stack and jump to runtime. | 1256 // Cache miss: Restore receiver from stack and jump to runtime. |
| 1279 __ bind(&miss); | 1257 __ bind(&miss); |
| 1280 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 1258 __ movq(rax, Operand(rsp, 1 * kPointerSize)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 | 1357 |
| 1380 // Cache miss: Jump to runtime. | 1358 // Cache miss: Jump to runtime. |
| 1381 GenerateMiss(masm); | 1359 GenerateMiss(masm); |
| 1382 } | 1360 } |
| 1383 | 1361 |
| 1384 | 1362 |
| 1385 #undef __ | 1363 #undef __ |
| 1386 | 1364 |
| 1387 | 1365 |
| 1388 } } // namespace v8::internal | 1366 } } // namespace v8::internal |
| OLD | NEW |