| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 END_LEAF_RUNTIME_ENTRY | 102 END_LEAF_RUNTIME_ENTRY |
| 103 | 103 |
| 104 | 104 |
| 105 // Input parameters: | 105 // Input parameters: |
| 106 // RSP : points to return address. | 106 // RSP : points to return address. |
| 107 // RDI : stop message (const char*). | 107 // RDI : stop message (const char*). |
| 108 // Must preserve all registers. | 108 // Must preserve all registers. |
| 109 void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { | 109 void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { |
| 110 __ EnterCallRuntimeFrame(0); | 110 __ EnterCallRuntimeFrame(0); |
| 111 // Call the runtime leaf function. RDI already contains the parameter. | 111 // Call the runtime leaf function. RDI already contains the parameter. |
| 112 __ CallRuntime(kPrintStopMessageRuntimeEntry); | 112 __ CallRuntime(kPrintStopMessageRuntimeEntry, 1); |
| 113 __ LeaveCallRuntimeFrame(); | 113 __ LeaveCallRuntimeFrame(); |
| 114 __ ret(); | 114 __ ret(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 // Input parameters: | 118 // Input parameters: |
| 119 // RSP : points to return address. | 119 // RSP : points to return address. |
| 120 // RSP + 8 : address of return value. | 120 // RSP + 8 : address of return value. |
| 121 // RAX : address of first argument in argument array. | 121 // RAX : address of first argument in argument array. |
| 122 // RBX : address of the native function to call. | 122 // RBX : address of the native function to call. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 | 254 |
| 255 // Input parameters: | 255 // Input parameters: |
| 256 // R10: arguments descriptor array. | 256 // R10: arguments descriptor array. |
| 257 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { | 257 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { |
| 258 const Immediate& raw_null = | 258 const Immediate& raw_null = |
| 259 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 259 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 260 __ EnterStubFrame(); | 260 __ EnterStubFrame(); |
| 261 __ pushq(R10); // Preserve arguments descriptor array. | 261 __ pushq(R10); // Preserve arguments descriptor array. |
| 262 __ pushq(raw_null); // Setup space on stack for return value. | 262 __ pushq(raw_null); // Setup space on stack for return value. |
| 263 __ CallRuntime(kPatchStaticCallRuntimeEntry); | 263 __ CallRuntime(kPatchStaticCallRuntimeEntry, 0); |
| 264 __ popq(RAX); // Get Code object result. | 264 __ popq(RAX); // Get Code object result. |
| 265 __ popq(R10); // Restore arguments descriptor array. | 265 __ popq(R10); // Restore arguments descriptor array. |
| 266 // Remove the stub frame as we are about to jump to the dart function. | 266 // Remove the stub frame as we are about to jump to the dart function. |
| 267 __ LeaveFrame(); | 267 __ LeaveFrame(); |
| 268 | 268 |
| 269 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); | 269 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); |
| 270 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 270 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 271 __ jmp(RBX); | 271 __ jmp(RBX); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 // Called from a static call only when an invalid code has been entered | 275 // Called from a static call only when an invalid code has been entered |
| 276 // (invalid because its function was optimized or deoptimized). | 276 // (invalid because its function was optimized or deoptimized). |
| 277 // R10: arguments descriptor array. | 277 // R10: arguments descriptor array. |
| 278 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { | 278 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { |
| 279 const Immediate& raw_null = | 279 const Immediate& raw_null = |
| 280 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 280 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 281 __ EnterStubFrame(); | 281 __ EnterStubFrame(); |
| 282 __ pushq(R10); // Preserve arguments descriptor array. | 282 __ pushq(R10); // Preserve arguments descriptor array. |
| 283 __ pushq(raw_null); // Setup space on stack for return value. | 283 __ pushq(raw_null); // Setup space on stack for return value. |
| 284 __ CallRuntime(kFixCallersTargetRuntimeEntry); | 284 __ CallRuntime(kFixCallersTargetRuntimeEntry, 0); |
| 285 __ popq(RAX); // Get Code object. | 285 __ popq(RAX); // Get Code object. |
| 286 __ popq(R10); // Restore arguments descriptor array. | 286 __ popq(R10); // Restore arguments descriptor array. |
| 287 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); | 287 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); |
| 288 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 288 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 289 __ LeaveFrame(); | 289 __ LeaveFrame(); |
| 290 __ jmp(RAX); | 290 __ jmp(RAX); |
| 291 __ int3(); | 291 __ int3(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 | 294 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 __ movq(R13, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 343 __ movq(R13, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 344 __ pushq(Address(RSP, R13, TIMES_4, (3 * kWordSize))); | 344 __ pushq(Address(RSP, R13, TIMES_4, (3 * kWordSize))); |
| 345 | 345 |
| 346 __ pushq(RBX); // Pass IC data object. | 346 __ pushq(RBX); // Pass IC data object. |
| 347 __ pushq(R10); // Pass arguments descriptor array. | 347 __ pushq(R10); // Pass arguments descriptor array. |
| 348 | 348 |
| 349 // Pass the call's arguments array. | 349 // Pass the call's arguments array. |
| 350 __ movq(R10, R13); // Smi-tagged arguments array length. | 350 __ movq(R10, R13); // Smi-tagged arguments array length. |
| 351 PushArgumentsArray(assembler); | 351 PushArgumentsArray(assembler); |
| 352 | 352 |
| 353 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); | 353 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry, 4); |
| 354 | 354 |
| 355 // Remove arguments. | 355 // Remove arguments. |
| 356 __ Drop(4); | 356 __ Drop(4); |
| 357 __ popq(RAX); // Get result into RAX. | 357 __ popq(RAX); // Get result into RAX. |
| 358 __ LeaveFrame(); | 358 __ LeaveFrame(); |
| 359 __ ret(); | 359 __ ret(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 | 362 |
| 363 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 363 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 __ subq(RSP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize)); | 407 __ subq(RSP, Immediate(kNumberOfXmmRegisters * kFpuRegisterSize)); |
| 408 intptr_t offset = 0; | 408 intptr_t offset = 0; |
| 409 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { | 409 for (intptr_t reg_idx = 0; reg_idx < kNumberOfXmmRegisters; ++reg_idx) { |
| 410 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); | 410 XmmRegister xmm_reg = static_cast<XmmRegister>(reg_idx); |
| 411 __ movups(Address(RSP, offset), xmm_reg); | 411 __ movups(Address(RSP, offset), xmm_reg); |
| 412 offset += kFpuRegisterSize; | 412 offset += kFpuRegisterSize; |
| 413 } | 413 } |
| 414 | 414 |
| 415 __ movq(RDI, RSP); // Pass address of saved registers block. | 415 __ movq(RDI, RSP); // Pass address of saved registers block. |
| 416 __ ReserveAlignedFrameSpace(0); | 416 __ ReserveAlignedFrameSpace(0); |
| 417 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); | 417 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1); |
| 418 // Result (RAX) is stack-size (FP - SP) in bytes. | 418 // Result (RAX) is stack-size (FP - SP) in bytes. |
| 419 | 419 |
| 420 if (preserve_result) { | 420 if (preserve_result) { |
| 421 // Restore result into RBX temporarily. | 421 // Restore result into RBX temporarily. |
| 422 __ movq(RBX, Address(RBP, saved_result_slot_from_fp * kWordSize)); | 422 __ movq(RBX, Address(RBP, saved_result_slot_from_fp * kWordSize)); |
| 423 } | 423 } |
| 424 | 424 |
| 425 __ LeaveFrame(); | 425 __ LeaveFrame(); |
| 426 __ popq(RCX); // Preserve return address. | 426 __ popq(RCX); // Preserve return address. |
| 427 __ movq(RSP, RBP); // Discard optimized frame. | 427 __ movq(RSP, RBP); // Discard optimized frame. |
| 428 __ subq(RSP, RAX); // Reserve space for deoptimized frame. | 428 __ subq(RSP, RAX); // Reserve space for deoptimized frame. |
| 429 __ pushq(RCX); // Restore return address. | 429 __ pushq(RCX); // Restore return address. |
| 430 | 430 |
| 431 // Leaf runtime function DeoptimizeFillFrame expects a Dart frame. | 431 // Leaf runtime function DeoptimizeFillFrame expects a Dart frame. |
| 432 __ EnterDartFrame(0); | 432 __ EnterDartFrame(0); |
| 433 if (preserve_result) { | 433 if (preserve_result) { |
| 434 __ pushq(RBX); // Preserve result as first local. | 434 __ pushq(RBX); // Preserve result as first local. |
| 435 } | 435 } |
| 436 __ ReserveAlignedFrameSpace(0); | 436 __ ReserveAlignedFrameSpace(0); |
| 437 __ movq(RDI, RBP); // Pass last FP as parameter in RDI. | 437 __ movq(RDI, RBP); // Pass last FP as parameter in RDI. |
| 438 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); | 438 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1); |
| 439 if (preserve_result) { | 439 if (preserve_result) { |
| 440 // Restore result into RBX. | 440 // Restore result into RBX. |
| 441 __ movq(RBX, Address(RBP, kFirstLocalSlotFromFp * kWordSize)); | 441 __ movq(RBX, Address(RBP, kFirstLocalSlotFromFp * kWordSize)); |
| 442 } | 442 } |
| 443 // Code above cannot cause GC. | 443 // Code above cannot cause GC. |
| 444 __ LeaveFrame(); | 444 __ LeaveFrame(); |
| 445 | 445 |
| 446 // Frame is fully rewritten at this point and it is safe to perform a GC. | 446 // Frame is fully rewritten at this point and it is safe to perform a GC. |
| 447 // Materialize any objects that were deferred by FillFrame because they | 447 // Materialize any objects that were deferred by FillFrame because they |
| 448 // require allocation. | 448 // require allocation. |
| 449 __ EnterStubFrame(); | 449 __ EnterStubFrame(); |
| 450 if (preserve_result) { | 450 if (preserve_result) { |
| 451 __ pushq(RBX); // Preserve result, it will be GC-d here. | 451 __ pushq(RBX); // Preserve result, it will be GC-d here. |
| 452 } | 452 } |
| 453 __ pushq(Immediate(Smi::RawValue(0))); // Space for the result. | 453 __ pushq(Immediate(Smi::RawValue(0))); // Space for the result. |
| 454 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry); | 454 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0); |
| 455 // Result tells stub how many bytes to remove from the expression stack | 455 // Result tells stub how many bytes to remove from the expression stack |
| 456 // of the bottom-most frame. They were used as materialization arguments. | 456 // of the bottom-most frame. They were used as materialization arguments. |
| 457 __ popq(RBX); | 457 __ popq(RBX); |
| 458 __ SmiUntag(RBX); | 458 __ SmiUntag(RBX); |
| 459 if (preserve_result) { | 459 if (preserve_result) { |
| 460 __ popq(RAX); // Restore result. | 460 __ popq(RAX); // Restore result. |
| 461 } | 461 } |
| 462 __ LeaveFrame(); | 462 __ LeaveFrame(); |
| 463 | 463 |
| 464 __ popq(RCX); // Pop return address. | 464 __ popq(RCX); // Pop return address. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 // Preserve IC data and arguments descriptor. | 496 // Preserve IC data and arguments descriptor. |
| 497 __ pushq(RBX); | 497 __ pushq(RBX); |
| 498 __ pushq(R10); | 498 __ pushq(R10); |
| 499 | 499 |
| 500 const Immediate& raw_null = | 500 const Immediate& raw_null = |
| 501 Immediate(reinterpret_cast<intptr_t>(Instructions::null())); | 501 Immediate(reinterpret_cast<intptr_t>(Instructions::null())); |
| 502 __ pushq(raw_null); // Space for the result of the runtime call. | 502 __ pushq(raw_null); // Space for the result of the runtime call. |
| 503 __ pushq(RAX); // Receiver. | 503 __ pushq(RAX); // Receiver. |
| 504 __ pushq(RBX); // IC data. | 504 __ pushq(RBX); // IC data. |
| 505 __ pushq(R10); // Arguments descriptor. | 505 __ pushq(R10); // Arguments descriptor. |
| 506 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry); | 506 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3); |
| 507 // Discard arguments. | 507 // Discard arguments. |
| 508 __ popq(RAX); | 508 __ popq(RAX); |
| 509 __ popq(RAX); | 509 __ popq(RAX); |
| 510 __ popq(RAX); | 510 __ popq(RAX); |
| 511 __ popq(RAX); // Return value from the runtime call (instructions). | 511 __ popq(RAX); // Return value from the runtime call (instructions). |
| 512 __ popq(R10); // Restore arguments descriptor. | 512 __ popq(R10); // Restore arguments descriptor. |
| 513 __ popq(RBX); // Restore IC data. | 513 __ popq(RBX); // Restore IC data. |
| 514 __ LeaveFrame(); | 514 __ LeaveFrame(); |
| 515 | 515 |
| 516 Label lookup; | 516 Label lookup; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 // Unable to allocate the array using the fast inline code, just call | 642 // Unable to allocate the array using the fast inline code, just call |
| 643 // into the runtime. | 643 // into the runtime. |
| 644 __ Bind(&slow_case); | 644 __ Bind(&slow_case); |
| 645 // Create a stub frame as we are pushing some objects on the stack before | 645 // Create a stub frame as we are pushing some objects on the stack before |
| 646 // calling into the runtime. | 646 // calling into the runtime. |
| 647 __ EnterStubFrame(); | 647 __ EnterStubFrame(); |
| 648 __ pushq(raw_null); // Setup space on stack for return value. | 648 __ pushq(raw_null); // Setup space on stack for return value. |
| 649 __ pushq(R10); // Array length as Smi. | 649 __ pushq(R10); // Array length as Smi. |
| 650 __ pushq(RBX); // Element type. | 650 __ pushq(RBX); // Element type. |
| 651 __ CallRuntime(kAllocateArrayRuntimeEntry); | 651 __ CallRuntime(kAllocateArrayRuntimeEntry, 2); |
| 652 __ popq(RAX); // Pop element type argument. | 652 __ popq(RAX); // Pop element type argument. |
| 653 __ popq(R10); // Pop array length argument. | 653 __ popq(R10); // Pop array length argument. |
| 654 __ popq(RAX); // Pop return value from return slot. | 654 __ popq(RAX); // Pop return value from return slot. |
| 655 __ LeaveFrame(); | 655 __ LeaveFrame(); |
| 656 __ ret(); | 656 __ ret(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 | 659 |
| 660 // Input parameters: | 660 // Input parameters: |
| 661 // R10: Arguments descriptor array. | 661 // R10: Arguments descriptor array. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 __ cmpq(RAX, raw_null); | 697 __ cmpq(RAX, raw_null); |
| 698 Label function_compiled; | 698 Label function_compiled; |
| 699 __ j(NOT_EQUAL, &function_compiled, Assembler::kNearJump); | 699 __ j(NOT_EQUAL, &function_compiled, Assembler::kNearJump); |
| 700 | 700 |
| 701 // Create a stub frame as we are pushing some objects on the stack before | 701 // Create a stub frame as we are pushing some objects on the stack before |
| 702 // calling into the runtime. | 702 // calling into the runtime. |
| 703 __ EnterStubFrame(); | 703 __ EnterStubFrame(); |
| 704 | 704 |
| 705 __ pushq(R10); // Preserve arguments descriptor array. | 705 __ pushq(R10); // Preserve arguments descriptor array. |
| 706 __ pushq(RBX); // Preserve read-only function object argument. | 706 __ pushq(RBX); // Preserve read-only function object argument. |
| 707 __ CallRuntime(kCompileFunctionRuntimeEntry); | 707 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 708 __ popq(RBX); // Restore read-only function object argument in RBX. | 708 __ popq(RBX); // Restore read-only function object argument in RBX. |
| 709 __ popq(R10); // Restore arguments descriptor array. | 709 __ popq(R10); // Restore arguments descriptor array. |
| 710 // Restore RAX. | 710 // Restore RAX. |
| 711 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); | 711 __ movq(RAX, FieldAddress(RBX, Function::code_offset())); |
| 712 | 712 |
| 713 // Remove the stub frame as we are about to jump to the closure function. | 713 // Remove the stub frame as we are about to jump to the closure function. |
| 714 __ LeaveFrame(); | 714 __ LeaveFrame(); |
| 715 | 715 |
| 716 __ Bind(&function_compiled); | 716 __ Bind(&function_compiled); |
| 717 // RAX: Code. | 717 // RAX: Code. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 733 // Create a stub frame as we are pushing some objects on the stack before | 733 // Create a stub frame as we are pushing some objects on the stack before |
| 734 // calling into the runtime. | 734 // calling into the runtime. |
| 735 __ EnterStubFrame(); | 735 __ EnterStubFrame(); |
| 736 | 736 |
| 737 __ pushq(raw_null); // Setup space on stack for result from call. | 737 __ pushq(raw_null); // Setup space on stack for result from call. |
| 738 __ pushq(R10); // Arguments descriptor. | 738 __ pushq(R10); // Arguments descriptor. |
| 739 // Load smi-tagged arguments array length, including the non-closure. | 739 // Load smi-tagged arguments array length, including the non-closure. |
| 740 __ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 740 __ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 741 PushArgumentsArray(assembler); | 741 PushArgumentsArray(assembler); |
| 742 | 742 |
| 743 __ CallRuntime(kInvokeNonClosureRuntimeEntry); | 743 __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2); |
| 744 | 744 |
| 745 // Remove arguments. | 745 // Remove arguments. |
| 746 __ Drop(2); | 746 __ Drop(2); |
| 747 __ popq(RAX); // Get result into RAX. | 747 __ popq(RAX); // Get result into RAX. |
| 748 | 748 |
| 749 // Remove the stub frame as we are about to return. | 749 // Remove the stub frame as we are about to return. |
| 750 __ LeaveFrame(); | 750 __ LeaveFrame(); |
| 751 __ ret(); | 751 __ ret(); |
| 752 } | 752 } |
| 753 | 753 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 // RAX: new object. | 984 // RAX: new object. |
| 985 __ ret(); | 985 __ ret(); |
| 986 | 986 |
| 987 __ Bind(&slow_case); | 987 __ Bind(&slow_case); |
| 988 } | 988 } |
| 989 // Create a stub frame. | 989 // Create a stub frame. |
| 990 __ EnterStubFrame(); | 990 __ EnterStubFrame(); |
| 991 __ pushq(raw_null); // Setup space on stack for the return value. | 991 __ pushq(raw_null); // Setup space on stack for the return value. |
| 992 __ SmiTag(R10); | 992 __ SmiTag(R10); |
| 993 __ pushq(R10); // Push number of context variables. | 993 __ pushq(R10); // Push number of context variables. |
| 994 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. | 994 __ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context. |
| 995 __ popq(RAX); // Pop number of context variables argument. | 995 __ popq(RAX); // Pop number of context variables argument. |
| 996 __ popq(RAX); // Pop the new context object. | 996 __ popq(RAX); // Pop the new context object. |
| 997 // RAX: new object | 997 // RAX: new object |
| 998 // Restore the frame pointer. | 998 // Restore the frame pointer. |
| 999 __ LeaveFrame(); | 999 __ LeaveFrame(); |
| 1000 __ ret(); | 1000 __ ret(); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 | 1003 |
| 1004 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 1004 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 __ popq(RCX); | 1050 __ popq(RCX); |
| 1051 __ popq(RDX); | 1051 __ popq(RDX); |
| 1052 __ j(EQUAL, &L, Assembler::kNearJump); | 1052 __ j(EQUAL, &L, Assembler::kNearJump); |
| 1053 __ ret(); | 1053 __ ret(); |
| 1054 | 1054 |
| 1055 // Handle overflow: Call the runtime leaf function. | 1055 // Handle overflow: Call the runtime leaf function. |
| 1056 __ Bind(&L); | 1056 __ Bind(&L); |
| 1057 // Setup frame, push callee-saved registers. | 1057 // Setup frame, push callee-saved registers. |
| 1058 __ EnterCallRuntimeFrame(0); | 1058 __ EnterCallRuntimeFrame(0); |
| 1059 __ movq(RDI, FieldAddress(CTX, Context::isolate_offset())); | 1059 __ movq(RDI, FieldAddress(CTX, Context::isolate_offset())); |
| 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry); | 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
| 1061 __ LeaveCallRuntimeFrame(); | 1061 __ LeaveCallRuntimeFrame(); |
| 1062 __ ret(); | 1062 __ ret(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 | 1065 |
| 1066 // Called for inline allocation of objects. | 1066 // Called for inline allocation of objects. |
| 1067 // Input parameters: | 1067 // Input parameters: |
| 1068 // RSP + 16 : type arguments object (only if class is parameterized). | 1068 // RSP + 16 : type arguments object (only if class is parameterized). |
| 1069 // RSP + 8 : type arguments of instantiator (only if class is parameterized). | 1069 // RSP + 8 : type arguments of instantiator (only if class is parameterized). |
| 1070 // RSP : points to return address. | 1070 // RSP : points to return address. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 __ EnterStubFrame(); | 1220 __ EnterStubFrame(); |
| 1221 __ pushq(raw_null); // Setup space on stack for return value. | 1221 __ pushq(raw_null); // Setup space on stack for return value. |
| 1222 __ PushObject(cls); // Push class of object to be allocated. | 1222 __ PushObject(cls); // Push class of object to be allocated. |
| 1223 if (is_cls_parameterized) { | 1223 if (is_cls_parameterized) { |
| 1224 __ pushq(RAX); // Push type arguments of object to be allocated. | 1224 __ pushq(RAX); // Push type arguments of object to be allocated. |
| 1225 __ pushq(RDX); // Push type arguments of instantiator. | 1225 __ pushq(RDX); // Push type arguments of instantiator. |
| 1226 } else { | 1226 } else { |
| 1227 __ pushq(raw_null); // Push null type arguments. | 1227 __ pushq(raw_null); // Push null type arguments. |
| 1228 __ pushq(Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 1228 __ pushq(Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
| 1229 } | 1229 } |
| 1230 __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object. | 1230 __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object. |
| 1231 __ popq(RAX); // Pop argument (instantiator). | 1231 __ popq(RAX); // Pop argument (instantiator). |
| 1232 __ popq(RAX); // Pop argument (type arguments of object). | 1232 __ popq(RAX); // Pop argument (type arguments of object). |
| 1233 __ popq(RAX); // Pop argument (class of object). | 1233 __ popq(RAX); // Pop argument (class of object). |
| 1234 __ popq(RAX); // Pop result (newly allocated object). | 1234 __ popq(RAX); // Pop result (newly allocated object). |
| 1235 // RAX: new object | 1235 // RAX: new object |
| 1236 // Restore the frame pointer. | 1236 // Restore the frame pointer. |
| 1237 __ LeaveFrame(); | 1237 __ LeaveFrame(); |
| 1238 __ ret(); | 1238 __ ret(); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 __ PushObject(func); | 1356 __ PushObject(func); |
| 1357 if (is_implicit_instance_closure) { | 1357 if (is_implicit_instance_closure) { |
| 1358 __ pushq(RAX); // Receiver. | 1358 __ pushq(RAX); // Receiver. |
| 1359 } | 1359 } |
| 1360 if (has_type_arguments) { | 1360 if (has_type_arguments) { |
| 1361 __ pushq(RCX); // Push type arguments of closure to be allocated. | 1361 __ pushq(RCX); // Push type arguments of closure to be allocated. |
| 1362 } else { | 1362 } else { |
| 1363 __ pushq(raw_null); // Push null type arguments. | 1363 __ pushq(raw_null); // Push null type arguments. |
| 1364 } | 1364 } |
| 1365 if (is_implicit_instance_closure) { | 1365 if (is_implicit_instance_closure) { |
| 1366 __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry); | 1366 __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry, 3); |
| 1367 __ popq(RAX); // Pop type arguments. | 1367 __ popq(RAX); // Pop type arguments. |
| 1368 __ popq(RAX); // Pop receiver. | 1368 __ popq(RAX); // Pop receiver. |
| 1369 } else { | 1369 } else { |
| 1370 ASSERT(func.IsNonImplicitClosureFunction()); | 1370 ASSERT(func.IsNonImplicitClosureFunction()); |
| 1371 __ CallRuntime(kAllocateClosureRuntimeEntry); | 1371 __ CallRuntime(kAllocateClosureRuntimeEntry, 2); |
| 1372 __ popq(RAX); // Pop type arguments. | 1372 __ popq(RAX); // Pop type arguments. |
| 1373 } | 1373 } |
| 1374 __ popq(RAX); // Pop the function object. | 1374 __ popq(RAX); // Pop the function object. |
| 1375 __ popq(RAX); // Pop the result. | 1375 __ popq(RAX); // Pop the result. |
| 1376 // RAX: New closure object. | 1376 // RAX: New closure object. |
| 1377 // Restore the calling frame. | 1377 // Restore the calling frame. |
| 1378 __ LeaveFrame(); | 1378 __ LeaveFrame(); |
| 1379 __ ret(); | 1379 __ ret(); |
| 1380 } | 1380 } |
| 1381 | 1381 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1398 const Immediate& raw_null = | 1398 const Immediate& raw_null = |
| 1399 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1399 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1400 __ pushq(raw_null); // Setup space on stack for result from noSuchMethod. | 1400 __ pushq(raw_null); // Setup space on stack for result from noSuchMethod. |
| 1401 __ pushq(RAX); // Receiver. | 1401 __ pushq(RAX); // Receiver. |
| 1402 __ pushq(RBX); // IC data array. | 1402 __ pushq(RBX); // IC data array. |
| 1403 __ pushq(R10); // Arguments descriptor array. | 1403 __ pushq(R10); // Arguments descriptor array. |
| 1404 | 1404 |
| 1405 __ movq(R10, R13); // Smi-tagged arguments array length. | 1405 __ movq(R10, R13); // Smi-tagged arguments array length. |
| 1406 PushArgumentsArray(assembler); | 1406 PushArgumentsArray(assembler); |
| 1407 | 1407 |
| 1408 __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry); | 1408 __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4); |
| 1409 | 1409 |
| 1410 // Remove arguments. | 1410 // Remove arguments. |
| 1411 __ Drop(4); | 1411 __ Drop(4); |
| 1412 __ popq(RAX); // Get result into RAX. | 1412 __ popq(RAX); // Get result into RAX. |
| 1413 | 1413 |
| 1414 // Remove the stub frame as we are about to return. | 1414 // Remove the stub frame as we are about to return. |
| 1415 __ LeaveFrame(); | 1415 __ LeaveFrame(); |
| 1416 __ ret(); | 1416 __ ret(); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 | 1419 |
| 1420 // Cannot use function object from ICData as it may be the inlined | 1420 // Cannot use function object from ICData as it may be the inlined |
| 1421 // function and not the top-scope function. | 1421 // function and not the top-scope function. |
| 1422 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { | 1422 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { |
| 1423 Register ic_reg = RBX; | 1423 Register ic_reg = RBX; |
| 1424 Register func_reg = RDI; | 1424 Register func_reg = RDI; |
| 1425 if (FLAG_trace_optimized_ic_calls) { | 1425 if (FLAG_trace_optimized_ic_calls) { |
| 1426 __ EnterStubFrame(); | 1426 __ EnterStubFrame(); |
| 1427 __ pushq(func_reg); // Preserve | 1427 __ pushq(func_reg); // Preserve |
| 1428 __ pushq(ic_reg); // Preserve. | 1428 __ pushq(ic_reg); // Preserve. |
| 1429 __ pushq(ic_reg); // Argument. | 1429 __ pushq(ic_reg); // Argument. |
| 1430 __ pushq(func_reg); // Argument. | 1430 __ pushq(func_reg); // Argument. |
| 1431 __ CallRuntime(kTraceICCallRuntimeEntry); | 1431 __ CallRuntime(kTraceICCallRuntimeEntry, 2); |
| 1432 __ popq(RAX); // Discard argument; | 1432 __ popq(RAX); // Discard argument; |
| 1433 __ popq(RAX); // Discard argument; | 1433 __ popq(RAX); // Discard argument; |
| 1434 __ popq(ic_reg); // Restore. | 1434 __ popq(ic_reg); // Restore. |
| 1435 __ popq(func_reg); // Restore. | 1435 __ popq(func_reg); // Restore. |
| 1436 __ LeaveFrame(); | 1436 __ LeaveFrame(); |
| 1437 } | 1437 } |
| 1438 __ incq(FieldAddress(func_reg, Function::usage_counter_offset())); | 1438 __ incq(FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 | 1441 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 #endif // DEBUG | 1478 #endif // DEBUG |
| 1479 | 1479 |
| 1480 // Check single stepping. | 1480 // Check single stepping. |
| 1481 Label not_stepping; | 1481 Label not_stepping; |
| 1482 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); | 1482 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 1483 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); | 1483 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 1484 __ cmpq(RAX, Immediate(0)); | 1484 __ cmpq(RAX, Immediate(0)); |
| 1485 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); | 1485 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 1486 __ EnterStubFrame(); | 1486 __ EnterStubFrame(); |
| 1487 __ pushq(RBX); | 1487 __ pushq(RBX); |
| 1488 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | 1488 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1489 __ popq(RBX); | 1489 __ popq(RBX); |
| 1490 __ LeaveFrame(); | 1490 __ LeaveFrame(); |
| 1491 __ Bind(¬_stepping); | 1491 __ Bind(¬_stepping); |
| 1492 | 1492 |
| 1493 // Load arguments descriptor into R10. | 1493 // Load arguments descriptor into R10. |
| 1494 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); | 1494 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
| 1495 // Loop that checks if there is an IC data match. | 1495 // Loop that checks if there is an IC data match. |
| 1496 Label loop, update, test, found, get_class_id_as_smi; | 1496 Label loop, update, test, found, get_class_id_as_smi; |
| 1497 // RBX: IC data object (preserved). | 1497 // RBX: IC data object (preserved). |
| 1498 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); | 1498 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 __ EnterStubFrame(); | 1554 __ EnterStubFrame(); |
| 1555 __ pushq(R10); // Preserve arguments descriptor array. | 1555 __ pushq(R10); // Preserve arguments descriptor array. |
| 1556 __ pushq(RBX); // Preserve IC data object. | 1556 __ pushq(RBX); // Preserve IC data object. |
| 1557 __ pushq(raw_null); // Setup space on stack for result (target code object). | 1557 __ pushq(raw_null); // Setup space on stack for result (target code object). |
| 1558 // Push call arguments. | 1558 // Push call arguments. |
| 1559 for (intptr_t i = 0; i < num_args; i++) { | 1559 for (intptr_t i = 0; i < num_args; i++) { |
| 1560 __ movq(RCX, Address(RAX, -kWordSize * i)); | 1560 __ movq(RCX, Address(RAX, -kWordSize * i)); |
| 1561 __ pushq(RCX); | 1561 __ pushq(RCX); |
| 1562 } | 1562 } |
| 1563 __ pushq(RBX); // Pass IC data object. | 1563 __ pushq(RBX); // Pass IC data object. |
| 1564 __ CallRuntime(handle_ic_miss); | 1564 __ CallRuntime(handle_ic_miss, num_args + 1); |
| 1565 // Remove the call arguments pushed earlier, including the IC data object. | 1565 // Remove the call arguments pushed earlier, including the IC data object. |
| 1566 for (intptr_t i = 0; i < num_args + 1; i++) { | 1566 for (intptr_t i = 0; i < num_args + 1; i++) { |
| 1567 __ popq(RAX); | 1567 __ popq(RAX); |
| 1568 } | 1568 } |
| 1569 __ popq(RAX); // Pop returned code object into RAX (null if not found). | 1569 __ popq(RAX); // Pop returned code object into RAX (null if not found). |
| 1570 __ popq(RBX); // Restore IC data array. | 1570 __ popq(RBX); // Restore IC data array. |
| 1571 __ popq(R10); // Restore arguments descriptor array. | 1571 __ popq(R10); // Restore arguments descriptor array. |
| 1572 __ LeaveFrame(); | 1572 __ LeaveFrame(); |
| 1573 Label call_target_function; | 1573 Label call_target_function; |
| 1574 __ cmpq(RAX, raw_null); | 1574 __ cmpq(RAX, raw_null); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 #endif // DEBUG | 1709 #endif // DEBUG |
| 1710 | 1710 |
| 1711 // Check single stepping. | 1711 // Check single stepping. |
| 1712 Label not_stepping; | 1712 Label not_stepping; |
| 1713 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); | 1713 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 1714 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); | 1714 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 1715 __ cmpq(RAX, Immediate(0)); | 1715 __ cmpq(RAX, Immediate(0)); |
| 1716 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); | 1716 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 1717 __ EnterStubFrame(); | 1717 __ EnterStubFrame(); |
| 1718 __ pushq(RBX); // Preserve IC data object. | 1718 __ pushq(RBX); // Preserve IC data object. |
| 1719 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | 1719 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1720 __ popq(RBX); | 1720 __ popq(RBX); |
| 1721 __ LeaveFrame(); | 1721 __ LeaveFrame(); |
| 1722 __ Bind(¬_stepping); | 1722 __ Bind(¬_stepping); |
| 1723 | 1723 |
| 1724 // RBX: IC data object (preserved). | 1724 // RBX: IC data object (preserved). |
| 1725 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); | 1725 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); |
| 1726 // R12: ic_data_array with entries: target functions and count. | 1726 // R12: ic_data_array with entries: target functions and count. |
| 1727 __ leaq(R12, FieldAddress(R12, Array::data_offset())); | 1727 __ leaq(R12, FieldAddress(R12, Array::data_offset())); |
| 1728 // R12: points directly to the first ic data array element. | 1728 // R12: points directly to the first ic data array element. |
| 1729 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; | 1729 const intptr_t target_offset = ICData::TargetIndexFor(0) * kWordSize; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1743 // Get function and call it, if possible. | 1743 // Get function and call it, if possible. |
| 1744 __ movq(R13, Address(R12, target_offset)); | 1744 __ movq(R13, Address(R12, target_offset)); |
| 1745 __ movq(RAX, FieldAddress(R13, Function::code_offset())); | 1745 __ movq(RAX, FieldAddress(R13, Function::code_offset())); |
| 1746 __ cmpq(RAX, raw_null); | 1746 __ cmpq(RAX, raw_null); |
| 1747 __ j(NOT_EQUAL, &target_is_compiled, Assembler::kNearJump); | 1747 __ j(NOT_EQUAL, &target_is_compiled, Assembler::kNearJump); |
| 1748 | 1748 |
| 1749 __ EnterStubFrame(); | 1749 __ EnterStubFrame(); |
| 1750 __ pushq(R13); // Preserve target function. | 1750 __ pushq(R13); // Preserve target function. |
| 1751 __ pushq(RBX); // Preserve IC data object. | 1751 __ pushq(RBX); // Preserve IC data object. |
| 1752 __ pushq(R13); // Pass function. | 1752 __ pushq(R13); // Pass function. |
| 1753 __ CallRuntime(kCompileFunctionRuntimeEntry); | 1753 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 1754 __ popq(RAX); // Discard argument. | 1754 __ popq(RAX); // Discard argument. |
| 1755 __ popq(RBX); // Restore IC data object. | 1755 __ popq(RBX); // Restore IC data object. |
| 1756 __ popq(R13); // Restore target function. | 1756 __ popq(R13); // Restore target function. |
| 1757 __ LeaveFrame(); | 1757 __ LeaveFrame(); |
| 1758 __ movq(RAX, FieldAddress(R13, Function::code_offset())); | 1758 __ movq(RAX, FieldAddress(R13, Function::code_offset())); |
| 1759 | 1759 |
| 1760 __ Bind(&target_is_compiled); | 1760 __ Bind(&target_is_compiled); |
| 1761 // RAX: Target code. | 1761 // RAX: Target code. |
| 1762 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); | 1762 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); |
| 1763 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1763 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1779 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { | 1779 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { |
| 1780 __ EnterStubFrame(); | 1780 __ EnterStubFrame(); |
| 1781 // Preserve runtime args. | 1781 // Preserve runtime args. |
| 1782 __ pushq(RBX); | 1782 __ pushq(RBX); |
| 1783 __ pushq(R10); | 1783 __ pushq(R10); |
| 1784 // Room for result. Debugger stub returns address of the | 1784 // Room for result. Debugger stub returns address of the |
| 1785 // unpatched runtime stub. | 1785 // unpatched runtime stub. |
| 1786 const Immediate& raw_null = | 1786 const Immediate& raw_null = |
| 1787 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1787 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1788 __ pushq(raw_null); // Room for result. | 1788 __ pushq(raw_null); // Room for result. |
| 1789 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry); | 1789 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); |
| 1790 __ popq(RAX); // Address of original. | 1790 __ popq(RAX); // Address of original. |
| 1791 __ popq(R10); // Restore arguments. | 1791 __ popq(R10); // Restore arguments. |
| 1792 __ popq(RBX); | 1792 __ popq(RBX); |
| 1793 __ LeaveFrame(); | 1793 __ LeaveFrame(); |
| 1794 __ jmp(RAX); // Jump to original stub. | 1794 __ jmp(RAX); // Jump to original stub. |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 | 1797 |
| 1798 // RBX: ICData (unoptimized static call) | 1798 // RBX: ICData (unoptimized static call) |
| 1799 // TOS(0): return address (Dart code). | 1799 // TOS(0): return address (Dart code). |
| 1800 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) { | 1800 void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) { |
| 1801 const Immediate& raw_null = | 1801 const Immediate& raw_null = |
| 1802 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1802 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1803 __ EnterStubFrame(); | 1803 __ EnterStubFrame(); |
| 1804 __ pushq(RBX); // Preserve IC data for unoptimized call. | 1804 __ pushq(RBX); // Preserve IC data for unoptimized call. |
| 1805 __ pushq(raw_null); // Room for result. | 1805 __ pushq(raw_null); // Room for result. |
| 1806 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry); | 1806 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0); |
| 1807 __ popq(RAX); // Code object. | 1807 __ popq(RAX); // Code object. |
| 1808 __ popq(RBX); // Restore IC data. | 1808 __ popq(RBX); // Restore IC data. |
| 1809 __ LeaveFrame(); | 1809 __ LeaveFrame(); |
| 1810 | 1810 |
| 1811 // Load arguments descriptor into R10. | 1811 // Load arguments descriptor into R10. |
| 1812 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); | 1812 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
| 1813 // Now call the static function. The breakpoint handler function | 1813 // Now call the static function. The breakpoint handler function |
| 1814 // ensures that the call target is compiled. | 1814 // ensures that the call target is compiled. |
| 1815 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); | 1815 __ movq(RBX, FieldAddress(RAX, Code::instructions_offset())); |
| 1816 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1816 __ addq(RBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1817 __ jmp(RBX); | 1817 __ jmp(RBX); |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 | 1820 |
| 1821 // TOS(0): return address (Dart code). | 1821 // TOS(0): return address (Dart code). |
| 1822 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { | 1822 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { |
| 1823 __ EnterStubFrame(); | 1823 __ EnterStubFrame(); |
| 1824 __ pushq(RAX); | 1824 __ pushq(RAX); |
| 1825 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry); | 1825 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0); |
| 1826 __ popq(RAX); | 1826 __ popq(RAX); |
| 1827 __ LeaveFrame(); | 1827 __ LeaveFrame(); |
| 1828 | 1828 |
| 1829 __ popq(R11); // discard return address of call to this stub. | 1829 __ popq(R11); // discard return address of call to this stub. |
| 1830 __ LeaveFrame(); | 1830 __ LeaveFrame(); |
| 1831 __ ret(); | 1831 __ ret(); |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 | 1834 |
| 1835 // RBX: Inline cache data array. | 1835 // RBX: Inline cache data array. |
| 1836 // TOS(0): return address (Dart code). | 1836 // TOS(0): return address (Dart code). |
| 1837 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { | 1837 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { |
| 1838 __ EnterStubFrame(); | 1838 __ EnterStubFrame(); |
| 1839 __ pushq(RBX); | 1839 __ pushq(RBX); |
| 1840 __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry); | 1840 __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry, 0); |
| 1841 __ popq(RBX); | 1841 __ popq(RBX); |
| 1842 __ LeaveFrame(); | 1842 __ LeaveFrame(); |
| 1843 | 1843 |
| 1844 // Find out which dispatch stub to call. | 1844 // Find out which dispatch stub to call. |
| 1845 Label test_two, test_three, test_four; | 1845 Label test_two, test_three, test_four; |
| 1846 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); | 1846 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); |
| 1847 __ cmpq(RCX, Immediate(1)); | 1847 __ cmpq(RCX, Immediate(1)); |
| 1848 __ j(NOT_EQUAL, &test_two, Assembler::kNearJump); | 1848 __ j(NOT_EQUAL, &test_two, Assembler::kNearJump); |
| 1849 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); | 1849 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); |
| 1850 __ Bind(&test_two); | 1850 __ Bind(&test_two); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 __ Bind(&update_ic_data); | 2082 __ Bind(&update_ic_data); |
| 2083 | 2083 |
| 2084 // RCX: ICData | 2084 // RCX: ICData |
| 2085 __ movq(RAX, Address(RSP, 1 * kWordSize)); | 2085 __ movq(RAX, Address(RSP, 1 * kWordSize)); |
| 2086 __ movq(R13, Address(RSP, 2 * kWordSize)); | 2086 __ movq(R13, Address(RSP, 2 * kWordSize)); |
| 2087 __ EnterStubFrame(); | 2087 __ EnterStubFrame(); |
| 2088 __ pushq(R13); // arg 0 | 2088 __ pushq(R13); // arg 0 |
| 2089 __ pushq(RAX); // arg 1 | 2089 __ pushq(RAX); // arg 1 |
| 2090 __ PushObject(Symbols::EqualOperator()); // Target's name. | 2090 __ PushObject(Symbols::EqualOperator()); // Target's name. |
| 2091 __ pushq(RBX); // ICData | 2091 __ pushq(RBX); // ICData |
| 2092 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); | 2092 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4); |
| 2093 __ Drop(4); | 2093 __ Drop(4); |
| 2094 __ LeaveFrame(); | 2094 __ LeaveFrame(); |
| 2095 | 2095 |
| 2096 __ jmp(&compute_result, Assembler::kNearJump); | 2096 __ jmp(&compute_result, Assembler::kNearJump); |
| 2097 } | 2097 } |
| 2098 | 2098 |
| 2099 // Calls to the runtime to optimize the given function. | 2099 // Calls to the runtime to optimize the given function. |
| 2100 // RDI: function to be reoptimized. | 2100 // RDI: function to be reoptimized. |
| 2101 // R10: argument descriptor (preserved). | 2101 // R10: argument descriptor (preserved). |
| 2102 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 2102 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
| 2103 const Immediate& raw_null = | 2103 const Immediate& raw_null = |
| 2104 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2104 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 2105 __ EnterStubFrame(); | 2105 __ EnterStubFrame(); |
| 2106 __ pushq(R10); | 2106 __ pushq(R10); |
| 2107 __ pushq(raw_null); // Setup space on stack for return value. | 2107 __ pushq(raw_null); // Setup space on stack for return value. |
| 2108 __ pushq(RDI); | 2108 __ pushq(RDI); |
| 2109 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 2109 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); |
| 2110 __ popq(RAX); // Disard argument. | 2110 __ popq(RAX); // Disard argument. |
| 2111 __ popq(RAX); // Get Code object. | 2111 __ popq(RAX); // Get Code object. |
| 2112 __ popq(R10); // Restore argument descriptor. | 2112 __ popq(R10); // Restore argument descriptor. |
| 2113 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); | 2113 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); |
| 2114 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 2114 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 2115 __ LeaveFrame(); | 2115 __ LeaveFrame(); |
| 2116 __ jmp(RAX); | 2116 __ jmp(RAX); |
| 2117 __ int3(); | 2117 __ int3(); |
| 2118 } | 2118 } |
| 2119 | 2119 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 | 2164 |
| 2165 __ Bind(&check_bigint); | 2165 __ Bind(&check_bigint); |
| 2166 __ CompareClassId(left, kBigintCid); | 2166 __ CompareClassId(left, kBigintCid); |
| 2167 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump); | 2167 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump); |
| 2168 __ CompareClassId(right, kBigintCid); | 2168 __ CompareClassId(right, kBigintCid); |
| 2169 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 2169 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2170 __ EnterFrame(0); | 2170 __ EnterFrame(0); |
| 2171 __ ReserveAlignedFrameSpace(0); | 2171 __ ReserveAlignedFrameSpace(0); |
| 2172 __ movq(RDI, left); | 2172 __ movq(RDI, left); |
| 2173 __ movq(RSI, right); | 2173 __ movq(RSI, right); |
| 2174 __ CallRuntime(kBigintCompareRuntimeEntry); | 2174 __ CallRuntime(kBigintCompareRuntimeEntry, 2); |
| 2175 // Result in RAX, 0 means equal. | 2175 // Result in RAX, 0 means equal. |
| 2176 __ LeaveFrame(); | 2176 __ LeaveFrame(); |
| 2177 __ cmpq(RAX, Immediate(0)); | 2177 __ cmpq(RAX, Immediate(0)); |
| 2178 __ jmp(&done); | 2178 __ jmp(&done); |
| 2179 | 2179 |
| 2180 __ Bind(&reference_compare); | 2180 __ Bind(&reference_compare); |
| 2181 __ cmpq(left, right); | 2181 __ cmpq(left, right); |
| 2182 __ Bind(&done); | 2182 __ Bind(&done); |
| 2183 } | 2183 } |
| 2184 | 2184 |
| 2185 | 2185 |
| 2186 // Called only from unoptimized code. All relevant registers have been saved. | 2186 // Called only from unoptimized code. All relevant registers have been saved. |
| 2187 // TOS + 0: return address | 2187 // TOS + 0: return address |
| 2188 // TOS + 1: right argument. | 2188 // TOS + 1: right argument. |
| 2189 // TOS + 2: left argument. | 2189 // TOS + 2: left argument. |
| 2190 // Returns ZF set. | 2190 // Returns ZF set. |
| 2191 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2191 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2192 Assembler* assembler) { | 2192 Assembler* assembler) { |
| 2193 // Check single stepping. | 2193 // Check single stepping. |
| 2194 Label not_stepping; | 2194 Label not_stepping; |
| 2195 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); | 2195 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
| 2196 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); | 2196 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
| 2197 __ cmpq(RAX, Immediate(0)); | 2197 __ cmpq(RAX, Immediate(0)); |
| 2198 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); | 2198 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
| 2199 __ EnterStubFrame(); | 2199 __ EnterStubFrame(); |
| 2200 __ CallRuntime(kSingleStepHandlerRuntimeEntry); | 2200 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 2201 __ LeaveFrame(); | 2201 __ LeaveFrame(); |
| 2202 __ Bind(¬_stepping); | 2202 __ Bind(¬_stepping); |
| 2203 | 2203 |
| 2204 const Register left = RAX; | 2204 const Register left = RAX; |
| 2205 const Register right = RDX; | 2205 const Register right = RDX; |
| 2206 | 2206 |
| 2207 __ movq(left, Address(RSP, 2 * kWordSize)); | 2207 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2208 __ movq(right, Address(RSP, 1 * kWordSize)); | 2208 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2209 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2209 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2210 __ ret(); | 2210 __ ret(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2228 __ movq(right, Address(RSP, 3 * kWordSize)); | 2228 __ movq(right, Address(RSP, 3 * kWordSize)); |
| 2229 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2229 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2230 __ popq(right); | 2230 __ popq(right); |
| 2231 __ popq(left); | 2231 __ popq(left); |
| 2232 __ ret(); | 2232 __ ret(); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 } // namespace dart | 2235 } // namespace dart |
| 2236 | 2236 |
| 2237 #endif // defined TARGET_ARCH_X64 | 2237 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |