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