OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 945 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, |
946 &slow, kDontCheckMap, kIncrementLength); | 946 &slow, kDontCheckMap, kIncrementLength); |
947 } | 947 } |
948 | 948 |
949 | 949 |
950 // The generated code does not accept smi keys. | 950 // The generated code does not accept smi keys. |
951 // The generated code falls through if both probes miss. | 951 // The generated code falls through if both probes miss. |
952 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 952 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
953 int argc, | 953 int argc, |
954 Code::Kind kind, | 954 Code::Kind kind, |
955 Code::ExtraICState extra_state) { | 955 ExtraICState extra_state) { |
956 // ----------- S t a t e ------------- | 956 // ----------- S t a t e ------------- |
957 // -- ecx : name | 957 // -- ecx : name |
958 // -- edx : receiver | 958 // -- edx : receiver |
959 // ----------------------------------- | 959 // ----------------------------------- |
960 Label number, non_number, non_string, boolean, probe, miss; | 960 Label number, non_number, non_string, boolean, probe, miss; |
961 | 961 |
962 // Probe the stub cache. | 962 // Probe the stub cache. |
963 Code::Flags flags = Code::ComputeFlags(kind, | 963 Code::Flags flags = Code::ComputeFlags(kind, |
964 MONOMORPHIC, | 964 MONOMORPHIC, |
965 extra_state, | 965 extra_state, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); | 1054 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); |
1055 GenerateFunctionTailCall(masm, argc, &miss); | 1055 GenerateFunctionTailCall(masm, argc, &miss); |
1056 | 1056 |
1057 __ bind(&miss); | 1057 __ bind(&miss); |
1058 } | 1058 } |
1059 | 1059 |
1060 | 1060 |
1061 void CallICBase::GenerateMiss(MacroAssembler* masm, | 1061 void CallICBase::GenerateMiss(MacroAssembler* masm, |
1062 int argc, | 1062 int argc, |
1063 IC::UtilityId id, | 1063 IC::UtilityId id, |
1064 Code::ExtraICState extra_state) { | 1064 ExtraICState extra_state) { |
1065 // ----------- S t a t e ------------- | 1065 // ----------- S t a t e ------------- |
1066 // -- ecx : name | 1066 // -- ecx : name |
1067 // -- esp[0] : return address | 1067 // -- esp[0] : return address |
1068 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1068 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1069 // -- ... | 1069 // -- ... |
1070 // -- esp[(argc + 1) * 4] : receiver | 1070 // -- esp[(argc + 1) * 4] : receiver |
1071 // ----------------------------------- | 1071 // ----------------------------------- |
1072 | 1072 |
1073 Counters* counters = masm->isolate()->counters(); | 1073 Counters* counters = masm->isolate()->counters(); |
1074 if (id == IC::kCallIC_Miss) { | 1074 if (id == IC::kCallIC_Miss) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 __ InvokeFunction(edi, | 1125 __ InvokeFunction(edi, |
1126 actual, | 1126 actual, |
1127 JUMP_FUNCTION, | 1127 JUMP_FUNCTION, |
1128 NullCallWrapper(), | 1128 NullCallWrapper(), |
1129 call_kind); | 1129 call_kind); |
1130 } | 1130 } |
1131 | 1131 |
1132 | 1132 |
1133 void CallIC::GenerateMegamorphic(MacroAssembler* masm, | 1133 void CallIC::GenerateMegamorphic(MacroAssembler* masm, |
1134 int argc, | 1134 int argc, |
1135 Code::ExtraICState extra_state) { | 1135 ExtraICState extra_state) { |
1136 // ----------- S t a t e ------------- | 1136 // ----------- S t a t e ------------- |
1137 // -- ecx : name | 1137 // -- ecx : name |
1138 // -- esp[0] : return address | 1138 // -- esp[0] : return address |
1139 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1139 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1140 // -- ... | 1140 // -- ... |
1141 // -- esp[(argc + 1) * 4] : receiver | 1141 // -- esp[(argc + 1) * 4] : receiver |
1142 // ----------------------------------- | 1142 // ----------------------------------- |
1143 | 1143 |
1144 // Get the receiver of the function from the stack; 1 ~ return address. | 1144 // Get the receiver of the function from the stack; 1 ~ return address. |
1145 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1145 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 &lookup_monomorphic_cache, | 1242 &lookup_monomorphic_cache, |
1243 DONT_DO_SMI_CHECK); | 1243 DONT_DO_SMI_CHECK); |
1244 | 1244 |
1245 GenerateDictionaryLoad(masm, &slow_load, ebx, ecx, eax, edi, edi); | 1245 GenerateDictionaryLoad(masm, &slow_load, ebx, ecx, eax, edi, edi); |
1246 __ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1); | 1246 __ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1); |
1247 __ jmp(&do_call); | 1247 __ jmp(&do_call); |
1248 | 1248 |
1249 __ bind(&lookup_monomorphic_cache); | 1249 __ bind(&lookup_monomorphic_cache); |
1250 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1); | 1250 __ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1); |
1251 CallICBase::GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC, | 1251 CallICBase::GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC, |
1252 Code::kNoExtraICState); | 1252 kNoExtraICState); |
1253 // Fall through on miss. | 1253 // Fall through on miss. |
1254 | 1254 |
1255 __ bind(&slow_call); | 1255 __ bind(&slow_call); |
1256 // This branch is taken if: | 1256 // This branch is taken if: |
1257 // - the receiver requires boxing or access check, | 1257 // - the receiver requires boxing or access check, |
1258 // - the key is neither smi nor a unique name, | 1258 // - the key is neither smi nor a unique name, |
1259 // - the value loaded is not a function, | 1259 // - the value loaded is not a function, |
1260 // - there is hope that the runtime will create a monomorphic call stub | 1260 // - there is hope that the runtime will create a monomorphic call stub |
1261 // that will get fetched next time. | 1261 // that will get fetched next time. |
1262 __ IncrementCounter(counters->keyed_call_generic_slow(), 1); | 1262 __ IncrementCounter(counters->keyed_call_generic_slow(), 1); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 | 1320 |
1321 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 1321 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
1322 // ----------- S t a t e ------------- | 1322 // ----------- S t a t e ------------- |
1323 // -- ecx : name | 1323 // -- ecx : name |
1324 // -- edx : receiver | 1324 // -- edx : receiver |
1325 // -- esp[0] : return address | 1325 // -- esp[0] : return address |
1326 // ----------------------------------- | 1326 // ----------------------------------- |
1327 | 1327 |
1328 // Probe the stub cache. | 1328 // Probe the stub cache. |
1329 Code::Flags flags = Code::ComputeFlags( | 1329 Code::Flags flags = Code::ComputeFlags( |
1330 Code::HANDLER, MONOMORPHIC, Code::kNoExtraICState, | 1330 Code::HANDLER, MONOMORPHIC, kNoExtraICState, |
1331 Code::NORMAL, Code::LOAD_IC); | 1331 Code::NORMAL, Code::LOAD_IC); |
1332 masm->isolate()->stub_cache()->GenerateProbe( | 1332 masm->isolate()->stub_cache()->GenerateProbe( |
1333 masm, flags, edx, ecx, ebx, eax); | 1333 masm, flags, edx, ecx, ebx, eax); |
1334 | 1334 |
1335 // Cache miss: Jump to runtime. | 1335 // Cache miss: Jump to runtime. |
1336 GenerateMiss(masm); | 1336 GenerateMiss(masm); |
1337 } | 1337 } |
1338 | 1338 |
1339 | 1339 |
1340 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 1340 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1677 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1678 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1678 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1679 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1679 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1680 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1680 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1681 } | 1681 } |
1682 | 1682 |
1683 | 1683 |
1684 } } // namespace v8::internal | 1684 } } // namespace v8::internal |
1685 | 1685 |
1686 #endif // V8_TARGET_ARCH_IA32 | 1686 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |