| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax); | 396 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax); |
| 397 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); | 397 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); |
| 398 __ ret(0); | 398 __ ret(0); |
| 399 | 399 |
| 400 __ bind(&index_name); | 400 __ bind(&index_name); |
| 401 __ IndexFromHash(rbx, key); | 401 __ IndexFromHash(rbx, key); |
| 402 __ jmp(&index_smi); | 402 __ jmp(&index_smi); |
| 403 } | 403 } |
| 404 | 404 |
| 405 | 405 |
| 406 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
| 407 // Return address is on the stack. |
| 408 Label slow; |
| 409 |
| 410 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 411 Register key = LoadDescriptor::NameRegister(); |
| 412 Register scratch = rax; |
| 413 DCHECK(!scratch.is(receiver) && !scratch.is(key)); |
| 414 |
| 415 // Check that the receiver isn't a smi. |
| 416 __ JumpIfSmi(receiver, &slow); |
| 417 |
| 418 // Check that the key is an array index, that is Uint32. |
| 419 STATIC_ASSERT(kSmiValueSize <= 32); |
| 420 __ JumpUnlessNonNegativeSmi(key, &slow); |
| 421 |
| 422 // Get the map of the receiver. |
| 423 __ movp(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 424 |
| 425 // Check that it has indexed interceptor and access checks |
| 426 // are not enabled for this object. |
| 427 __ movb(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); |
| 428 __ andb(scratch, Immediate(kSlowCaseBitFieldMask)); |
| 429 __ cmpb(scratch, Immediate(1 << Map::kHasIndexedInterceptor)); |
| 430 __ j(not_zero, &slow); |
| 431 |
| 432 // Everything is fine, call runtime. |
| 433 __ PopReturnAddressTo(scratch); |
| 434 __ Push(receiver); // receiver |
| 435 __ Push(key); // key |
| 436 __ PushReturnAddressFrom(scratch); |
| 437 |
| 438 // Perform tail call to the entry. |
| 439 __ TailCallExternalReference( |
| 440 ExternalReference(IC_Utility(IC::kLoadElementWithInterceptor), |
| 441 masm->isolate()), |
| 442 2, 1); |
| 443 |
| 444 __ bind(&slow); |
| 445 GenerateMiss(masm); |
| 446 } |
| 447 |
| 448 |
| 406 static void KeyedStoreGenerateMegamorphicHelper( | 449 static void KeyedStoreGenerateMegamorphicHelper( |
| 407 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 450 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
| 408 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { | 451 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { |
| 409 Label transition_smi_elements; | 452 Label transition_smi_elements; |
| 410 Label finish_object_store, non_double_value, transition_double_elements; | 453 Label finish_object_store, non_double_value, transition_double_elements; |
| 411 Label fast_double_without_map_check; | 454 Label fast_double_without_map_check; |
| 412 Register receiver = StoreDescriptor::ReceiverRegister(); | 455 Register receiver = StoreDescriptor::ReceiverRegister(); |
| 413 Register key = StoreDescriptor::NameRegister(); | 456 Register key = StoreDescriptor::NameRegister(); |
| 414 Register value = StoreDescriptor::ValueRegister(); | 457 Register value = StoreDescriptor::ValueRegister(); |
| 415 DCHECK(receiver.is(rdx)); | 458 DCHECK(receiver.is(rdx)); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 Condition cc = | 1013 Condition cc = |
| 971 (check == ENABLE_INLINED_SMI_CHECK) | 1014 (check == ENABLE_INLINED_SMI_CHECK) |
| 972 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1015 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 973 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1016 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 974 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1017 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 975 } | 1018 } |
| 976 } | 1019 } |
| 977 } // namespace v8::internal | 1020 } // namespace v8::internal |
| 978 | 1021 |
| 979 #endif // V8_TARGET_ARCH_X64 | 1022 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |