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

Side by Side Diff: src/x64/ic-x64.cc

Issue 141056: x64: Generate code for loading from, storing to and calling properties. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 void KeyedStoreIC::ClearInlinedVersion(Address address) { 49 void KeyedStoreIC::ClearInlinedVersion(Address address) {
50 UNIMPLEMENTED(); 50 UNIMPLEMENTED();
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 void KeyedLoadIC::Generate(MacroAssembler* masm, 58 void KeyedLoadIC::Generate(MacroAssembler* masm,
58 ExternalReference const& f) { 59 ExternalReference const& f) {
59 masm->int3(); // UNIMPLEMENTED. 60 // ----------- S t a t e -------------
61 // -- rsp[0] : return address
62 // -- rsp[8] : name
63 // -- rsp[16] : receiver
64 // -----------------------------------
65
66 __ movq(rax, Operand(rsp, kPointerSize));
67 __ movq(rcx, Operand(rsp, 2 * kPointerSize));
68
69 // Move the return address below the arguments.
70 __ pop(rbx);
71 __ push(rcx);
72 __ push(rax);
73 __ push(rbx);
74
75 // Perform tail call to the entry.
76 __ TailCallRuntime(f, 2);
60 } 77 }
61 78
79
62 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 80 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
63 masm->int3(); // UNIMPLEMENTED. 81 masm->int3(); // UNIMPLEMENTED.
64 } 82 }
65 83
66 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 84 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
67 masm->int3(); // UNIMPLEMENTED. 85 masm->int3(); // UNIMPLEMENTED.
68 } 86 }
69 87
70 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { 88 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) {
71 UNIMPLEMENTED(); 89 UNIMPLEMENTED();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 UNIMPLEMENTED(); 135 UNIMPLEMENTED();
118 return NULL; 136 return NULL;
119 } 137 }
120 138
121 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { 139 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
122 UNIMPLEMENTED(); 140 UNIMPLEMENTED();
123 return NULL; 141 return NULL;
124 } 142 }
125 143
126 void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) { 144 void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
127 masm->int3(); // UNIMPLEMENTED. 145 // ----------- S t a t e -------------
146 // -- rax : value
147 // -- rsp[0] : return address
148 // -- rsp[8] : key
149 // -- rsp[16] : receiver
150 // -----------------------------------
151
152 // Move the return address below the arguments.
153 __ pop(rcx);
154 __ push(Operand(rsp, 1 * kPointerSize));
155 __ push(Operand(rsp, 1 * kPointerSize));
156 __ push(rax);
157 __ push(rcx);
158
159 // Do tail-call to runtime routine.
160 __ TailCallRuntime(f, 3);
128 } 161 }
129 162
130 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { 163 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
131 masm->int3(); // UNIMPLEMENTED. 164 masm->int3(); // UNIMPLEMENTED.
132 } 165 }
133 166
134 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 167 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
135 masm->int3(); // UNIMPLEMENTED. 168 masm->int3(); // UNIMPLEMENTED.
136 } 169 }
137 170
138 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, 171 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
139 int index, 172 int index,
140 Map* transition, 173 Map* transition,
141 String* name) { 174 String* name) {
142 UNIMPLEMENTED(); 175 UNIMPLEMENTED();
143 return NULL; 176 return NULL;
144 } 177 }
145 178
179
180 void CallIC::Generate(MacroAssembler* masm,
181 int argc,
182 ExternalReference const& f) {
183 // Get the receiver of the function from the stack; 1 ~ return address.
184 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
185 // Get the name of the function to call from the stack.
186 // 2 ~ receiver, return address.
187 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize));
188
189 // Enter an internal frame.
190 __ EnterInternalFrame();
191
192 // Push the receiver and the name of the function.
193 __ push(rdx);
194 __ push(rbx);
195
196 // Call the entry.
197 CEntryStub stub;
198 __ movq(rax, Immediate(2));
199 __ movq(rbx, f);
200 __ CallStub(&stub);
201
202 // Move result to rdi and exit the internal frame.
203 __ movq(rdi, rax);
204 __ LeaveInternalFrame();
205
206 // Check if the receiver is a global object of some sort.
207 Label invoke, global;
208 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver
209 __ testq(rdx, Immediate(kSmiTagMask));
210 __ j(zero, &invoke);
211 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
212 __ movzxbq(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset));
213 __ cmpq(rcx, Immediate(static_cast<int8_t>(JS_GLOBAL_OBJECT_TYPE)));
214 __ j(equal, &global);
215 __ cmpq(rcx, Immediate(static_cast<int8_t>(JS_BUILTINS_OBJECT_TYPE)));
216 __ j(not_equal, &invoke);
217
218 // Patch the receiver on the stack.
219 __ bind(&global);
220 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
221 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
222
223 // Invoke the function.
224 ParameterCount actual(argc);
225 __ bind(&invoke);
226 __ InvokeFunction(rdi, actual, JUMP_FUNCTION);
227 }
228
229 void CallIC::GenerateMegamorphic(MacroAssembler* a, int b) {
230 UNIMPLEMENTED();
231 }
232
233 void CallIC::GenerateNormal(MacroAssembler* a, int b) {
234 UNIMPLEMENTED();
235 }
236
237
238 const int LoadIC::kOffsetToLoadInstruction = 20;
239
240
146 void LoadIC::ClearInlinedVersion(Address address) { 241 void LoadIC::ClearInlinedVersion(Address address) {
147 UNIMPLEMENTED(); 242 UNIMPLEMENTED();
148 } 243 }
149 244
245
150 void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) { 246 void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
151 masm->int3(); // UNIMPLEMENTED. 247 // ----------- S t a t e -------------
248 // -- rcx : name
249 // -- rsp[0] : return address
250 // -- rsp[8] : receiver
251 // -----------------------------------
252
253 __ movq(rax, Operand(rsp, kPointerSize));
254
255 // Move the return address below the arguments.
256 __ pop(rbx);
257 __ push(rax);
258 __ push(rcx);
259 __ push(rbx);
260
261 // Perform tail call to the entry.
262 __ TailCallRuntime(f, 2);
152 } 263 }
153 264
265
154 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { 266 void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
155 masm->int3(); // UNIMPLEMENTED. 267 masm->int3(); // UNIMPLEMENTED.
156 } 268 }
157 269
158 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { 270 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
159 masm->int3(); // UNIMPLEMENTED. 271 masm->int3(); // UNIMPLEMENTED.
160 } 272 }
161 273
162 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 274 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
163 masm->int3(); // UNIMPLEMENTED. 275 masm->int3(); // UNIMPLEMENTED.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 316
205 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 317 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
206 masm->int3(); // UNIMPLEMENTED. 318 masm->int3(); // UNIMPLEMENTED.
207 } 319 }
208 320
209 321
210 #undef __ 322 #undef __
211 323
212 324
213 } } // namespace v8::internal 325 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698