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

Side by Side Diff: src/x64/virtual-frame-x64.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/x64/virtual-frame-x64.h ('k') | src/zone.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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 void VirtualFrame::AllocateStackSlots() { 107 void VirtualFrame::AllocateStackSlots() {
108 int count = local_count(); 108 int count = local_count();
109 if (count > 0) { 109 if (count > 0) {
110 Comment cmnt(masm(), "[ Allocate space for locals"); 110 Comment cmnt(masm(), "[ Allocate space for locals");
111 // The locals are initialized to a constant (the undefined value), but 111 // The locals are initialized to a constant (the undefined value), but
112 // we sync them with the actual frame to allocate space for spilling 112 // we sync them with the actual frame to allocate space for spilling
113 // them later. First sync everything above the stack pointer so we can 113 // them later. First sync everything above the stack pointer so we can
114 // use pushes to allocate and initialize the locals. 114 // use pushes to allocate and initialize the locals.
115 SyncRange(stack_pointer_ + 1, element_count() - 1); 115 SyncRange(stack_pointer_ + 1, element_count() - 1);
116 Handle<Object> undefined = Factory::undefined_value(); 116 Handle<Object> undefined = FACTORY->undefined_value();
117 FrameElement initial_value = 117 FrameElement initial_value =
118 FrameElement::ConstantElement(undefined, FrameElement::SYNCED); 118 FrameElement::ConstantElement(undefined, FrameElement::SYNCED);
119 if (count < kLocalVarBound) { 119 if (count < kLocalVarBound) {
120 // For fewer locals the unrolled loop is more compact. 120 // For fewer locals the unrolled loop is more compact.
121 121
122 // Hope for one of the first eight registers, where the push operation 122 // Hope for one of the first eight registers, where the push operation
123 // takes only one byte (kScratchRegister needs the REX.W bit). 123 // takes only one byte (kScratchRegister needs the REX.W bit).
124 Result tmp = cgen()->allocator()->Allocate(); 124 Result tmp = cgen()->allocator()->Allocate();
125 ASSERT(tmp.is_valid()); 125 ASSERT(tmp.is_valid());
126 __ movq(tmp.reg(), undefined, RelocInfo::EMBEDDED_OBJECT); 126 __ movq(tmp.reg(), undefined, RelocInfo::EMBEDDED_OBJECT);
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 while (i <= end) { 1012 while (i <= end) {
1013 SyncElementByPushing(i); 1013 SyncElementByPushing(i);
1014 i++; 1014 i++;
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 1018
1019 //------------------------------------------------------------------------------ 1019 //------------------------------------------------------------------------------
1020 // Virtual frame stub and IC calling functions. 1020 // Virtual frame stub and IC calling functions.
1021 1021
1022 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { 1022 Result VirtualFrame::CallRuntime(const Runtime::Function* f, int arg_count) {
1023 PrepareForCall(arg_count, arg_count); 1023 PrepareForCall(arg_count, arg_count);
1024 ASSERT(cgen()->HasValidEntryRegisters()); 1024 ASSERT(cgen()->HasValidEntryRegisters());
1025 __ CallRuntime(f, arg_count); 1025 __ CallRuntime(f, arg_count);
1026 Result result = cgen()->allocator()->Allocate(rax); 1026 Result result = cgen()->allocator()->Allocate(rax);
1027 ASSERT(result.is_valid()); 1027 ASSERT(result.is_valid());
1028 return result; 1028 return result;
1029 } 1029 }
1030 1030
1031 1031
1032 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { 1032 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 a->ToRegister(a_reg); 1108 a->ToRegister(a_reg);
1109 } 1109 }
1110 a->Unuse(); 1110 a->Unuse();
1111 b->Unuse(); 1111 b->Unuse();
1112 } 1112 }
1113 1113
1114 1114
1115 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) { 1115 Result VirtualFrame::CallLoadIC(RelocInfo::Mode mode) {
1116 // Name and receiver are on the top of the frame. Both are dropped. 1116 // Name and receiver are on the top of the frame. Both are dropped.
1117 // The IC expects name in rcx and receiver in rax. 1117 // The IC expects name in rcx and receiver in rax.
1118 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 1118 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1119 Builtins::LoadIC_Initialize));
1119 Result name = Pop(); 1120 Result name = Pop();
1120 Result receiver = Pop(); 1121 Result receiver = Pop();
1121 PrepareForCall(0, 0); 1122 PrepareForCall(0, 0);
1122 MoveResultsToRegisters(&name, &receiver, rcx, rax); 1123 MoveResultsToRegisters(&name, &receiver, rcx, rax);
1123 1124
1124 return RawCallCodeObject(ic, mode); 1125 return RawCallCodeObject(ic, mode);
1125 } 1126 }
1126 1127
1127 1128
1128 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) { 1129 Result VirtualFrame::CallKeyedLoadIC(RelocInfo::Mode mode) {
1129 // Key and receiver are on top of the frame. Put them in rax and rdx. 1130 // Key and receiver are on top of the frame. Put them in rax and rdx.
1130 Result key = Pop(); 1131 Result key = Pop();
1131 Result receiver = Pop(); 1132 Result receiver = Pop();
1132 PrepareForCall(0, 0); 1133 PrepareForCall(0, 0);
1133 MoveResultsToRegisters(&key, &receiver, rax, rdx); 1134 MoveResultsToRegisters(&key, &receiver, rax, rdx);
1134 1135
1135 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1136 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1137 Builtins::KeyedLoadIC_Initialize));
1136 return RawCallCodeObject(ic, mode); 1138 return RawCallCodeObject(ic, mode);
1137 } 1139 }
1138 1140
1139 1141
1140 Result VirtualFrame::CallStoreIC(Handle<String> name, 1142 Result VirtualFrame::CallStoreIC(Handle<String> name,
1141 bool is_contextual, 1143 bool is_contextual,
1142 StrictModeFlag strict_mode) { 1144 StrictModeFlag strict_mode) {
1143 // Value and (if not contextual) receiver are on top of the frame. 1145 // Value and (if not contextual) receiver are on top of the frame.
1144 // The IC expects name in rcx, value in rax, and receiver in rdx. 1146 // The IC expects name in rcx, value in rax, and receiver in rdx.
1145 Handle<Code> ic(Builtins::builtin( 1147 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1146 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict 1148 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict
1147 : Builtins::StoreIC_Initialize)); 1149 : Builtins::StoreIC_Initialize));
1148 Result value = Pop(); 1150 Result value = Pop();
1149 RelocInfo::Mode mode; 1151 RelocInfo::Mode mode;
1150 if (is_contextual) { 1152 if (is_contextual) {
1151 PrepareForCall(0, 0); 1153 PrepareForCall(0, 0);
1152 value.ToRegister(rax); 1154 value.ToRegister(rax);
1153 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 1155 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
1154 value.Unuse(); 1156 value.Unuse();
1155 mode = RelocInfo::CODE_TARGET_CONTEXT; 1157 mode = RelocInfo::CODE_TARGET_CONTEXT;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 __ xchg(rax, rcx); 1203 __ xchg(rax, rcx);
1202 } else { 1204 } else {
1203 __ xchg(rax, rcx); 1205 __ xchg(rax, rcx);
1204 __ xchg(rax, rdx); 1206 __ xchg(rax, rdx);
1205 } 1207 }
1206 value.Unuse(); 1208 value.Unuse();
1207 key.Unuse(); 1209 key.Unuse();
1208 receiver.Unuse(); 1210 receiver.Unuse();
1209 } 1211 }
1210 1212
1211 Handle<Code> ic(Builtins::builtin( 1213 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1212 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict 1214 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict
1213 : Builtins::KeyedStoreIC_Initialize)); 1215 : Builtins::KeyedStoreIC_Initialize));
1214 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET); 1216 return RawCallCodeObject(ic, RelocInfo::CODE_TARGET);
1215 } 1217 }
1216 1218
1217 1219
1218 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode, 1220 Result VirtualFrame::CallCallIC(RelocInfo::Mode mode,
1219 int arg_count, 1221 int arg_count,
1220 int loop_nesting) { 1222 int loop_nesting) {
1221 // Function name, arguments, and receiver are found on top of the frame 1223 // Function name, arguments, and receiver are found on top of the frame
1222 // and dropped by the call. The IC expects the name in rcx and the rest 1224 // and dropped by the call. The IC expects the name in rcx and the rest
1223 // on the stack, and drops them all. 1225 // on the stack, and drops them all.
1224 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; 1226 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1225 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop); 1227 Handle<Code> ic =
1228 ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop);
1226 Result name = Pop(); 1229 Result name = Pop();
1227 // Spill args, receiver, and function. The call will drop args and 1230 // Spill args, receiver, and function. The call will drop args and
1228 // receiver. 1231 // receiver.
1229 PrepareForCall(arg_count + 1, arg_count + 1); 1232 PrepareForCall(arg_count + 1, arg_count + 1);
1230 name.ToRegister(rcx); 1233 name.ToRegister(rcx);
1231 name.Unuse(); 1234 name.Unuse();
1232 return RawCallCodeObject(ic, mode); 1235 return RawCallCodeObject(ic, mode);
1233 } 1236 }
1234 1237
1235 1238
1236 Result VirtualFrame::CallKeyedCallIC(RelocInfo::Mode mode, 1239 Result VirtualFrame::CallKeyedCallIC(RelocInfo::Mode mode,
1237 int arg_count, 1240 int arg_count,
1238 int loop_nesting) { 1241 int loop_nesting) {
1239 // Function name, arguments, and receiver are found on top of the frame 1242 // Function name, arguments, and receiver are found on top of the frame
1240 // and dropped by the call. The IC expects the name in rcx and the rest 1243 // and dropped by the call. The IC expects the name in rcx and the rest
1241 // on the stack, and drops them all. 1244 // on the stack, and drops them all.
1242 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP; 1245 InLoopFlag in_loop = loop_nesting > 0 ? IN_LOOP : NOT_IN_LOOP;
1243 Handle<Code> ic = 1246 Handle<Code> ic =
1244 StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); 1247 ISOLATE->stub_cache()->ComputeKeyedCallInitialize(arg_count, in_loop);
1245 Result name = Pop(); 1248 Result name = Pop();
1246 // Spill args, receiver, and function. The call will drop args and 1249 // Spill args, receiver, and function. The call will drop args and
1247 // receiver. 1250 // receiver.
1248 PrepareForCall(arg_count + 1, arg_count + 1); 1251 PrepareForCall(arg_count + 1, arg_count + 1);
1249 name.ToRegister(rcx); 1252 name.ToRegister(rcx);
1250 name.Unuse(); 1253 name.Unuse();
1251 return RawCallCodeObject(ic, mode); 1254 return RawCallCodeObject(ic, mode);
1252 } 1255 }
1253 1256
1254 1257
1255 Result VirtualFrame::CallConstructor(int arg_count) { 1258 Result VirtualFrame::CallConstructor(int arg_count) {
1256 // Arguments, receiver, and function are on top of the frame. The 1259 // Arguments, receiver, and function are on top of the frame. The
1257 // IC expects arg count in rax, function in rdi, and the arguments 1260 // IC expects arg count in rax, function in rdi, and the arguments
1258 // and receiver on the stack. 1261 // and receiver on the stack.
1259 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); 1262 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
1263 Builtins::JSConstructCall));
1260 // Duplicate the function before preparing the frame. 1264 // Duplicate the function before preparing the frame.
1261 PushElementAt(arg_count); 1265 PushElementAt(arg_count);
1262 Result function = Pop(); 1266 Result function = Pop();
1263 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args. 1267 PrepareForCall(arg_count + 1, arg_count + 1); // Spill function and args.
1264 function.ToRegister(rdi); 1268 function.ToRegister(rdi);
1265 1269
1266 // Constructors are called with the number of arguments in register 1270 // Constructors are called with the number of arguments in register
1267 // rax for now. Another option would be to have separate construct 1271 // rax for now. Another option would be to have separate construct
1268 // call trampolines per different arguments counts encountered. 1272 // call trampolines per different arguments counts encountered.
1269 Result num_args = cgen()->allocator()->Allocate(rax); 1273 Result num_args = cgen()->allocator()->Allocate(rax);
(...skipping 13 matching lines...) Expand all
1283 Adjust(kHandlerSize - 1); 1287 Adjust(kHandlerSize - 1);
1284 __ PushTryHandler(IN_JAVASCRIPT, type); 1288 __ PushTryHandler(IN_JAVASCRIPT, type);
1285 } 1289 }
1286 1290
1287 1291
1288 #undef __ 1292 #undef __
1289 1293
1290 } } // namespace v8::internal 1294 } } // namespace v8::internal
1291 1295
1292 #endif // V8_TARGET_ARCH_X64 1296 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/virtual-frame-x64.h ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698