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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 Counters* counters = masm->isolate()->counters(); | 944 Counters* counters = masm->isolate()->counters(); |
945 if (id == IC::kCallIC_Miss) { | 945 if (id == IC::kCallIC_Miss) { |
946 __ IncrementCounter(counters->call_miss(), 1); | 946 __ IncrementCounter(counters->call_miss(), 1); |
947 } else { | 947 } else { |
948 __ IncrementCounter(counters->keyed_call_miss(), 1); | 948 __ IncrementCounter(counters->keyed_call_miss(), 1); |
949 } | 949 } |
950 | 950 |
951 // Get the receiver of the function from the stack; 1 ~ return address. | 951 // Get the receiver of the function from the stack; 1 ~ return address. |
952 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 952 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
953 | 953 |
954 // Enter an internal frame. | 954 { |
955 __ EnterInternalFrame(); | 955 FrameScope scope(masm, StackFrame::INTERNAL); |
956 | 956 |
957 // Push the receiver and the name of the function. | 957 // Push the receiver and the name of the function. |
958 __ push(edx); | 958 __ push(edx); |
959 __ push(ecx); | 959 __ push(ecx); |
960 | 960 |
961 // Call the entry. | 961 // Call the entry. |
962 CEntryStub stub(1); | 962 CEntryStub stub(1); |
963 __ mov(eax, Immediate(2)); | 963 __ mov(eax, Immediate(2)); |
964 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); | 964 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate()))); |
965 __ CallStub(&stub); | 965 __ CallStub(&stub); |
966 | 966 |
967 // Move result to edi and exit the internal frame. | 967 // Move result to edi and exit the internal frame. |
968 __ mov(edi, eax); | 968 __ mov(edi, eax); |
969 __ LeaveInternalFrame(); | 969 } |
970 | 970 |
971 // Check if the receiver is a global object of some sort. | 971 // Check if the receiver is a global object of some sort. |
972 // This can happen only for regular CallIC but not KeyedCallIC. | 972 // This can happen only for regular CallIC but not KeyedCallIC. |
973 if (id == IC::kCallIC_Miss) { | 973 if (id == IC::kCallIC_Miss) { |
974 Label invoke, global; | 974 Label invoke, global; |
975 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // receiver | 975 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // receiver |
976 __ JumpIfSmi(edx, &invoke, Label::kNear); | 976 __ JumpIfSmi(edx, &invoke, Label::kNear); |
977 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 977 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
978 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 978 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
979 __ cmp(ebx, JS_GLOBAL_OBJECT_TYPE); | 979 __ cmp(ebx, JS_GLOBAL_OBJECT_TYPE); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); | 1104 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); |
1105 __ jmp(&do_call); | 1105 __ jmp(&do_call); |
1106 | 1106 |
1107 __ bind(&slow_reload_receiver); | 1107 __ bind(&slow_reload_receiver); |
1108 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1108 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
1109 | 1109 |
1110 __ bind(&slow_load); | 1110 __ bind(&slow_load); |
1111 // This branch is taken when calling KeyedCallIC_Miss is neither required | 1111 // This branch is taken when calling KeyedCallIC_Miss is neither required |
1112 // nor beneficial. | 1112 // nor beneficial. |
1113 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); | 1113 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); |
1114 __ EnterInternalFrame(); | 1114 |
1115 __ push(ecx); // save the key | 1115 { |
1116 __ push(edx); // pass the receiver | 1116 FrameScope scope(masm, StackFrame::INTERNAL); |
1117 __ push(ecx); // pass the key | 1117 __ push(ecx); // save the key |
1118 __ CallRuntime(Runtime::kKeyedGetProperty, 2); | 1118 __ push(edx); // pass the receiver |
1119 __ pop(ecx); // restore the key | 1119 __ push(ecx); // pass the key |
1120 __ LeaveInternalFrame(); | 1120 __ CallRuntime(Runtime::kKeyedGetProperty, 2); |
| 1121 __ pop(ecx); // restore the key |
| 1122 // Leave the internal frame. |
| 1123 } |
| 1124 |
1121 __ mov(edi, eax); | 1125 __ mov(edi, eax); |
1122 __ jmp(&do_call); | 1126 __ jmp(&do_call); |
1123 | 1127 |
1124 __ bind(&check_string); | 1128 __ bind(&check_string); |
1125 GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow_call); | 1129 GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow_call); |
1126 | 1130 |
1127 // The key is known to be a symbol. | 1131 // The key is known to be a symbol. |
1128 // If the receiver is a regular JS object with slow properties then do | 1132 // If the receiver is a regular JS object with slow properties then do |
1129 // a quick inline probe of the receiver's dictionary. | 1133 // a quick inline probe of the receiver's dictionary. |
1130 // Otherwise do the monomorphic cache probe. | 1134 // Otherwise do the monomorphic cache probe. |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1636 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1633 ? not_zero | 1637 ? not_zero |
1634 : zero; | 1638 : zero; |
1635 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1639 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1636 } | 1640 } |
1637 | 1641 |
1638 | 1642 |
1639 } } // namespace v8::internal | 1643 } } // namespace v8::internal |
1640 | 1644 |
1641 #endif // V8_TARGET_ARCH_IA32 | 1645 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |