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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 // Check that the value is a JavaScript function, fetching its map into eax. | 937 // Check that the value is a JavaScript function, fetching its map into eax. |
938 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); | 938 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax); |
939 __ j(not_equal, miss); | 939 __ j(not_equal, miss); |
940 | 940 |
941 // Invoke the function. | 941 // Invoke the function. |
942 ParameterCount actual(argc); | 942 ParameterCount actual(argc); |
943 __ InvokeFunction(edi, actual, JUMP_FUNCTION, | 943 __ InvokeFunction(edi, actual, JUMP_FUNCTION, |
944 NullCallWrapper(), CALL_AS_METHOD); | 944 NullCallWrapper(), CALL_AS_METHOD); |
945 } | 945 } |
946 | 946 |
| 947 |
947 // The generated code falls through if the call should be handled by runtime. | 948 // The generated code falls through if the call should be handled by runtime. |
948 static void GenerateCallNormal(MacroAssembler* masm, int argc) { | 949 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) { |
949 // ----------- S t a t e ------------- | 950 // ----------- S t a t e ------------- |
950 // -- ecx : name | 951 // -- ecx : name |
951 // -- esp[0] : return address | 952 // -- esp[0] : return address |
952 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 953 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
953 // -- ... | 954 // -- ... |
954 // -- esp[(argc + 1) * 4] : receiver | 955 // -- esp[(argc + 1) * 4] : receiver |
955 // ----------------------------------- | 956 // ----------------------------------- |
956 Label miss; | 957 Label miss; |
957 | 958 |
958 // Get the receiver of the function from the stack; 1 ~ return address. | 959 // Get the receiver of the function from the stack; 1 ~ return address. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 // ----------------------------------- | 1054 // ----------------------------------- |
1054 | 1055 |
1055 // Get the receiver of the function from the stack; 1 ~ return address. | 1056 // Get the receiver of the function from the stack; 1 ~ return address. |
1056 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1057 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
1057 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); | 1058 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); |
1058 | 1059 |
1059 GenerateMiss(masm, argc, extra_ic_state); | 1060 GenerateMiss(masm, argc, extra_ic_state); |
1060 } | 1061 } |
1061 | 1062 |
1062 | 1063 |
1063 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { | |
1064 // ----------- S t a t e ------------- | |
1065 // -- ecx : name | |
1066 // -- esp[0] : return address | |
1067 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | |
1068 // -- ... | |
1069 // -- esp[(argc + 1) * 4] : receiver | |
1070 // ----------------------------------- | |
1071 | |
1072 GenerateCallNormal(masm, argc); | |
1073 GenerateMiss(masm, argc, Code::kNoExtraICState); | |
1074 } | |
1075 | |
1076 | |
1077 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { | 1064 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
1078 // ----------- S t a t e ------------- | 1065 // ----------- S t a t e ------------- |
1079 // -- ecx : name | 1066 // -- ecx : name |
1080 // -- esp[0] : return address | 1067 // -- esp[0] : return address |
1081 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1068 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1082 // -- ... | 1069 // -- ... |
1083 // -- esp[(argc + 1) * 4] : receiver | 1070 // -- esp[(argc + 1) * 4] : receiver |
1084 // ----------------------------------- | 1071 // ----------------------------------- |
1085 | 1072 |
1086 // Get the receiver of the function from the stack; 1 ~ return address. | 1073 // Get the receiver of the function from the stack; 1 ~ return address. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1218 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1232 // -- ... | 1219 // -- ... |
1233 // -- esp[(argc + 1) * 4] : receiver | 1220 // -- esp[(argc + 1) * 4] : receiver |
1234 // ----------------------------------- | 1221 // ----------------------------------- |
1235 | 1222 |
1236 // Check if the name is a string. | 1223 // Check if the name is a string. |
1237 Label miss; | 1224 Label miss; |
1238 __ JumpIfSmi(ecx, &miss); | 1225 __ JumpIfSmi(ecx, &miss); |
1239 Condition cond = masm->IsObjectStringType(ecx, eax, eax); | 1226 Condition cond = masm->IsObjectStringType(ecx, eax, eax); |
1240 __ j(NegateCondition(cond), &miss); | 1227 __ j(NegateCondition(cond), &miss); |
1241 GenerateCallNormal(masm, argc); | 1228 CallICBase::GenerateNormal(masm, argc); |
1242 __ bind(&miss); | 1229 __ bind(&miss); |
1243 GenerateMiss(masm, argc); | 1230 GenerateMiss(masm, argc); |
1244 } | 1231 } |
1245 | 1232 |
1246 | 1233 |
1247 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 1234 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
1248 // ----------- S t a t e ------------- | 1235 // ----------- S t a t e ------------- |
1249 // -- eax : receiver | 1236 // -- eax : receiver |
1250 // -- ecx : name | 1237 // -- ecx : name |
1251 // -- esp[0] : return address | 1238 // -- esp[0] : return address |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1678 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1692 ? not_zero | 1679 ? not_zero |
1693 : zero; | 1680 : zero; |
1694 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1681 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1695 } | 1682 } |
1696 | 1683 |
1697 | 1684 |
1698 } } // namespace v8::internal | 1685 } } // namespace v8::internal |
1699 | 1686 |
1700 #endif // V8_TARGET_ARCH_IA32 | 1687 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |