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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 if (id == IC::kCallIC_Miss) { | 943 if (id == IC::kCallIC_Miss) { |
944 __ IncrementCounter(counters->call_miss(), 1); | 944 __ IncrementCounter(counters->call_miss(), 1); |
945 } else { | 945 } else { |
946 __ IncrementCounter(counters->keyed_call_miss(), 1); | 946 __ IncrementCounter(counters->keyed_call_miss(), 1); |
947 } | 947 } |
948 | 948 |
949 // Get the receiver of the function from the stack; 1 ~ return address. | 949 // Get the receiver of the function from the stack; 1 ~ return address. |
950 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 950 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
951 | 951 |
952 // Enter an internal frame. | 952 // Enter an internal frame. |
953 { | 953 __ EnterInternalFrame(); |
954 FrameScope scope(masm, StackFrame::INTERNAL); | |
955 | 954 |
956 // Push the receiver and the name of the function. | 955 // Push the receiver and the name of the function. |
957 __ push(rdx); | 956 __ push(rdx); |
958 __ push(rcx); | 957 __ push(rcx); |
959 | 958 |
960 // Call the entry. | 959 // Call the entry. |
961 CEntryStub stub(1); | 960 CEntryStub stub(1); |
962 __ Set(rax, 2); | 961 __ Set(rax, 2); |
963 __ LoadAddress(rbx, ExternalReference(IC_Utility(id), masm->isolate())); | 962 __ LoadAddress(rbx, ExternalReference(IC_Utility(id), masm->isolate())); |
964 __ CallStub(&stub); | 963 __ CallStub(&stub); |
965 | 964 |
966 // Move result to rdi and exit the internal frame. | 965 // Move result to rdi and exit the internal frame. |
967 __ movq(rdi, rax); | 966 __ movq(rdi, rax); |
968 } | 967 __ LeaveInternalFrame(); |
969 | 968 |
970 // Check if the receiver is a global object of some sort. | 969 // Check if the receiver is a global object of some sort. |
971 // This can happen only for regular CallIC but not KeyedCallIC. | 970 // This can happen only for regular CallIC but not KeyedCallIC. |
972 if (id == IC::kCallIC_Miss) { | 971 if (id == IC::kCallIC_Miss) { |
973 Label invoke, global; | 972 Label invoke, global; |
974 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver | 973 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver |
975 __ JumpIfSmi(rdx, &invoke); | 974 __ JumpIfSmi(rdx, &invoke); |
976 __ CmpObjectType(rdx, JS_GLOBAL_OBJECT_TYPE, rcx); | 975 __ CmpObjectType(rdx, JS_GLOBAL_OBJECT_TYPE, rcx); |
977 __ j(equal, &global); | 976 __ j(equal, &global); |
978 __ CmpInstanceType(rcx, JS_BUILTINS_OBJECT_TYPE); | 977 __ CmpInstanceType(rcx, JS_BUILTINS_OBJECT_TYPE); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 __ SmiToInteger32(rbx, rcx); | 1099 __ SmiToInteger32(rbx, rcx); |
1101 // ebx: untagged index | 1100 // ebx: untagged index |
1102 GenerateNumberDictionaryLoad(masm, &slow_load, rax, rcx, rbx, r9, rdi, rdi); | 1101 GenerateNumberDictionaryLoad(masm, &slow_load, rax, rcx, rbx, r9, rdi, rdi); |
1103 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); | 1102 __ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1); |
1104 __ jmp(&do_call); | 1103 __ jmp(&do_call); |
1105 | 1104 |
1106 __ bind(&slow_load); | 1105 __ bind(&slow_load); |
1107 // This branch is taken when calling KeyedCallIC_Miss is neither required | 1106 // This branch is taken when calling KeyedCallIC_Miss is neither required |
1108 // nor beneficial. | 1107 // nor beneficial. |
1109 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); | 1108 __ IncrementCounter(counters->keyed_call_generic_slow_load(), 1); |
1110 { | 1109 __ EnterInternalFrame(); |
1111 FrameScope scope(masm, StackFrame::INTERNAL); | 1110 __ push(rcx); // save the key |
1112 __ push(rcx); // save the key | 1111 __ push(rdx); // pass the receiver |
1113 __ push(rdx); // pass the receiver | 1112 __ push(rcx); // pass the key |
1114 __ push(rcx); // pass the key | 1113 __ CallRuntime(Runtime::kKeyedGetProperty, 2); |
1115 __ CallRuntime(Runtime::kKeyedGetProperty, 2); | 1114 __ pop(rcx); // restore the key |
1116 __ pop(rcx); // restore the key | 1115 __ LeaveInternalFrame(); |
1117 } | |
1118 __ movq(rdi, rax); | 1116 __ movq(rdi, rax); |
1119 __ jmp(&do_call); | 1117 __ jmp(&do_call); |
1120 | 1118 |
1121 __ bind(&check_string); | 1119 __ bind(&check_string); |
1122 GenerateKeyStringCheck(masm, rcx, rax, rbx, &index_string, &slow_call); | 1120 GenerateKeyStringCheck(masm, rcx, rax, rbx, &index_string, &slow_call); |
1123 | 1121 |
1124 // The key is known to be a symbol. | 1122 // The key is known to be a symbol. |
1125 // If the receiver is a regular JS object with slow properties then do | 1123 // If the receiver is a regular JS object with slow properties then do |
1126 // a quick inline probe of the receiver's dictionary. | 1124 // a quick inline probe of the receiver's dictionary. |
1127 // Otherwise do the monomorphic cache probe. | 1125 // Otherwise do the monomorphic cache probe. |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1600 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1603 ? not_zero | 1601 ? not_zero |
1604 : zero; | 1602 : zero; |
1605 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1603 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1606 } | 1604 } |
1607 | 1605 |
1608 | 1606 |
1609 } } // namespace v8::internal | 1607 } } // namespace v8::internal |
1610 | 1608 |
1611 #endif // V8_TARGET_ARCH_X64 | 1609 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |