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 25 matching lines...) Expand all Loading... |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
39 // Static IC stub generators. | 39 // Static IC stub generators. |
40 // | 40 // |
41 | 41 |
42 #define __ ACCESS_MASM(masm) | 42 #define __ ACCESS_MASM(masm) |
43 | 43 |
44 | 44 |
45 void KeyedLoadIC::ClearInlinedVersion(Address address) { | 45 void KeyedLoadIC::ClearInlinedVersion(Address address) { |
46 UNIMPLEMENTED(); | 46 // TODO(X64): Implement this when LoadIC is enabled. |
47 } | 47 } |
48 | 48 |
49 void KeyedStoreIC::ClearInlinedVersion(Address address) { | 49 void KeyedStoreIC::ClearInlinedVersion(Address address) { |
50 UNIMPLEMENTED(); | 50 // TODO(X64): Implement this when LoadIC is enabled. |
51 } | 51 } |
52 | 52 |
53 void KeyedStoreIC::RestoreInlinedVersion(Address address) { | 53 void KeyedStoreIC::RestoreInlinedVersion(Address address) { |
54 UNIMPLEMENTED(); | 54 UNIMPLEMENTED(); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void KeyedLoadIC::Generate(MacroAssembler* masm, | 58 void KeyedLoadIC::Generate(MacroAssembler* masm, |
59 ExternalReference const& f) { | 59 ExternalReference const& f) { |
60 // ----------- S t a t e ------------- | 60 // ----------- S t a t e ------------- |
(...skipping 10 matching lines...) Expand all Loading... |
71 __ push(rcx); | 71 __ push(rcx); |
72 __ push(rax); | 72 __ push(rax); |
73 __ push(rbx); | 73 __ push(rbx); |
74 | 74 |
75 // Perform tail call to the entry. | 75 // Perform tail call to the entry. |
76 __ TailCallRuntime(f, 2); | 76 __ TailCallRuntime(f, 2); |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 80 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
81 masm->int3(); // UNIMPLEMENTED. | 81 // ----------- S t a t e ------------- |
82 masm->movq(kScratchRegister, Immediate(0xC0AB)); // Debugging aid. | 82 // -- rsp[0] : return address |
| 83 // -- rsp[8] : name |
| 84 // -- rsp[16] : receiver |
| 85 // ----------------------------------- |
| 86 |
| 87 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
83 } | 88 } |
84 | 89 |
85 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 90 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
86 masm->int3(); // UNIMPLEMENTED. | 91 // ----------- S t a t e ------------- |
87 masm->movq(kScratchRegister, Immediate(0xC1AB)); // Debugging aid. | 92 // -- rsp[0] : return address |
| 93 // -- rsp[8] : name |
| 94 // -- rsp[16] : receiver |
| 95 // ----------------------------------- |
| 96 |
| 97 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
88 } | 98 } |
89 | 99 |
90 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { | 100 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { |
91 UNIMPLEMENTED(); | 101 // Never patch the map in the map check, so the check always fails. |
92 return false; | 102 return false; |
93 } | 103 } |
94 | 104 |
95 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { | 105 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { |
96 UNIMPLEMENTED(); | 106 // Never patch the map in the map check, so the check always fails. |
97 return false; | 107 return false; |
98 } | 108 } |
99 | 109 |
100 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 110 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
101 UNIMPLEMENTED(); | 111 UNIMPLEMENTED(); |
102 return NULL; | 112 return NULL; |
103 } | 113 } |
104 | 114 |
105 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 115 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
106 JSObject* object, | 116 JSObject* object, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 __ push(Operand(rsp, 1 * kPointerSize)); | 166 __ push(Operand(rsp, 1 * kPointerSize)); |
157 __ push(Operand(rsp, 1 * kPointerSize)); | 167 __ push(Operand(rsp, 1 * kPointerSize)); |
158 __ push(rax); | 168 __ push(rax); |
159 __ push(rcx); | 169 __ push(rcx); |
160 | 170 |
161 // Do tail-call to runtime routine. | 171 // Do tail-call to runtime routine. |
162 __ TailCallRuntime(f, 3); | 172 __ TailCallRuntime(f, 3); |
163 } | 173 } |
164 | 174 |
165 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { | 175 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { |
166 masm->int3(); // UNIMPLEMENTED. | 176 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss))); |
167 masm->movq(kScratchRegister, Immediate(0xC2AB)); // Debugging aid. | |
168 } | 177 } |
169 | 178 |
170 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 179 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
171 masm->int3(); // UNIMPLEMENTED. | 180 Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss))); |
172 masm->movq(kScratchRegister, Immediate(0xC3AB)); // Debugging aid. | |
173 } | 181 } |
174 | 182 |
175 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 183 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
176 int index, | 184 int index, |
177 Map* transition, | 185 Map* transition, |
178 String* name) { | 186 String* name) { |
179 UNIMPLEMENTED(); | 187 UNIMPLEMENTED(); |
180 return NULL; | 188 return NULL; |
181 } | 189 } |
182 | 190 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 __ bind(&global); | 229 __ bind(&global); |
222 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 230 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
223 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 231 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
224 | 232 |
225 // Invoke the function. | 233 // Invoke the function. |
226 ParameterCount actual(argc); | 234 ParameterCount actual(argc); |
227 __ bind(&invoke); | 235 __ bind(&invoke); |
228 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); | 236 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); |
229 } | 237 } |
230 | 238 |
231 void CallIC::GenerateMegamorphic(MacroAssembler* a, int b) { | 239 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
232 UNIMPLEMENTED(); | 240 // Cache miss: Jump to runtime. |
| 241 Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss))); |
233 } | 242 } |
234 | 243 |
235 void CallIC::GenerateNormal(MacroAssembler* a, int b) { | 244 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
236 UNIMPLEMENTED(); | 245 // Cache miss: Jump to runtime. |
| 246 Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss))); |
237 } | 247 } |
238 | 248 |
239 | 249 |
| 250 // The offset from the inlined patch site to the start of the |
| 251 // inlined load instruction. |
240 const int LoadIC::kOffsetToLoadInstruction = 20; | 252 const int LoadIC::kOffsetToLoadInstruction = 20; |
241 | 253 |
242 | 254 |
243 void LoadIC::ClearInlinedVersion(Address address) { | 255 void LoadIC::ClearInlinedVersion(Address address) { |
244 UNIMPLEMENTED(); | 256 // TODO(X64): Implement this when LoadIC is enabled. |
245 } | 257 } |
246 | 258 |
247 | 259 |
248 void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) { | 260 void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) { |
249 // ----------- S t a t e ------------- | 261 // ----------- S t a t e ------------- |
250 // -- rcx : name | 262 // -- rcx : name |
251 // -- rsp[0] : return address | 263 // -- rsp[0] : return address |
252 // -- rsp[8] : receiver | 264 // -- rsp[8] : receiver |
253 // ----------------------------------- | 265 // ----------------------------------- |
254 | 266 |
255 __ movq(rax, Operand(rsp, kPointerSize)); | 267 __ movq(rax, Operand(rsp, kPointerSize)); |
256 | 268 |
257 // Move the return address below the arguments. | 269 // Move the return address below the arguments. |
258 __ pop(rbx); | 270 __ pop(rbx); |
259 __ push(rax); | 271 __ push(rax); |
260 __ push(rcx); | 272 __ push(rcx); |
261 __ push(rbx); | 273 __ push(rbx); |
262 | 274 |
263 // Perform tail call to the entry. | 275 // Perform tail call to the entry. |
264 __ TailCallRuntime(f, 2); | 276 __ TailCallRuntime(f, 2); |
265 } | 277 } |
266 | 278 |
267 | 279 |
268 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 280 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
269 masm->int3(); // UNIMPLEMENTED. | 281 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
270 masm->movq(kScratchRegister, Immediate(0xC4AB)); // Debugging aid. | |
271 } | 282 } |
272 | 283 |
273 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { | 284 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
274 masm->int3(); // UNIMPLEMENTED. | 285 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
275 masm->movq(kScratchRegister, Immediate(0xC5AB)); // Debugging aid. | |
276 } | 286 } |
277 | 287 |
278 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 288 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
279 masm->int3(); // UNIMPLEMENTED. | 289 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
280 masm->movq(kScratchRegister, Immediate(0xC6AB)); // Debugging aid. | |
281 } | 290 } |
282 | 291 |
283 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 292 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
284 masm->int3(); // UNIMPLEMENTED. | 293 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
285 masm->movq(kScratchRegister, Immediate(0xC7AB)); // Debugging aid. | |
286 } | 294 } |
287 | 295 |
288 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 296 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
289 masm->int3(); // UNIMPLEMENTED. | 297 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
290 masm->movq(kScratchRegister, Immediate(0xC8AB)); // Debugging aid. | |
291 } | 298 } |
292 | 299 |
293 void LoadIC::GenerateStringLength(MacroAssembler* masm) { | 300 void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
294 masm->int3(); // UNIMPLEMENTED. | 301 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
295 masm->movq(kScratchRegister, Immediate(0xC9AB)); // Debugging aid. | |
296 } | 302 } |
297 | 303 |
298 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) { | 304 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int index) { |
299 UNIMPLEMENTED(); | 305 UNIMPLEMENTED(); |
300 return false; | 306 return false; |
301 } | 307 } |
302 | 308 |
303 void StoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) { | 309 void StoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) { |
304 // ----------- S t a t e ------------- | 310 // ----------- S t a t e ------------- |
305 // -- rax : value | 311 // -- rax : value |
306 // -- rcx : name | 312 // -- rcx : name |
307 // -- rsp[0] : return address | 313 // -- rsp[0] : return address |
308 // -- rsp[8] : receiver | 314 // -- rsp[8] : receiver |
309 // ----------------------------------- | 315 // ----------------------------------- |
310 // Move the return address below the arguments. | 316 // Move the return address below the arguments. |
311 __ pop(rbx); | 317 __ pop(rbx); |
312 __ push(Operand(rsp, 0)); | 318 __ push(Operand(rsp, 0)); |
313 __ push(rcx); | 319 __ push(rcx); |
314 __ push(rax); | 320 __ push(rax); |
315 __ push(rbx); | 321 __ push(rbx); |
316 | 322 |
317 // Perform tail call to the entry. | 323 // Perform tail call to the entry. |
318 __ TailCallRuntime(f, 3); | 324 __ TailCallRuntime(f, 3); |
319 } | 325 } |
320 | 326 |
321 void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { | 327 void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { |
322 masm->int3(); // UNIMPLEMENTED. | 328 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
323 masm->movq(kScratchRegister, Immediate(0xCAAB)); // Debugging aid. | |
324 } | 329 } |
325 | 330 |
326 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 331 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
327 masm->int3(); // UNIMPLEMENTED. | 332 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
328 masm->movq(kScratchRegister, Immediate(0xCBAB)); // Debugging aid. | |
329 } | 333 } |
330 | 334 |
331 | 335 |
332 #undef __ | 336 #undef __ |
333 | 337 |
334 | 338 |
335 } } // namespace v8::internal | 339 } } // namespace v8::internal |
OLD | NEW |