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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // Object case: Check key against length in the elements array. | 771 // Object case: Check key against length in the elements array. |
771 // Key is a smi. | 772 // Key is a smi. |
772 // edi: receiver map | 773 // edi: receiver map |
773 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); | 774 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); |
774 // Check array bounds. Both the key and the length of FixedArray are smis. | 775 // Check array bounds. Both the key and the length of FixedArray are smis. |
775 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset)); | 776 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset)); |
776 __ j(below, &fast_object); | 777 __ j(below, &fast_object); |
777 | 778 |
778 // Slow case: call runtime. | 779 // Slow case: call runtime. |
779 __ bind(&slow); | 780 __ bind(&slow); |
780 GenerateRuntimeSetProperty(masm, strict_mode); | 781 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); |
781 | 782 |
782 // Extra capacity case: Check if there is extra capacity to | 783 // Extra capacity case: Check if there is extra capacity to |
783 // perform the store and update the length. Used for adding one | 784 // perform the store and update the length. Used for adding one |
784 // element to the array by writing to array[array.length]. | 785 // element to the array by writing to array[array.length]. |
785 __ bind(&extra); | 786 __ bind(&extra); |
786 // receiver is a JSArray. | 787 // receiver is a JSArray. |
787 // key is a smi. | 788 // key is a smi. |
788 // ebx: receiver->elements, a FixedArray | 789 // ebx: receiver->elements, a FixedArray |
789 // edi: receiver map | 790 // edi: receiver map |
790 // flags: compare (key, receiver.length()) | 791 // flags: compare (key, receiver.length()) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 __ IncrementCounter(counters->store_normal_hit(), 1); | 1000 __ IncrementCounter(counters->store_normal_hit(), 1); |
1000 __ ret(0); | 1001 __ ret(0); |
1001 | 1002 |
1002 __ bind(&restore_miss); | 1003 __ bind(&restore_miss); |
1003 __ pop(receiver); | 1004 __ pop(receiver); |
1004 __ IncrementCounter(counters->store_normal_miss(), 1); | 1005 __ IncrementCounter(counters->store_normal_miss(), 1); |
1005 GenerateMiss(masm); | 1006 GenerateMiss(masm); |
1006 } | 1007 } |
1007 | 1008 |
1008 | 1009 |
1009 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
1010 StrictMode strict_mode) { | |
1011 // Return address is on the stack. | |
1012 DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) && | |
1013 !ebx.is(ValueRegister())); | |
1014 __ pop(ebx); | |
1015 __ push(ReceiverRegister()); | |
1016 __ push(NameRegister()); | |
1017 __ push(ValueRegister()); | |
1018 __ push(Immediate(Smi::FromInt(strict_mode))); | |
1019 __ push(ebx); // return address | |
1020 | |
1021 // Do tail-call to runtime routine. | |
1022 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
1023 } | |
1024 | |
1025 | |
1026 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
1027 StrictMode strict_mode) { | |
1028 // Return address is on the stack. | |
1029 DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) && | |
1030 !ebx.is(ValueRegister())); | |
1031 __ pop(ebx); | |
1032 __ push(ReceiverRegister()); | |
1033 __ push(NameRegister()); | |
1034 __ push(ValueRegister()); | |
1035 __ push(Immediate(Smi::FromInt(strict_mode))); | |
1036 __ push(ebx); // return address | |
1037 | |
1038 // Do tail-call to runtime routine. | |
1039 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
1040 } | |
1041 | |
1042 | |
1043 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 1010 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
1044 // Return address is on the stack. | 1011 // Return address is on the stack. |
1045 StoreIC_PushArgs(masm); | 1012 StoreIC_PushArgs(masm); |
1046 | 1013 |
1047 // Do tail-call to runtime routine. | 1014 // Do tail-call to runtime routine. |
1048 ExternalReference ref = | 1015 ExternalReference ref = |
1049 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | 1016 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
1050 __ TailCallExternalReference(ref, 3, 1); | 1017 __ TailCallExternalReference(ref, 3, 1); |
1051 } | 1018 } |
1052 | 1019 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 Condition cc = | 1105 Condition cc = |
1139 (check == ENABLE_INLINED_SMI_CHECK) | 1106 (check == ENABLE_INLINED_SMI_CHECK) |
1140 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1107 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1141 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1108 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1142 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1109 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1143 } | 1110 } |
1144 } | 1111 } |
1145 } // namespace v8::internal | 1112 } // namespace v8::internal |
1146 | 1113 |
1147 #endif // V8_TARGET_ARCH_IA32 | 1114 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |