Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/ia32/virtual-frame-ia32.cc

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/ic.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 void VirtualFrame::AllocateStackSlots() { 495 void VirtualFrame::AllocateStackSlots() {
496 int count = local_count(); 496 int count = local_count();
497 if (count > 0) { 497 if (count > 0) {
498 Comment cmnt(masm(), "[ Allocate space for locals"); 498 Comment cmnt(masm(), "[ Allocate space for locals");
499 // The locals are initialized to a constant (the undefined value), but 499 // The locals are initialized to a constant (the undefined value), but
500 // we sync them with the actual frame to allocate space for spilling 500 // we sync them with the actual frame to allocate space for spilling
501 // them later. First sync everything above the stack pointer so we can 501 // them later. First sync everything above the stack pointer so we can
502 // use pushes to allocate and initialize the locals. 502 // use pushes to allocate and initialize the locals.
503 SyncRange(stack_pointer_ + 1, element_count() - 1); 503 SyncRange(stack_pointer_ + 1, element_count() - 1);
504 Handle<Object> undefined = Factory::undefined_value(); 504 Handle<Object> undefined = FACTORY->undefined_value();
505 FrameElement initial_value = 505 FrameElement initial_value =
506 FrameElement::ConstantElement(undefined, FrameElement::SYNCED); 506 FrameElement::ConstantElement(undefined, FrameElement::SYNCED);
507 if (count == 1) { 507 if (count == 1) {
508 __ push(Immediate(undefined)); 508 __ push(Immediate(undefined));
509 } else if (count < kLocalVarBound) { 509 } else if (count < kLocalVarBound) {
510 // For less locals the unrolled loop is more compact. 510 // For less locals the unrolled loop is more compact.
511 Result temp = cgen()->allocator()->Allocate(); 511 Result temp = cgen()->allocator()->Allocate();
512 ASSERT(temp.is_valid()); 512 ASSERT(temp.is_valid());
513 __ Set(temp.reg(), Immediate(undefined)); 513 __ Set(temp.reg(), Immediate(undefined));
514 for (int i = 0; i < count; i++) { 514 for (int i = 0; i < count; i++) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } else { 817 } else {
818 __ test(fresh_reg, Immediate(kSmiTagMask)); 818 __ test(fresh_reg, Immediate(kSmiTagMask));
819 Label not_smi; 819 Label not_smi;
820 __ j(not_zero, &not_smi); 820 __ j(not_zero, &not_smi);
821 __ SmiUntag(fresh_reg); 821 __ SmiUntag(fresh_reg);
822 __ jmp(&done); 822 __ jmp(&done);
823 823
824 __ bind(&not_smi); 824 __ bind(&not_smi);
825 if (!original.type_info().IsNumber()) { 825 if (!original.type_info().IsNumber()) {
826 __ cmp(FieldOperand(fresh_reg, HeapObject::kMapOffset), 826 __ cmp(FieldOperand(fresh_reg, HeapObject::kMapOffset),
827 Factory::heap_number_map()); 827 FACTORY->heap_number_map());
828 cgen()->unsafe_bailout_->Branch(not_equal); 828 cgen()->unsafe_bailout_->Branch(not_equal);
829 } 829 }
830 830
831 if (!CpuFeatures::IsSupported(SSE2)) { 831 if (!Isolate::Current()->cpu_features()->IsSupported(SSE2)) {
832 UNREACHABLE(); 832 UNREACHABLE();
833 } else { 833 } else {
834 CpuFeatures::Scope use_sse2(SSE2); 834 CpuFeatures::Scope use_sse2(SSE2);
835 __ movdbl(xmm0, FieldOperand(fresh_reg, HeapNumber::kValueOffset)); 835 __ movdbl(xmm0, FieldOperand(fresh_reg, HeapNumber::kValueOffset));
836 __ cvttsd2si(fresh_reg, Operand(xmm0)); 836 __ cvttsd2si(fresh_reg, Operand(xmm0));
837 __ cvtsi2sd(xmm1, Operand(fresh_reg)); 837 __ cvtsi2sd(xmm1, Operand(fresh_reg));
838 __ ucomisd(xmm0, xmm1); 838 __ ucomisd(xmm0, xmm1);
839 cgen()->unsafe_bailout_->Branch(not_equal); 839 cgen()->unsafe_bailout_->Branch(not_equal);
840 cgen()->unsafe_bailout_->Branch(parity_even); // NaN. 840 cgen()->unsafe_bailout_->Branch(parity_even); // NaN.
841 // Test for negative zero. 841 // Test for negative zero.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 ASSERT(cgen()->HasValidEntryRegisters()); 924 ASSERT(cgen()->HasValidEntryRegisters());
925 ParameterCount count(arg_count); 925 ParameterCount count(arg_count);
926 __ InvokeFunction(edi, count, CALL_FUNCTION); 926 __ InvokeFunction(edi, count, CALL_FUNCTION);
927 RestoreContextRegister(); 927 RestoreContextRegister();
928 Result result = cgen()->allocator()->Allocate(eax); 928 Result result = cgen()->allocator()->Allocate(eax);
929 ASSERT(result.is_valid()); 929 ASSERT(result.is_valid());
930 return result; 930 return result;
931 } 931 }
932 932
933 933
934 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { 934 Result VirtualFrame::CallRuntime(const Runtime::Function* f, int arg_count) {
935 PrepareForCall(arg_count, arg_count); 935 PrepareForCall(arg_count, arg_count);
936 ASSERT(cgen()->HasValidEntryRegisters()); 936 ASSERT(cgen()->HasValidEntryRegisters());
937 __ CallRuntime(f, arg_count); 937 __ CallRuntime(f, arg_count);
938 Result result = cgen()->allocator()->Allocate(eax); 938 Result result = cgen()->allocator()->Allocate(eax);
939 ASSERT(result.is_valid()); 939 ASSERT(result.is_valid());
940 return result; 940 return result;
941 } 941 }
942 942
943 943
944 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { 944 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1009
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(Builtins::builtin(Builtins::LoadIC_Initialize)); 1019 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1020 Builtins::LoadIC_Initialize));
1020 return RawCallCodeObject(ic, mode); 1021 return RawCallCodeObject(ic, mode);
1021 } 1022 }
1022 1023
1023 1024
1024 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { 1025 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) {
1025 // 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.
1026 Result key = Pop(); 1027 Result key = Pop();
1027 Result receiver = Pop(); 1028 Result receiver = Pop();
1028 PrepareForCall(0, 0); 1029 PrepareForCall(0, 0);
1029 MoveResultsToRegisters(&key, &receiver, eax, edx); 1030 MoveResultsToRegisters(&key, &receiver, eax, edx);
1030 1031
1031 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1032 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1033 Builtins::KeyedLoadIC_Initialize));
1032 return RawCallCodeObject(ic, mode); 1034 return RawCallCodeObject(ic, mode);
1033 } 1035 }
1034 1036
1035 1037
1036 Result VirtualFrame::CallStoreIC(Handle<String> name, 1038 Result VirtualFrame::CallStoreIC(Handle<String> name,
1037 bool is_contextual, 1039 bool is_contextual,
1038 StrictModeFlag strict_mode) { 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(Builtins::builtin( 1043 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1042 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict 1044 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict
1043 : Builtins::StoreIC_Initialize)); 1045 : Builtins::StoreIC_Initialize));
1044 1046
1045 Result value = Pop(); 1047 Result value = Pop();
1046 RelocInfo::Mode mode; 1048 RelocInfo::Mode mode;
1047 if (is_contextual) { 1049 if (is_contextual) {
1048 PrepareForCall(0, 0); 1050 PrepareForCall(0, 0);
1049 value.ToRegister(eax); 1051 value.ToRegister(eax);
1050 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 1052 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
1051 value.Unuse(); 1053 value.Unuse();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 __ xchg(eax, ecx); 1100 __ xchg(eax, ecx);
1099 } else { 1101 } else {
1100 __ xchg(eax, ecx); 1102 __ xchg(eax, ecx);
1101 __ xchg(eax, edx); 1103 __ xchg(eax, edx);
1102 } 1104 }
1103 value.Unuse(); 1105 value.Unuse();
1104 key.Unuse(); 1106 key.Unuse();
1105 receiver.Unuse(); 1107 receiver.Unuse();
1106 } 1108 }
1107 1109
1108 Handle<Code> ic(Builtins::builtin( 1110 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1109 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict 1111 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict
1110 : Builtins::KeyedStoreIC_Initialize)); 1112 : Builtins::KeyedStoreIC_Initialize));
1111 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 1113 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
1112 } 1114 }
1113 1115
1114 1116
1115 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, 1117 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode,
1116 int arg_count, 1118 int arg_count,
1117 int loop_nesting) { 1119 int loop_nesting) {
1118 // Function name, arguments, and receiver are on top of the frame. 1120 // Function name, arguments, and receiver are on top of the frame.
1119 // 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
1120 // drops them all. 1122 // drops them all.
1121 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; 1123 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1122 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop); 1124 Handle<Code> ic = Isolate::Current()->stub_cache()->ComputeCallInitialize(
1125 arg_count, in_loop);
1123 // Spill args, receiver, and function. The call will drop args and 1126 // Spill args, receiver, and function. The call will drop args and
1124 // receiver. 1127 // receiver.
1125 Result name = Pop(); 1128 Result name = Pop();
1126 PrepareForCall(arg_count + 1, arg_count + 1); // Arguments + receiver. 1129 PrepareForCall(arg_count + 1, arg_count + 1); // Arguments + receiver.
1127 name.ToRegister(ecx); 1130 name.ToRegister(ecx);
1128 name.Unuse(); 1131 name.Unuse();
1129 return RawCallCodeObject(ic, mode); 1132 return RawCallCodeObject(ic, mode);
1130 } 1133 }
1131 1134
1132 1135
1133 Result VirtualFrame::CallKeyedCallIC(RelocInfo::Mode mode, 1136 Result VirtualFrame::CallKeyedCallIC(RelocInfo::Mode mode,
1134 int arg_count, 1137 int arg_count,
1135 int loop_nesting) { 1138 int loop_nesting) {
1136 // Function name, arguments, and receiver are on top of the frame. 1139 // Function name, arguments, and receiver are on top of the frame.
1137 // The IC expects the name in ecx and the rest on the stack and 1140 // The IC expects the name in ecx and the rest on the stack and
1138 // drops them all. 1141 // drops them all.
1139 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; 1142 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1140 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); 1143 Handle<Code> ic =
1144 Isolate::Current()->stub_cache()->ComputeKeyedCallInitialize(arg_count,
1145 in_loop);
1141 // Spill args, receiver, and function. The call will drop args and 1146 // Spill args, receiver, and function. The call will drop args and
1142 // receiver. 1147 // receiver.
1143 Result name = Pop(); 1148 Result name = Pop();
1144 PrepareForCall(arg_count + 1, arg_count + 1); // Arguments + receiver. 1149 PrepareForCall(arg_count + 1, arg_count + 1); // Arguments + receiver.
1145 name.ToRegister(ecx); 1150 name.ToRegister(ecx);
1146 name.Unuse(); 1151 name.Unuse();
1147 return RawCallCodeObject(ic, mode); 1152 return RawCallCodeObject(ic, mode);
1148 } 1153 }
1149 1154
1150 1155
1151 Result VirtualFrame::CallConstructor(int arg_count) { 1156 Result VirtualFrame::CallConstructor(int arg_count) {
1152 // Arguments, receiver, and function are on top of the frame. The 1157 // Arguments, receiver, and function are on top of the frame. The
1153 // 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
1154 // and receiver on the stack. 1159 // and receiver on the stack.
1155 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); 1160 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1161 Builtins::JSConstructCall));
1156 // Duplicate the function before preparing the frame. 1162 // Duplicate the function before preparing the frame.
1157 PushElementAt(arg_count); 1163 PushElementAt(arg_count);
1158 Result function = Pop(); 1164 Result function = Pop();
1159 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. 1165 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args.
1160 function.ToRegister(edi); 1166 function.ToRegister(edi);
1161 1167
1162 // Constructors are called with the number of arguments in register 1168 // Constructors are called with the number of arguments in register
1163 // eax for now. Another option would be to have separate construct 1169 // eax for now. Another option would be to have separate construct
1164 // call trampolines per different arguments counts encountered. 1170 // call trampolines per different arguments counts encountered.
1165 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
1351 elements_.Add(element); 1357 elements_.Add(element);
1352 } 1358 }
1353 } 1359 }
1354 1360
1355 1361
1356 #undef __ 1362 #undef __
1357 1363
1358 } } // namespace v8::internal 1364 } } // namespace v8::internal
1359 1365
1360 #endif // V8_TARGET_ARCH_IA32 1366 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698