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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 __ Test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), | 246 __ Test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset), |
247 Smi::FromInt(PropertyDetails::TypeField::mask())); | 247 Smi::FromInt(PropertyDetails::TypeField::mask())); |
248 __ j(not_zero, miss); | 248 __ j(not_zero, miss); |
249 | 249 |
250 // Get the value at the masked, scaled index. | 250 // Get the value at the masked, scaled index. |
251 const int kValueOffset = kElementsStartOffset + kPointerSize; | 251 const int kValueOffset = kElementsStartOffset + kPointerSize; |
252 __ movq(r0, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); | 252 __ movq(r0, FieldOperand(elements, r2, times_pointer_size, kValueOffset)); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 // Helper function used to check that a value is either not an object | |
257 // or is loaded if it is an object. | |
258 static void GenerateCheckNonObjectOrLoaded(MacroAssembler* masm, Label* miss, | |
259 Register value) { | |
260 Label done; | |
261 // Check if the value is a Smi. | |
262 __ JumpIfSmi(value, &done); | |
263 // Check if the object has been loaded. | |
264 __ movq(kScratchRegister, FieldOperand(value, JSFunction::kMapOffset)); | |
265 __ testb(FieldOperand(kScratchRegister, Map::kBitField2Offset), | |
266 Immediate(1 << Map::kNeedsLoading)); | |
267 __ j(not_zero, miss); | |
268 __ bind(&done); | |
269 } | |
270 | |
271 | |
272 // One byte opcode for test eax,0xXXXXXXXX. | 256 // One byte opcode for test eax,0xXXXXXXXX. |
273 static const byte kTestEaxByte = 0xA9; | 257 static const byte kTestEaxByte = 0xA9; |
274 | 258 |
275 | 259 |
276 static bool PatchInlinedMapCheck(Address address, Object* map) { | 260 static bool PatchInlinedMapCheck(Address address, Object* map) { |
277 // Arguments are address of start of call sequence that called | 261 // Arguments are address of start of call sequence that called |
278 // the IC, | 262 // the IC, |
279 Address test_instruction_address = | 263 Address test_instruction_address = |
280 address + Assembler::kCallTargetAddressOffset; | 264 address + Assembler::kCallTargetAddressOffset; |
281 // The keyed load has a fast inlined case if the IC call instruction | 265 // The keyed load has a fast inlined case if the IC call instruction |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // Do a quick inline probe of the receiver's dictionary, if it | 499 // Do a quick inline probe of the receiver's dictionary, if it |
516 // exists. | 500 // exists. |
517 __ bind(&probe_dictionary); | 501 __ bind(&probe_dictionary); |
518 GenerateDictionaryLoad(masm, | 502 GenerateDictionaryLoad(masm, |
519 &slow, | 503 &slow, |
520 rbx, | 504 rbx, |
521 rcx, | 505 rcx, |
522 rdx, | 506 rdx, |
523 rax, | 507 rax, |
524 DICTIONARY_CHECK_DONE); | 508 DICTIONARY_CHECK_DONE); |
525 GenerateCheckNonObjectOrLoaded(masm, &slow, rcx); | |
526 __ movq(rax, rcx); | 509 __ movq(rax, rcx); |
527 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 510 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); |
528 __ ret(0); | 511 __ ret(0); |
529 // If the hash field contains an array index pick it out. The assert checks | 512 // If the hash field contains an array index pick it out. The assert checks |
530 // that the constants for the maximum number of digits for an array index | 513 // that the constants for the maximum number of digits for an array index |
531 // cached in the hash field and the number of bits reserved for it does not | 514 // cached in the hash field and the number of bits reserved for it does not |
532 // conflict. | 515 // conflict. |
533 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 516 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
534 (1 << String::kArrayIndexValueBits)); | 517 (1 << String::kArrayIndexValueBits)); |
535 __ bind(&index_string); | 518 __ bind(&index_string); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 // Search dictionary - put result in register rdx. | 1207 // Search dictionary - put result in register rdx. |
1225 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); | 1208 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); |
1226 | 1209 |
1227 // Move the result to register rdi and check that it isn't a smi. | 1210 // Move the result to register rdi and check that it isn't a smi. |
1228 __ movq(rdi, rdx); | 1211 __ movq(rdi, rdx); |
1229 __ JumpIfSmi(rdx, miss); | 1212 __ JumpIfSmi(rdx, miss); |
1230 | 1213 |
1231 // Check that the value is a JavaScript function. | 1214 // Check that the value is a JavaScript function. |
1232 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx); | 1215 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rdx); |
1233 __ j(not_equal, miss); | 1216 __ j(not_equal, miss); |
1234 // Check that the function has been loaded. | |
1235 __ testb(FieldOperand(rdx, Map::kBitField2Offset), | |
1236 Immediate(1 << Map::kNeedsLoading)); | |
1237 __ j(not_zero, miss); | |
1238 | 1217 |
1239 // Patch the receiver with the global proxy if necessary. | 1218 // Patch the receiver with the global proxy if necessary. |
1240 if (is_global_object) { | 1219 if (is_global_object) { |
1241 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1220 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1242 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1221 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
1243 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1222 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
1244 } | 1223 } |
1245 | 1224 |
1246 // Invoke the function. | 1225 // Invoke the function. |
1247 ParameterCount actual(argc); | 1226 ParameterCount actual(argc); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 __ j(equal, &global); | 1403 __ j(equal, &global); |
1425 | 1404 |
1426 // Check for non-global object that requires access check. | 1405 // Check for non-global object that requires access check. |
1427 __ testl(FieldOperand(rbx, Map::kBitFieldOffset), | 1406 __ testl(FieldOperand(rbx, Map::kBitFieldOffset), |
1428 Immediate(1 << Map::kIsAccessCheckNeeded)); | 1407 Immediate(1 << Map::kIsAccessCheckNeeded)); |
1429 __ j(not_zero, &miss); | 1408 __ j(not_zero, &miss); |
1430 | 1409 |
1431 // Search the dictionary placing the result in rax. | 1410 // Search the dictionary placing the result in rax. |
1432 __ bind(&probe); | 1411 __ bind(&probe); |
1433 GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx, CHECK_DICTIONARY); | 1412 GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx, CHECK_DICTIONARY); |
1434 GenerateCheckNonObjectOrLoaded(masm, &miss, rax); | |
1435 __ ret(0); | 1413 __ ret(0); |
1436 | 1414 |
1437 // Global object access: Check access rights. | 1415 // Global object access: Check access rights. |
1438 __ bind(&global); | 1416 __ bind(&global); |
1439 __ CheckAccessGlobalProxy(rax, rdx, &miss); | 1417 __ CheckAccessGlobalProxy(rax, rdx, &miss); |
1440 __ jmp(&probe); | 1418 __ jmp(&probe); |
1441 | 1419 |
1442 // Cache miss: Restore receiver from stack and jump to runtime. | 1420 // Cache miss: Restore receiver from stack and jump to runtime. |
1443 __ bind(&miss); | 1421 __ bind(&miss); |
1444 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 1422 __ movq(rax, Operand(rsp, 1 * kPointerSize)); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 __ bind(&miss); | 1554 __ bind(&miss); |
1577 | 1555 |
1578 GenerateMiss(masm); | 1556 GenerateMiss(masm); |
1579 } | 1557 } |
1580 | 1558 |
1581 | 1559 |
1582 #undef __ | 1560 #undef __ |
1583 | 1561 |
1584 | 1562 |
1585 } } // namespace v8::internal | 1563 } } // namespace v8::internal |
OLD | NEW |