| 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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::KeyedLoadIC_Initialize)); |
| 1034 return RawCallCodeObject(ic, mode); | 1034 return RawCallCodeObject(ic, mode); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 | 1037 |
| 1038 Result VirtualFrame::CallStoreIC(Handle<String> name, bool is_contextual) { | 1038 Result VirtualFrame::CallStoreIC(Handle<String> name, |
| 1039 bool is_contextual, |
| 1040 StrictModeFlag strict_mode) { |
| 1039 // 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. |
| 1040 // 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. |
| 1041 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1043 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1042 Builtins::StoreIC_Initialize)); | 1044 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict |
| 1045 : Builtins::StoreIC_Initialize)); |
| 1046 |
| 1043 Result value = Pop(); | 1047 Result value = Pop(); |
| 1048 RelocInfo::Mode mode; |
| 1044 if (is_contextual) { | 1049 if (is_contextual) { |
| 1045 PrepareForCall(0, 0); | 1050 PrepareForCall(0, 0); |
| 1046 value.ToRegister(eax); | 1051 value.ToRegister(eax); |
| 1047 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 1052 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 1048 value.Unuse(); | 1053 value.Unuse(); |
| 1054 mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 1049 } else { | 1055 } else { |
| 1050 Result receiver = Pop(); | 1056 Result receiver = Pop(); |
| 1051 PrepareForCall(0, 0); | 1057 PrepareForCall(0, 0); |
| 1052 MoveResultsToRegisters(&value, &receiver, eax, edx); | 1058 MoveResultsToRegisters(&value, &receiver, eax, edx); |
| 1059 mode = RelocInfo::CODE_TARGET; |
| 1053 } | 1060 } |
| 1054 __ mov(ecx, name); | 1061 __ mov(ecx, name); |
| 1055 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1062 return RawCallCodeObject(ic, mode); |
| 1056 } | 1063 } |
| 1057 | 1064 |
| 1058 | 1065 |
| 1059 Result VirtualFrame::CallKeyedStoreIC() { | 1066 Result VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) { |
| 1060 // Value, key, and receiver are on the top of the frame. The IC | 1067 // Value, key, and receiver are on the top of the frame. The IC |
| 1061 // expects value in eax, key in ecx, and receiver in edx. | 1068 // expects value in eax, key in ecx, and receiver in edx. |
| 1062 Result value = Pop(); | 1069 Result value = Pop(); |
| 1063 Result key = Pop(); | 1070 Result key = Pop(); |
| 1064 Result receiver = Pop(); | 1071 Result receiver = Pop(); |
| 1065 PrepareForCall(0, 0); | 1072 PrepareForCall(0, 0); |
| 1066 if (!cgen()->allocator()->is_used(eax) || | 1073 if (!cgen()->allocator()->is_used(eax) || |
| 1067 (value.is_register() && value.reg().is(eax))) { | 1074 (value.is_register() && value.reg().is(eax))) { |
| 1068 if (!cgen()->allocator()->is_used(eax)) { | 1075 if (!cgen()->allocator()->is_used(eax)) { |
| 1069 value.ToRegister(eax); | 1076 value.ToRegister(eax); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1094 } else { | 1101 } else { |
| 1095 __ xchg(eax, ecx); | 1102 __ xchg(eax, ecx); |
| 1096 __ xchg(eax, edx); | 1103 __ xchg(eax, edx); |
| 1097 } | 1104 } |
| 1098 value.Unuse(); | 1105 value.Unuse(); |
| 1099 key.Unuse(); | 1106 key.Unuse(); |
| 1100 receiver.Unuse(); | 1107 receiver.Unuse(); |
| 1101 } | 1108 } |
| 1102 | 1109 |
| 1103 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 1110 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1104 Builtins::KeyedStoreIC_Initialize)); | 1111 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict |
| 1112 : Builtins::KeyedStoreIC_Initialize)); |
| 1105 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); | 1113 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); |
| 1106 } | 1114 } |
| 1107 | 1115 |
| 1108 | 1116 |
| 1109 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, | 1117 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, |
| 1110 int arg_count, | 1118 int arg_count, |
| 1111 int loop_nesting) { | 1119 int loop_nesting) { |
| 1112 // Function name, arguments, and receiver are on top of the frame. | 1120 // Function name, arguments, and receiver are on top of the frame. |
| 1113 // 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 |
| 1114 // drops them all. | 1122 // drops them all. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 | 1307 |
| 1300 void VirtualFrame::EmitPush(Immediate immediate, TypeInfo info) { | 1308 void VirtualFrame::EmitPush(Immediate immediate, TypeInfo info) { |
| 1301 ASSERT(stack_pointer_ == element_count() - 1); | 1309 ASSERT(stack_pointer_ == element_count() - 1); |
| 1302 elements_.Add(FrameElement::MemoryElement(info)); | 1310 elements_.Add(FrameElement::MemoryElement(info)); |
| 1303 stack_pointer_++; | 1311 stack_pointer_++; |
| 1304 __ push(immediate); | 1312 __ push(immediate); |
| 1305 } | 1313 } |
| 1306 | 1314 |
| 1307 | 1315 |
| 1308 void VirtualFrame::PushUntaggedElement(Handle<Object> value) { | 1316 void VirtualFrame::PushUntaggedElement(Handle<Object> value) { |
| 1317 ASSERT(!ConstantPoolOverflowed()); |
| 1309 elements_.Add(FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED)); | 1318 elements_.Add(FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED)); |
| 1310 elements_[element_count() - 1].set_untagged_int32(true); | 1319 elements_[element_count() - 1].set_untagged_int32(true); |
| 1311 } | 1320 } |
| 1312 | 1321 |
| 1313 | 1322 |
| 1314 void VirtualFrame::Push(Expression* expr) { | 1323 void VirtualFrame::Push(Expression* expr) { |
| 1315 ASSERT(expr->IsTrivial()); | 1324 ASSERT(expr->IsTrivial()); |
| 1316 | 1325 |
| 1317 Literal* lit = expr->AsLiteral(); | 1326 Literal* lit = expr->AsLiteral(); |
| 1318 if (lit != NULL) { | 1327 if (lit != NULL) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1329 } | 1338 } |
| 1330 if (slot->type() == Slot::PARAMETER) { | 1339 if (slot->type() == Slot::PARAMETER) { |
| 1331 PushParameterAt(slot->index()); | 1340 PushParameterAt(slot->index()); |
| 1332 return; | 1341 return; |
| 1333 } | 1342 } |
| 1334 } | 1343 } |
| 1335 UNREACHABLE(); | 1344 UNREACHABLE(); |
| 1336 } | 1345 } |
| 1337 | 1346 |
| 1338 | 1347 |
| 1348 void VirtualFrame::Push(Handle<Object> value) { |
| 1349 if (ConstantPoolOverflowed()) { |
| 1350 Result temp = cgen()->allocator()->Allocate(); |
| 1351 ASSERT(temp.is_valid()); |
| 1352 __ Set(temp.reg(), Immediate(value)); |
| 1353 Push(&temp); |
| 1354 } else { |
| 1355 FrameElement element = |
| 1356 FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED); |
| 1357 elements_.Add(element); |
| 1358 } |
| 1359 } |
| 1360 |
| 1361 |
| 1339 #undef __ | 1362 #undef __ |
| 1340 | 1363 |
| 1341 } } // namespace v8::internal | 1364 } } // namespace v8::internal |
| 1342 | 1365 |
| 1343 #endif // V8_TARGET_ARCH_IA32 | 1366 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |