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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 Counters* counters = masm->isolate()->counters(); | 921 Counters* counters = masm->isolate()->counters(); |
922 if (id == IC::kCallIC_Miss) { | 922 if (id == IC::kCallIC_Miss) { |
923 __ IncrementCounter(counters->call_miss(), 1); | 923 __ IncrementCounter(counters->call_miss(), 1); |
924 } else { | 924 } else { |
925 __ IncrementCounter(counters->keyed_call_miss(), 1); | 925 __ IncrementCounter(counters->keyed_call_miss(), 1); |
926 } | 926 } |
927 | 927 |
928 // Get the receiver of the function from the stack; 1 ~ return address. | 928 // Get the receiver of the function from the stack; 1 ~ return address. |
929 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 929 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
930 | 930 |
931 // Enter an internal frame. | 931 { |
932 __ EnterInternalFrame(); | 932 FrameScope scope(masm, StackFrame::INTERNAL); |
933 | 933 |
934 // Push the receiver and the name of the function. | 934 // Push the receiver and the name of the function. |
935 __ push(edx); | 935 __ push(edx); |
936 __ push(ecx); | 936 __ push(ecx); |
937 | 937 |
938 // Call the entry. | 938 // Call the entry. |
939 CEntryStub stub(1); | 939 CEntryStub stub(1); |
940 __ mov(eax, Immediate(2)); | 940 __ mov(eax, Immediate(2)); |
941 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); | 941 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); |
942 __ CallStub(&stub); | 942 __ CallStub(&stub); |
943 | 943 |
944 // Move result to edi and exit the internal frame. | 944 // Move result to edi and exit the internal frame. |
945 __ mov(edi, eax); | 945 __ mov(edi, eax); |
946 __ LeaveInternalFrame(); | 946 } |
947 | 947 |
948 // Check if the receiver is a global object of some sort. | 948 // Check if the receiver is a global object of some sort. |
949 // This can happen only for regular CallIC but not KeyedCallIC. | 949 // This can happen only for regular CallIC but not KeyedCallIC. |
950 if (id == IC::kCallIC_Miss) { | 950 if (id == IC::kCallIC_Miss) { |
951 Label invoke, global; | 951 Label invoke, global; |
952 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // receiver | 952 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // receiver |
953 __ test(edx, Immediate(kSmiTagMask)); | 953 __ test(edx, Immediate(kSmiTagMask)); |
954 __ j(zero, &invoke, Label::kNear); | 954 __ j(zero, &invoke, Label::kNear); |
955 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 955 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
956 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 956 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); | 1083 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); |
1084 __ jmp(&do_call); | 1084 __ jmp(&do_call); |
1085 | 1085 |
1086 __ bind(&slow_reload_receiver); | 1086 __ bind(&slow_reload_receiver); |
1087 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1087 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
1088 | 1088 |
1089 __ bind(&slow_load); | 1089 __ bind(&slow_load); |
1090 // This branch is taken when calling KeyedCallIC_Miss is neither required | 1090 // This branch is taken when calling KeyedCallIC_Miss is neither required |
1091 // nor beneficial. | 1091 // nor beneficial. |
1092 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); | 1092 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); |
1093 __ EnterInternalFrame(); | 1093 |
1094 __ push(ecx); // save the key | 1094 { |
1095 __ push(edx); // pass the receiver | 1095 FrameScope scope(masm, StackFrame::INTERNAL); |
1096 __ push(ecx); // pass the key | 1096 __ push(ecx); // save the key |
1097 __ CallRuntime(Runtime::kKeyedGetProperty, 2); | 1097 __ push(edx); // pass the receiver |
1098 __ pop(ecx); // restore the key | 1098 __ push(ecx); // pass the key |
1099 __ LeaveInternalFrame(); | 1099 __ CallRuntime(Runtime::kKeyedGetProperty, 2); |
| 1100 __ pop(ecx); // restore the key |
| 1101 // Leave the internal frame. |
| 1102 } |
| 1103 |
1100 __ mov(edi, eax); | 1104 __ mov(edi, eax); |
1101 __ jmp(&do_call); | 1105 __ jmp(&do_call); |
1102 | 1106 |
1103 __ bind(&check_string); | 1107 __ bind(&check_string); |
1104 GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow_call); | 1108 GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow_call); |
1105 | 1109 |
1106 // The key is known to be a symbol. | 1110 // The key is known to be a symbol. |
1107 // If the receiver is a regular JS object with slow properties then do | 1111 // If the receiver is a regular JS object with slow properties then do |
1108 // a quick inline probe of the receiver's dictionary. | 1112 // a quick inline probe of the receiver's dictionary. |
1109 // Otherwise do the monomorphic cache probe. | 1113 // Otherwise do the monomorphic cache probe. |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1593 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1590 ? not_zero | 1594 ? not_zero |
1591 : zero; | 1595 : zero; |
1592 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1596 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1593 } | 1597 } |
1594 | 1598 |
1595 | 1599 |
1596 } } // namespace v8::internal | 1600 } } // namespace v8::internal |
1597 | 1601 |
1598 #endif // V8_TARGET_ARCH_IA32 | 1602 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |