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

Side by Side Diff: runtime/vm/stub_code_ia32.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/code_generator.cc ('k') | runtime/vm/stub_code_x64.cc » ('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 (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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 // Preserve values across call to resolving. 274 // Preserve values across call to resolving.
275 // Stack at this point: 275 // Stack at this point:
276 // TOS + 0: PC marker => RawInstruction object. 276 // TOS + 0: PC marker => RawInstruction object.
277 // TOS + 1: Saved EBP of previous frame. <== EBP 277 // TOS + 1: Saved EBP of previous frame. <== EBP
278 // TOS + 2: Dart code return address 278 // TOS + 2: Dart code return address
279 // TOS + 3: Last argument of caller. 279 // TOS + 3: Last argument of caller.
280 // .... 280 // ....
281 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 281 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
282 __ movl(EAX, Address(EBP, EAX, TIMES_2, kWordSize)); // Get receiver. 282 __ movl(EAX, Address(EBP, EAX, TIMES_2, kWordSize)); // Get receiver.
283 __ pushl(EDX); // Preserve arguments descriptor array.
284 __ pushl(EAX); // Preserve receiver.
285 __ pushl(ECX); // Preserve ic-data.
286 // First resolve the function to get the function object.
287
288 __ pushl(raw_null); // Setup space on stack for return value.
289 __ pushl(EAX); // Pass receiver.
290 __ pushl(ECX); // Pass IC data object.
291 __ pushl(EDX); // Pass arguments descriptor array.
292 __ CallRuntime(kResolveCompileInstanceFunctionRuntimeEntry);
293 __ popl(EAX); // Remove arguments pushed earlier.
294 __ popl(EAX);
295 __ popl(EAX);
296 __ popl(ECX); // Pop returned code object into ECX.
297 // Pop preserved values.
298 __ popl(EDX); // Restore ic-data.
299 __ popl(EAX); // Restore receiver.
300 __ popl(EDI); // Restore arguments descriptor array.
301
302 __ cmpl(ECX, raw_null);
303 Label check_implicit_closure;
304 __ j(EQUAL, &check_implicit_closure, Assembler::kNearJump);
305
306 // Remove the stub frame as we are about to jump to the dart function.
307 __ LeaveFrame();
308
309 __ movl(EDX, EDI);
310 __ movl(ECX, FieldAddress(ECX, Code::instructions_offset()));
311 __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
312 __ jmp(ECX);
313
314 __ Bind(&check_implicit_closure);
283 // EAX: receiver. 315 // EAX: receiver.
284 // ECX: ic-data. 316 // EDX: ic-data.
285 // EDX: arguments descriptor array. 317 // ECX: raw_null.
318 // EDI: arguments descriptor array.
286 // The target function was not found. 319 // The target function was not found.
287 // First check to see if this is a getter function and we are 320 // First check to see if this is a getter function and we are
288 // trying to create a closure of an instance function. 321 // trying to create a closure of an instance function.
289 // Push values that need to be preserved across runtime call. 322 // Push values that need to be preserved across runtime call.
290 __ pushl(EAX); // Preserve receiver. 323 __ pushl(EAX); // Preserve receiver.
291 __ pushl(ECX); // Preserve ic-data. 324 __ pushl(EDX); // Preserve ic-data.
292 __ pushl(EDX); // Preserve arguments descriptor array. 325 __ pushl(EDI); // Preserve arguments descriptor array.
293 326
294 __ pushl(raw_null); // Setup space on stack for return value. 327 __ pushl(raw_null); // Setup space on stack for return value.
295 __ pushl(EAX); // Push receiver. 328 __ pushl(EAX); // Push receiver.
296 __ pushl(ECX); // Ic-data. 329 __ pushl(EDX); // Ic-data.
297 __ CallRuntime(kResolveImplicitClosureFunctionRuntimeEntry); 330 __ CallRuntime(kResolveImplicitClosureFunctionRuntimeEntry);
298 __ popl(EAX); 331 __ popl(EAX);
299 __ popl(EAX); 332 __ popl(EAX);
300 __ popl(EBX); // Get return value into EBX, might be Closure object. 333 __ popl(ECX); // Get return value into ECX, might be Closure object.
301 334
302 // Pop preserved values. 335 // Pop preserved values.
303 __ popl(EDX); // Restore arguments descriptor array. 336 __ popl(EDI); // Restore arguments descriptor array.
304 __ popl(ECX); // Restore ic-data. 337 __ popl(EDX); // Restore ic-data.
305 __ popl(EAX); // Restore receiver. 338 __ popl(EAX); // Restore receiver.
306 339
307 __ cmpl(EBX, raw_null); 340 __ cmpl(ECX, raw_null);
308 Label check_implicit_closure_through_getter; 341 Label check_implicit_closure_through_getter;
309 __ j(EQUAL, &check_implicit_closure_through_getter, Assembler::kNearJump); 342 __ j(EQUAL, &check_implicit_closure_through_getter, Assembler::kNearJump);
310 343
311 __ movl(EAX, EBX); // Return value is the closure object. 344 __ movl(EAX, ECX); // Return value is the closure object.
312 // Remove the stub frame as we are about return. 345 // Remove the stub frame as we are about return.
313 __ LeaveFrame(); 346 __ LeaveFrame();
314 __ ret(); 347 __ ret();
315 348
316 __ Bind(&check_implicit_closure_through_getter); 349 __ Bind(&check_implicit_closure_through_getter);
317 // EAX: receiver. 350 // EAX: receiver.
318 // ECX: ic-data. 351 // EDX: ic-data.
319 // EDX: arguments descriptor array. 352 // ECX: raw_null.
353 // EDI: arguments descriptor array.
320 // This is not the case of an instance so invoke the getter of the 354 // This is not the case of an instance so invoke the getter of the
321 // same name and see if we get a closure back which we are then 355 // same name and see if we get a closure back which we are then
322 // supposed to invoke. 356 // supposed to invoke.
323 // Push values that need to be preserved across runtime call. 357 // Push values that need to be preserved across runtime call.
324 __ pushl(EAX); // Preserve receiver. 358 __ pushl(EAX); // Preserve receiver.
325 __ pushl(ECX); // Preserve ic-data. 359 __ pushl(EDX); // Preserve ic-data.
326 __ pushl(EDX); // Preserve arguments descriptor array. 360 __ pushl(EDI); // Preserve arguments descriptor array.
327 361
328 __ pushl(raw_null); // Setup space on stack for return value. 362 __ pushl(raw_null); // Setup space on stack for return value.
329 __ pushl(EAX); // Push receiver. 363 __ pushl(EAX); // Push receiver.
330 __ pushl(ECX); // Ic-data. 364 __ pushl(EDX); // Ic-data.
331 __ CallRuntime(kResolveImplicitClosureThroughGetterRuntimeEntry); 365 __ CallRuntime(kResolveImplicitClosureThroughGetterRuntimeEntry);
366 __ popl(EDX); // Pop argument.
332 __ popl(EAX); // Pop argument. 367 __ popl(EAX); // Pop argument.
333 __ popl(EAX); // Pop argument. 368 __ popl(ECX); // get return value into ECX, might be Closure object.
334 __ popl(EBX); // get return value into EBX, might be Closure object.
335 369
336 // Pop preserved values. 370 // Pop preserved values.
337 __ popl(EDX); // Restore arguments descriptor array. 371 __ popl(EDI); // Restore arguments descriptor array.
338 __ popl(ECX); // Restore ic-data. 372 __ popl(EDX); // Restore ic-data.
339 __ popl(EAX); // Restore receiver. 373 __ popl(EAX); // Restore receiver.
340 374
341 __ cmpl(EBX, raw_null); 375 __ cmpl(ECX, raw_null);
342 Label function_not_found; 376 Label function_not_found;
343 __ j(EQUAL, &function_not_found, Assembler::kNearJump); 377 __ j(EQUAL, &function_not_found, Assembler::kNearJump);
344 378
345 // EBX: Closure object. 379 // ECX: Closure object.
346 // EDX: Arguments descriptor array. 380 // EDI: Arguments descriptor array.
347 __ pushl(raw_null); // Setup space on stack for result from invoking Closure. 381 __ pushl(raw_null); // Setup space on stack for result from invoking Closure.
348 __ pushl(EBX); // Closure object. 382 __ pushl(ECX); // Closure object.
349 __ pushl(EDX); // Arguments descriptor. 383 __ pushl(EDI); // Arguments descriptor.
350 __ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 384 __ movl(EDI, FieldAddress(EDI, ArgumentsDescriptor::count_offset()));
351 __ SmiUntag(EDI); 385 __ SmiUntag(EDI);
352 __ subl(EDI, Immediate(1)); // Arguments array length, minus the receiver. 386 __ subl(EDI, Immediate(1)); // Arguments array length, minus the receiver.
353 PushArgumentsArray(assembler, (kWordSize * 6)); 387 PushArgumentsArray(assembler, (kWordSize * 6));
354 // Stack layout explaining "(kWordSize * 6)" offset. 388 // Stack layout explaining "(kWordSize * 6)" offset.
355 // TOS + 0: Argument array. 389 // TOS + 0: Argument array.
356 // TOS + 1: Arguments descriptor array. 390 // TOS + 1: Arguments descriptor array.
357 // TOS + 2: Closure object. 391 // TOS + 2: Closure object.
358 // TOS + 3: Place for result from closure function. 392 // TOS + 3: Place for result from closure function.
359 // TOS + 4: PC marker => RawInstruction object. 393 // TOS + 4: PC marker => RawInstruction object.
360 // TOS + 5: Saved EBP of previous frame. <== EBP 394 // TOS + 5: Saved EBP of previous frame. <== EBP
361 // TOS + 6: Dart code return address 395 // TOS + 6: Dart code return address
362 // TOS + 7: Last argument of caller. 396 // TOS + 7: Last argument of caller.
363 // .... 397 // ....
364 398
365 __ CallRuntime(kInvokeImplicitClosureFunctionRuntimeEntry); 399 __ CallRuntime(kInvokeImplicitClosureFunctionRuntimeEntry);
366 // Remove arguments. 400 // Remove arguments.
367 __ popl(EAX); 401 __ popl(EAX);
368 __ popl(EAX); 402 __ popl(EAX);
369 __ popl(EAX); 403 __ popl(EAX);
370 __ popl(EAX); // Get result into EAX. 404 __ popl(EAX); // Get result into EAX.
371 405
372 // Remove the stub frame as we are about to return. 406 // Remove the stub frame as we are about to return.
373 __ LeaveFrame(); 407 __ LeaveFrame();
374 __ ret(); 408 __ ret();
375 409
376 __ Bind(&function_not_found); 410 __ Bind(&function_not_found);
377 // The target function was not found, so invoke method 411 // The target function was not found, so invoke method
378 // "void noSuchMethod(function_name, args_array)". 412 // "void noSuchMethod(function_name, args_array)".
379 // EAX: receiver. 413 // EAX: receiver.
380 // ECX: ic-data. 414 // EDX: ic-data.
381 // EDX: arguments descriptor array. 415 // ECX: raw_null.
416 // EDI: arguments descriptor array.
382 417
383 __ pushl(raw_null); // Setup space on stack for result from noSuchMethod. 418 __ pushl(raw_null); // Setup space on stack for result from noSuchMethod.
384 __ pushl(EAX); // Receiver. 419 __ pushl(EAX); // Receiver.
385 __ pushl(ECX); // IC-data. 420 __ pushl(EDX); // IC-data.
386 __ pushl(EDX); // Arguments descriptor array. 421 __ pushl(EDI); // Arguments descriptor array.
387 __ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 422 __ movl(EDI, FieldAddress(EDI, ArgumentsDescriptor::count_offset()));
388 __ SmiUntag(EDI); 423 __ SmiUntag(EDI);
389 __ subl(EDI, Immediate(1)); // Arguments array length, minus the receiver. 424 __ subl(EDI, Immediate(1)); // Arguments array length, minus the receiver.
390 // See stack layout below explaining "wordSize * 7" offset. 425 // See stack layout below explaining "wordSize * 7" offset.
391 PushArgumentsArray(assembler, (kWordSize * 7)); 426 PushArgumentsArray(assembler, (kWordSize * 7));
392 427
393 // Stack: 428 // Stack:
394 // TOS + 0: Arguments array. 429 // TOS + 0: Arguments array.
395 // TOS + 1: Arguments descriptor array. 430 // TOS + 1: Arguments descriptor array.
396 // TOS + 2: IC-data. 431 // TOS + 2: IC-data.
397 // TOS + 3: Receiver 432 // TOS + 3: Receiver
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 __ Bind(&done); 2216 __ Bind(&done);
2182 __ popl(temp); 2217 __ popl(temp);
2183 __ popl(right); 2218 __ popl(right);
2184 __ popl(left); 2219 __ popl(left);
2185 __ ret(); 2220 __ ret();
2186 } 2221 }
2187 2222
2188 } // namespace dart 2223 } // namespace dart
2189 2224
2190 #endif // defined TARGET_ARCH_IA32 2225 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698