| 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" |
| 11 #include "src/ic/ic-compiler.h" |
| 11 #include "src/ic/stub-cache.h" | 12 #include "src/ic/stub-cache.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 // ---------------------------------------------------------------------------- | 17 // ---------------------------------------------------------------------------- |
| 17 // Static IC stub generators. | 18 // Static IC stub generators. |
| 18 // | 19 // |
| 19 | 20 |
| 20 #define __ ACCESS_MASM(masm) | 21 #define __ ACCESS_MASM(masm) |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset)); | 643 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset)); |
| 643 // Check array bounds. | 644 // Check array bounds. |
| 644 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), key); | 645 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), key); |
| 645 // rbx: FixedArray | 646 // rbx: FixedArray |
| 646 __ j(above, &fast_object); | 647 __ j(above, &fast_object); |
| 647 | 648 |
| 648 // Slow case: call runtime. | 649 // Slow case: call runtime. |
| 649 __ bind(&slow); | 650 __ bind(&slow); |
| 650 __ Integer32ToSmi(key, key); | 651 __ Integer32ToSmi(key, key); |
| 651 __ bind(&slow_with_tagged_index); | 652 __ bind(&slow_with_tagged_index); |
| 652 GenerateRuntimeSetProperty(masm, strict_mode); | 653 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); |
| 653 // Never returns to here. | 654 // Never returns to here. |
| 654 | 655 |
| 655 // Extra capacity case: Check if there is extra capacity to | 656 // Extra capacity case: Check if there is extra capacity to |
| 656 // perform the store and update the length. Used for adding one | 657 // perform the store and update the length. Used for adding one |
| 657 // element to the array by writing to array[array.length]. | 658 // element to the array by writing to array[array.length]. |
| 658 __ bind(&extra); | 659 __ bind(&extra); |
| 659 // receiver is a JSArray. | 660 // receiver is a JSArray. |
| 660 // rbx: receiver's elements array (a FixedArray) | 661 // rbx: receiver's elements array (a FixedArray) |
| 661 // flags: smicompare (receiver.length(), rbx) | 662 // flags: smicompare (receiver.length(), rbx) |
| 662 __ j(not_equal, &slow); // do not leave holes in the array | 663 __ j(not_equal, &slow); // do not leave holes in the array |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 Counters* counters = masm->isolate()->counters(); | 1005 Counters* counters = masm->isolate()->counters(); |
| 1005 __ IncrementCounter(counters->store_normal_hit(), 1); | 1006 __ IncrementCounter(counters->store_normal_hit(), 1); |
| 1006 __ ret(0); | 1007 __ ret(0); |
| 1007 | 1008 |
| 1008 __ bind(&miss); | 1009 __ bind(&miss); |
| 1009 __ IncrementCounter(counters->store_normal_miss(), 1); | 1010 __ IncrementCounter(counters->store_normal_miss(), 1); |
| 1010 GenerateMiss(masm); | 1011 GenerateMiss(masm); |
| 1011 } | 1012 } |
| 1012 | 1013 |
| 1013 | 1014 |
| 1014 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
| 1015 StrictMode strict_mode) { | |
| 1016 // Return address is on the stack. | |
| 1017 DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) && | |
| 1018 !rbx.is(ValueRegister())); | |
| 1019 | |
| 1020 __ PopReturnAddressTo(rbx); | |
| 1021 __ Push(ReceiverRegister()); | |
| 1022 __ Push(NameRegister()); | |
| 1023 __ Push(ValueRegister()); | |
| 1024 __ Push(Smi::FromInt(strict_mode)); | |
| 1025 __ PushReturnAddressFrom(rbx); | |
| 1026 | |
| 1027 // Do tail-call to runtime routine. | |
| 1028 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
| 1029 } | |
| 1030 | |
| 1031 | |
| 1032 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
| 1033 StrictMode strict_mode) { | |
| 1034 // Return address is on the stack. | |
| 1035 DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) && | |
| 1036 !rbx.is(ValueRegister())); | |
| 1037 | |
| 1038 __ PopReturnAddressTo(rbx); | |
| 1039 __ Push(ReceiverRegister()); | |
| 1040 __ Push(NameRegister()); | |
| 1041 __ Push(ValueRegister()); | |
| 1042 __ Push(Smi::FromInt(strict_mode)); // Strict mode. | |
| 1043 __ PushReturnAddressFrom(rbx); | |
| 1044 | |
| 1045 // Do tail-call to runtime routine. | |
| 1046 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
| 1047 } | |
| 1048 | |
| 1049 | |
| 1050 void StoreIC::GenerateSlow(MacroAssembler* masm) { | 1015 void StoreIC::GenerateSlow(MacroAssembler* masm) { |
| 1051 // Return address is on the stack. | 1016 // Return address is on the stack. |
| 1052 StoreIC_PushArgs(masm); | 1017 StoreIC_PushArgs(masm); |
| 1053 | 1018 |
| 1054 // Do tail-call to runtime routine. | 1019 // Do tail-call to runtime routine. |
| 1055 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); | 1020 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); |
| 1056 __ TailCallExternalReference(ref, 3, 1); | 1021 __ TailCallExternalReference(ref, 3, 1); |
| 1057 } | 1022 } |
| 1058 | 1023 |
| 1059 | 1024 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 Condition cc = | 1110 Condition cc = |
| 1146 (check == ENABLE_INLINED_SMI_CHECK) | 1111 (check == ENABLE_INLINED_SMI_CHECK) |
| 1147 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1112 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1148 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1113 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1149 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1114 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1150 } | 1115 } |
| 1151 } | 1116 } |
| 1152 } // namespace v8::internal | 1117 } // namespace v8::internal |
| 1153 | 1118 |
| 1154 #endif // V8_TARGET_ARCH_X64 | 1119 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |