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

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 11467015: Revert "Do not call ResolveCompileInstanceFunction from the lookup stub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 // Preserve values across call to resolving. 269 // Preserve values across call to resolving.
270 // Stack at this point: 270 // Stack at this point:
271 // TOS + 0: PC marker => RawInstruction object. 271 // TOS + 0: PC marker => RawInstruction object.
272 // TOS + 1: Saved RBP of previous frame. <== RBP 272 // TOS + 1: Saved RBP of previous frame. <== RBP
273 // TOS + 2: Dart code return address 273 // TOS + 2: Dart code return address
274 // TOS + 3: Last argument of caller. 274 // TOS + 3: Last argument of caller.
275 // .... 275 // ....
276 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 276 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
277 __ movq(RAX, Address(RBP, RAX, TIMES_4, kWordSize)); // Get receiver. 277 __ movq(RAX, Address(RBP, RAX, TIMES_4, kWordSize)); // Get receiver.
278 __ pushq(R10); // Preserve arguments descriptor array.
279 __ pushq(RAX); // Preserve receiver.
280 __ pushq(RBX); // Preserve ic-data.
281 // First resolve the function to get the function object.
282
283 __ pushq(raw_null); // Setup space on stack for return value.
284 __ pushq(RAX); // Pass receiver.
285 __ pushq(RBX); // Pass IC data object.
286 __ pushq(R10); // Pass arguments descriptor array.
287 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry);
288 __ popq(RAX); // Remove arguments pushed earlier.
289 __ popq(RAX);
290 __ popq(RAX);
291 __ popq(RBX); // Pop returned code object into RBX.
292 // Pop preserved values
293 __ popq(R10); // Restore ic-data.
294 __ popq(RAX); // Restore receiver.
295 __ popq(R13); // Restore arguments descriptor array.
296
297 __ cmpq(RBX, raw_null);
298 Label check_implicit_closure;
299 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump);
300
301 // Remove the stub frame as we are about to jump to the dart function.
302 __ LeaveFrame();
303
304 __ movq(R10, R13);
305 __ movq(RBX, FieldAddress(RBX, Code::instructions_offset()));
306 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
307 __ jmp(RBX);
308
309 __ Bind(&check_implicit_closure);
278 // RAX: receiver. 310 // RAX: receiver.
279 // RBX: ic-data. 311 // R10: ic-data.
280 // R10: arguments descriptor array. 312 // RBX: raw_null.
313 // R13: arguments descriptor array.
281 // The target function was not found. 314 // The target function was not found.
282 // First check to see if this is a getter function and we are 315 // First check to see if this is a getter function and we are
283 // trying to create a closure of an instance function. 316 // trying to create a closure of an instance function.
284 // Push values that need to be preserved across runtime call. 317 // Push values that need to be preserved across runtime call.
285 __ pushq(RAX); // Preserve receiver. 318 __ pushq(RAX); // Preserve receiver.
286 __ pushq(RBX); // Preserve ic-data. 319 __ pushq(R10); // Preserve ic-data.
287 __ pushq(R10); // Preserve arguments descriptor array. 320 __ pushq(R13); // Preserve arguments descriptor array.
288 321
289 __ pushq(raw_null); // Setup space on stack for return value. 322 __ pushq(raw_null); // Setup space on stack for return value.
290 __ pushq(RAX); // Push receiver. 323 __ pushq(RAX); // Push receiver.
291 __ pushq(RBX); // Ic-data array. 324 __ pushq(R10); // Ic-data array.
292 __ CallRuntime(kResolveImplicitClosureFunctionRuntimeEntry); 325 __ CallRuntime(kResolveImplicitClosureFunctionRuntimeEntry);
293 __ popq(RAX); 326 __ popq(RAX);
294 __ popq(RAX); 327 __ popq(RAX);
295 __ popq(RCX); // Get return value into RCX, might be Closure object. 328 __ popq(RBX); // Get return value into RBX, might be Closure object.
296 329
297 // Pop preserved values. 330 // Pop preserved values.
298 __ popq(R10); // Restore arguments descriptor array. 331 __ popq(R13); // Restore arguments descriptor array.
299 __ popq(RBX); // Restore ic-data. 332 __ popq(R10); // Restore ic-data.
300 __ popq(RAX); // Restore receiver. 333 __ popq(RAX); // Restore receiver.
301 334
302 __ cmpq(RCX, raw_null); 335 __ cmpq(RBX, raw_null);
303 Label check_implicit_closure_through_getter; 336 Label check_implicit_closure_through_getter;
304 __ j(EQUAL, &check_implicit_closure_through_getter, Assembler::kNearJump); 337 __ j(EQUAL, &check_implicit_closure_through_getter, Assembler::kNearJump);
305 338
306 __ movq(RAX, RCX); // Return value is the closure object. 339 __ movq(RAX, RBX); // Return value is the closure object.
307 // Remove the stub frame as we are about return. 340 // Remove the stub frame as we are about return.
308 __ LeaveFrame(); 341 __ LeaveFrame();
309 __ ret(); 342 __ ret();
310 343
311 __ Bind(&check_implicit_closure_through_getter); 344 __ Bind(&check_implicit_closure_through_getter);
312 // RAX: receiver. 345 // RAX: receiver.
313 // RBX: ic-data. 346 // R10: ic-data.
314 // R10: arguments descriptor array. 347 // RBX: raw_null.
348 // R13: arguments descriptor array.
315 // This is not the case of an instance so invoke the getter of the 349 // This is not the case of an instance so invoke the getter of the
316 // same name and see if we get a closure back which we are then 350 // same name and see if we get a closure back which we are then
317 // supposed to invoke. 351 // supposed to invoke.
318 // Push values that need to be preserved across runtime call. 352 // Push values that need to be preserved across runtime call.
319 __ pushq(RAX); // Preserve receiver. 353 __ pushq(RAX); // Preserve receiver.
320 __ pushq(RBX); // Preserve ic-data. 354 __ pushq(R10); // Preserve ic-data.
321 __ pushq(R10); // Preserve arguments descriptor array. 355 __ pushq(R13); // Preserve arguments descriptor array.
322 356
323 __ pushq(raw_null); // Setup space on stack for return value. 357 __ pushq(raw_null); // Setup space on stack for return value.
324 __ pushq(RAX); // Push receiver. 358 __ pushq(RAX); // Push receiver.
325 __ pushq(RBX); // Ic-data array. 359 __ pushq(R10); // Ic-data array.
326 __ CallRuntime(kResolveImplicitClosureThroughGetterRuntimeEntry); 360 __ CallRuntime(kResolveImplicitClosureThroughGetterRuntimeEntry);
361 __ popq(R10); // Pop argument.
327 __ popq(RAX); // Pop argument. 362 __ popq(RAX); // Pop argument.
328 __ popq(RAX); // Pop argument. 363 __ popq(RBX); // get return value into RBX, might be Closure object.
329 __ popq(RCX); // get return value into RCX, might be Closure object.
330 364
331 // Pop preserved values. 365 // Pop preserved values.
332 __ popq(R10); // Restore arguments descriptor array. 366 __ popq(R13); // Restore arguments descriptor array.
333 __ popq(RBX); // Restore ic-data. 367 __ popq(R10); // Restore ic-data.
334 __ popq(RAX); // Restore receiver. 368 __ popq(RAX); // Restore receiver.
335 369
336 __ cmpq(RCX, raw_null); 370 __ cmpq(RBX, raw_null);
337 Label function_not_found; 371 Label function_not_found;
338 __ j(EQUAL, &function_not_found, Assembler::kNearJump); 372 __ j(EQUAL, &function_not_found);
339 373
340 // RCX: Closure object. 374 // RBX: Closure object.
341 // R10: Arguments descriptor array. 375 // R13: Arguments descriptor array.
342 __ pushq(raw_null); // Setup space on stack for result from invoking Closure. 376 __ pushq(raw_null); // Setup space on stack for result from invoking Closure.
343 __ pushq(RCX); // Closure object. 377 __ pushq(RBX); // Closure object.
344 __ pushq(R10); // Arguments descriptor. 378 __ pushq(R13); // Arguments descriptor.
345 __ movq(R13, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 379 __ movq(R13, FieldAddress(R13, ArgumentsDescriptor::count_offset()));
346 __ SmiUntag(R13); 380 __ SmiUntag(R13);
347 __ subq(R13, Immediate(1)); // Arguments array length, minus the receiver. 381 __ subq(R13, Immediate(1)); // Arguments array length, minus the receiver.
348 PushArgumentsArray(assembler, (kWordSize * 6)); 382 PushArgumentsArray(assembler, (kWordSize * 6));
349 // Stack layout explaining "(kWordSize * 6)" offset. 383 // Stack layout explaining "(kWordSize * 6)" offset.
350 // TOS + 0: Argument array. 384 // TOS + 0: Argument array.
351 // TOS + 1: Arguments descriptor array. 385 // TOS + 1: Arguments descriptor array.
352 // TOS + 2: Closure object. 386 // TOS + 2: Closure object.
353 // TOS + 3: Place for result from closure function. 387 // TOS + 3: Place for result from closure function.
354 // TOS + 4: PC marker => RawInstruction object. 388 // TOS + 4: PC marker => RawInstruction object.
355 // TOS + 5: Saved RBP of previous frame. <== RBP 389 // TOS + 5: Saved RBP of previous frame. <== RBP
356 // TOS + 6: Dart code return address 390 // TOS + 6: Dart code return address
357 // TOS + 7: Last argument of caller. 391 // TOS + 7: Last argument of caller.
358 // .... 392 // ....
359 393
360 __ CallRuntime(kInvokeImplicitClosureFunctionRuntimeEntry); 394 __ CallRuntime(kInvokeImplicitClosureFunctionRuntimeEntry);
361 // Remove arguments. 395 // Remove arguments.
362 __ popq(RAX); 396 __ popq(RAX);
363 __ popq(RAX); 397 __ popq(RAX);
364 __ popq(RAX); 398 __ popq(RAX);
365 __ popq(RAX); // Get result into RAX. 399 __ popq(RAX); // Get result into RAX.
366 400
367 // Remove the stub frame as we are about to return. 401 // Remove the stub frame as we are about to return.
368 __ LeaveFrame(); 402 __ LeaveFrame();
369 __ ret(); 403 __ ret();
370 404
371 __ Bind(&function_not_found); 405 __ Bind(&function_not_found);
372 // The target function was not found, so invoke method 406 // The target function was not found, so invoke method
373 // "void noSuchMethod(function_name, args_array)". 407 // "void noSuchMethod(function_name, args_array)".
374 // RAX: receiver. 408 // RAX: receiver.
375 // RBX: ic-data. 409 // R10: ic-data.
376 // R10: arguments descriptor array. 410 // RBX: raw_null.
411 // R13: arguments descriptor array.
377 412
378 __ pushq(raw_null); // Setup space on stack for result from noSuchMethod. 413 __ pushq(raw_null); // Setup space on stack for result from noSuchMethod.
379 __ pushq(RAX); // Receiver. 414 __ pushq(RAX); // Receiver.
380 __ pushq(RBX); // IC-data array. 415 __ pushq(R10); // IC-data array.
381 __ pushq(R10); // Arguments descriptor array. 416 __ pushq(R13); // Arguments descriptor array.
382 __ movq(R13, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 417 __ movq(R13, FieldAddress(R13, ArgumentsDescriptor::count_offset()));
383 __ SmiUntag(R13); 418 __ SmiUntag(R13);
384 __ subq(R13, Immediate(1)); // Arguments array length, minus the receiver. 419 __ subq(R13, Immediate(1)); // Arguments array length, minus the receiver.
385 // See stack layout below explaining "wordSize * 7" offset. 420 // See stack layout below explaining "wordSize * 7" offset.
386 PushArgumentsArray(assembler, (kWordSize * 7)); 421 PushArgumentsArray(assembler, (kWordSize * 7));
387 422
388 // Stack: 423 // Stack:
389 // TOS + 0: Arguments array. 424 // TOS + 0: Arguments array.
390 // TOS + 1: Arguments descriptor array. 425 // TOS + 1: Arguments descriptor array.
391 // TOS + 2: IC-data array. 426 // TOS + 2: IC-data array.
392 // TOS + 3: Receiver. 427 // TOS + 3: Receiver.
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 __ cmpq(left, right); 2167 __ cmpq(left, right);
2133 __ Bind(&done); 2168 __ Bind(&done);
2134 __ popq(right); 2169 __ popq(right);
2135 __ popq(left); 2170 __ popq(left);
2136 __ ret(); 2171 __ ret();
2137 } 2172 }
2138 2173
2139 } // namespace dart 2174 } // namespace dart
2140 2175
2141 #endif // defined TARGET_ARCH_X64 2176 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698