OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 962 |
963 // eax: elements | 963 // eax: elements |
964 // Search the dictionary placing the result in edi. | 964 // Search the dictionary placing the result in edi. |
965 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); | 965 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); |
966 GenerateFunctionTailCall(masm, argc, &miss); | 966 GenerateFunctionTailCall(masm, argc, &miss); |
967 | 967 |
968 __ bind(&miss); | 968 __ bind(&miss); |
969 } | 969 } |
970 | 970 |
971 | 971 |
972 static void GenerateCallMiss(MacroAssembler* masm, | 972 void CallICBase::GenerateMiss(MacroAssembler* masm, |
973 int argc, | 973 int argc, |
974 IC::UtilityId id, | 974 IC::UtilityId id, |
975 Code::ExtraICState extra_ic_state) { | 975 Code::ExtraICState extra_state) { |
976 // ----------- S t a t e ------------- | 976 // ----------- S t a t e ------------- |
977 // -- ecx : name | 977 // -- ecx : name |
978 // -- esp[0] : return address | 978 // -- esp[0] : return address |
979 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 979 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
980 // -- ... | 980 // -- ... |
981 // -- esp[(argc + 1) * 4] : receiver | 981 // -- esp[(argc + 1) * 4] : receiver |
982 // ----------------------------------- | 982 // ----------------------------------- |
983 | 983 |
984 Counters* counters = masm->isolate()->counters(); | 984 Counters* counters = masm->isolate()->counters(); |
985 if (id == IC::kCallIC_Miss) { | 985 if (id == IC::kCallIC_Miss) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 __ j(not_equal, &invoke, Label::kNear); | 1022 __ j(not_equal, &invoke, Label::kNear); |
1023 | 1023 |
1024 // Patch the receiver on the stack. | 1024 // Patch the receiver on the stack. |
1025 __ bind(&global); | 1025 __ bind(&global); |
1026 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1026 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
1027 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1027 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
1028 __ bind(&invoke); | 1028 __ bind(&invoke); |
1029 } | 1029 } |
1030 | 1030 |
1031 // Invoke the function. | 1031 // Invoke the function. |
1032 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) | 1032 CallKind call_kind = CallICBase::Contextual::decode(extra_state) |
1033 ? CALL_AS_FUNCTION | 1033 ? CALL_AS_FUNCTION |
1034 : CALL_AS_METHOD; | 1034 : CALL_AS_METHOD; |
1035 ParameterCount actual(argc); | 1035 ParameterCount actual(argc); |
1036 __ InvokeFunction(edi, | 1036 __ InvokeFunction(edi, |
1037 actual, | 1037 actual, |
1038 JUMP_FUNCTION, | 1038 JUMP_FUNCTION, |
1039 NullCallWrapper(), | 1039 NullCallWrapper(), |
1040 call_kind); | 1040 call_kind); |
1041 } | 1041 } |
1042 | 1042 |
(...skipping 24 matching lines...) Expand all Loading... |
1067 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1067 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1068 // -- ... | 1068 // -- ... |
1069 // -- esp[(argc + 1) * 4] : receiver | 1069 // -- esp[(argc + 1) * 4] : receiver |
1070 // ----------------------------------- | 1070 // ----------------------------------- |
1071 | 1071 |
1072 GenerateCallNormal(masm, argc); | 1072 GenerateCallNormal(masm, argc); |
1073 GenerateMiss(masm, argc, Code::kNoExtraICState); | 1073 GenerateMiss(masm, argc, Code::kNoExtraICState); |
1074 } | 1074 } |
1075 | 1075 |
1076 | 1076 |
1077 void CallIC::GenerateMiss(MacroAssembler* masm, | |
1078 int argc, | |
1079 Code::ExtraICState extra_ic_state) { | |
1080 // ----------- S t a t e ------------- | |
1081 // -- ecx : name | |
1082 // -- esp[0] : return address | |
1083 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | |
1084 // -- ... | |
1085 // -- esp[(argc + 1) * 4] : receiver | |
1086 // ----------------------------------- | |
1087 | |
1088 GenerateCallMiss(masm, argc, IC::kCallIC_Miss, extra_ic_state); | |
1089 } | |
1090 | |
1091 | |
1092 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { | 1077 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
1093 // ----------- S t a t e ------------- | 1078 // ----------- S t a t e ------------- |
1094 // -- ecx : name | 1079 // -- ecx : name |
1095 // -- esp[0] : return address | 1080 // -- esp[0] : return address |
1096 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1081 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1097 // -- ... | 1082 // -- ... |
1098 // -- esp[(argc + 1) * 4] : receiver | 1083 // -- esp[(argc + 1) * 4] : receiver |
1099 // ----------------------------------- | 1084 // ----------------------------------- |
1100 | 1085 |
1101 // Get the receiver of the function from the stack; 1 ~ return address. | 1086 // Get the receiver of the function from the stack; 1 ~ return address. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 Label miss; | 1237 Label miss; |
1253 __ JumpIfSmi(ecx, &miss); | 1238 __ JumpIfSmi(ecx, &miss); |
1254 Condition cond = masm->IsObjectStringType(ecx, eax, eax); | 1239 Condition cond = masm->IsObjectStringType(ecx, eax, eax); |
1255 __ j(NegateCondition(cond), &miss); | 1240 __ j(NegateCondition(cond), &miss); |
1256 GenerateCallNormal(masm, argc); | 1241 GenerateCallNormal(masm, argc); |
1257 __ bind(&miss); | 1242 __ bind(&miss); |
1258 GenerateMiss(masm, argc); | 1243 GenerateMiss(masm, argc); |
1259 } | 1244 } |
1260 | 1245 |
1261 | 1246 |
1262 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { | |
1263 // ----------- S t a t e ------------- | |
1264 // -- ecx : name | |
1265 // -- esp[0] : return address | |
1266 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | |
1267 // -- ... | |
1268 // -- esp[(argc + 1) * 4] : receiver | |
1269 // ----------------------------------- | |
1270 | |
1271 GenerateCallMiss(masm, argc, IC::kKeyedCallIC_Miss, Code::kNoExtraICState); | |
1272 } | |
1273 | |
1274 | |
1275 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 1247 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
1276 // ----------- S t a t e ------------- | 1248 // ----------- S t a t e ------------- |
1277 // -- eax : receiver | 1249 // -- eax : receiver |
1278 // -- ecx : name | 1250 // -- ecx : name |
1279 // -- esp[0] : return address | 1251 // -- esp[0] : return address |
1280 // ----------------------------------- | 1252 // ----------------------------------- |
1281 | 1253 |
1282 // Probe the stub cache. | 1254 // Probe the stub cache. |
1283 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, MONOMORPHIC); | 1255 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, MONOMORPHIC); |
1284 Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, eax, ecx, ebx, | 1256 Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, eax, ecx, ebx, |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1691 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1720 ? not_zero | 1692 ? not_zero |
1721 : zero; | 1693 : zero; |
1722 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1694 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1723 } | 1695 } |
1724 | 1696 |
1725 | 1697 |
1726 } } // namespace v8::internal | 1698 } } // namespace v8::internal |
1727 | 1699 |
1728 #endif // V8_TARGET_ARCH_IA32 | 1700 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |