OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1010 |
1011 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { | 1011 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { |
1012 // Name and receiver are on the top of the frame. The IC expects | 1012 // Name and receiver are on the top of the frame. The IC expects |
1013 // name in ecx and receiver in eax. | 1013 // name in ecx and receiver in eax. |
1014 Result name = Pop(); | 1014 Result name = Pop(); |
1015 Result receiver = Pop(); | 1015 Result receiver = Pop(); |
1016 PrepareForCall(0, 0); // No stack arguments. | 1016 PrepareForCall(0, 0); // No stack arguments. |
1017 MoveResultsToRegisters(&name, &receiver, ecx, eax); | 1017 MoveResultsToRegisters(&name, &receiver, ecx, eax); |
1018 | 1018 |
1019 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1019 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1020 Builtins::LoadIC_Initialize)); | 1020 Builtins::kLoadIC_Initialize)); |
1021 return RawCallCodeObject(ic, mode); | 1021 return RawCallCodeObject(ic, mode); |
1022 } | 1022 } |
1023 | 1023 |
1024 | 1024 |
1025 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { | 1025 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { |
1026 // Key and receiver are on top of the frame. Put them in eax and edx. | 1026 // Key and receiver are on top of the frame. Put them in eax and edx. |
1027 Result key = Pop(); | 1027 Result key = Pop(); |
1028 Result receiver = Pop(); | 1028 Result receiver = Pop(); |
1029 PrepareForCall(0, 0); | 1029 PrepareForCall(0, 0); |
1030 MoveResultsToRegisters(&key, &receiver, eax, edx); | 1030 MoveResultsToRegisters(&key, &receiver, eax, edx); |
1031 | 1031 |
1032 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1032 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1033 Builtins::KeyedLoadIC_Initialize)); | 1033 Builtins::kKeyedLoadIC_Initialize)); |
1034 return RawCallCodeObject(ic, mode); | 1034 return RawCallCodeObject(ic, mode); |
1035 } | 1035 } |
1036 | 1036 |
1037 | 1037 |
1038 Result VirtualFrame::CallStoreIC(Handle<String> name, | 1038 Result VirtualFrame::CallStoreIC(Handle<String> name, |
1039 bool is_contextual, | 1039 bool is_contextual, |
1040 StrictModeFlag strict_mode) { | 1040 StrictModeFlag strict_mode) { |
1041 // Value and (if not contextual) receiver are on top of the frame. | 1041 // Value and (if not contextual) receiver are on top of the frame. |
1042 // The IC expects name in ecx, value in eax, and receiver in edx. | 1042 // The IC expects name in ecx, value in eax, and receiver in edx. |
1043 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1043 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1044 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict | 1044 (strict_mode == kStrictMode) ? Builtins::kStoreIC_Initialize_Strict |
1045 : Builtins::StoreIC_Initialize)); | 1045 : Builtins::kStoreIC_Initialize)); |
1046 | 1046 |
1047 Result value = Pop(); | 1047 Result value = Pop(); |
1048 RelocInfo::Mode mode; | 1048 RelocInfo::Mode mode; |
1049 if (is_contextual) { | 1049 if (is_contextual) { |
1050 PrepareForCall(0, 0); | 1050 PrepareForCall(0, 0); |
1051 value.ToRegister(eax); | 1051 value.ToRegister(eax); |
1052 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1052 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
1053 value.Unuse(); | 1053 value.Unuse(); |
1054 mode = RelocInfo::CODE_TARGET_CONTEXT; | 1054 mode = RelocInfo::CODE_TARGET_CONTEXT; |
1055 } else { | 1055 } else { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 } else { | 1101 } else { |
1102 __ xchg(eax, ecx); | 1102 __ xchg(eax, ecx); |
1103 __ xchg(eax, edx); | 1103 __ xchg(eax, edx); |
1104 } | 1104 } |
1105 value.Unuse(); | 1105 value.Unuse(); |
1106 key.Unuse(); | 1106 key.Unuse(); |
1107 receiver.Unuse(); | 1107 receiver.Unuse(); |
1108 } | 1108 } |
1109 | 1109 |
1110 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1110 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1111 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 1111 (strict_mode == kStrictMode) ? Builtins::kKeyedStoreIC_Initialize_Strict |
1112 : Builtins::KeyedStoreIC_Initialize)); | 1112 : Builtins::kKeyedStoreIC_Initialize)); |
1113 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1113 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
1114 } | 1114 } |
1115 | 1115 |
1116 | 1116 |
1117 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 1117 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
1118 int arg_count, | 1118 int arg_count, |
1119 int loop_nesting) { | 1119 int loop_nesting) { |
1120 // Function name, arguments, and receiver are on top of the frame. | 1120 // Function name, arguments, and receiver are on top of the frame. |
1121 // The IC expects the name in ecx and the rest on the stack and | 1121 // The IC expects the name in ecx and the rest on the stack and |
1122 // drops them all. | 1122 // drops them all. |
(...skipping 28 matching lines...) Expand all Loading... |
1151 name.Unuse(); | 1151 name.Unuse(); |
1152 return RawCallCodeObject(ic, mode); | 1152 return RawCallCodeObject(ic, mode); |
1153 } | 1153 } |
1154 | 1154 |
1155 | 1155 |
1156 Result VirtualFrame::CallConstructor(int arg_count) { | 1156 Result VirtualFrame::CallConstructor(int arg_count) { |
1157 // Arguments, receiver, and function are on top of the frame. The | 1157 // Arguments, receiver, and function are on top of the frame. The |
1158 // IC expects arg count in eax, function in edi, and the arguments | 1158 // IC expects arg count in eax, function in edi, and the arguments |
1159 // and receiver on the stack. | 1159 // and receiver on the stack. |
1160 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1160 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
1161 Builtins::JSConstructCall)); | 1161 Builtins::kJSConstructCall)); |
1162 // Duplicate the function before preparing the frame. | 1162 // Duplicate the function before preparing the frame. |
1163 PushElementAt(arg_count); | 1163 PushElementAt(arg_count); |
1164 Result function = Pop(); | 1164 Result function = Pop(); |
1165 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. | 1165 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. |
1166 function.ToRegister(edi); | 1166 function.ToRegister(edi); |
1167 | 1167 |
1168 // Constructors are called with the number of arguments in register | 1168 // Constructors are called with the number of arguments in register |
1169 // eax for now. Another option would be to have separate construct | 1169 // eax for now. Another option would be to have separate construct |
1170 // call trampolines per different arguments counts encountered. | 1170 // call trampolines per different arguments counts encountered. |
1171 Result num_args = cgen()->allocator()->Allocate(eax); | 1171 Result num_args = cgen()->allocator()->Allocate(eax); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 elements_.Add(element); | 1357 elements_.Add(element); |
1358 } | 1358 } |
1359 } | 1359 } |
1360 | 1360 |
1361 | 1361 |
1362 #undef __ | 1362 #undef __ |
1363 | 1363 |
1364 } } // namespace v8::internal | 1364 } } // namespace v8::internal |
1365 | 1365 |
1366 #endif // V8_TARGET_ARCH_IA32 | 1366 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |