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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 486 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
487 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX. | 487 GenerateDeoptimizationSequence(assembler, false); // Don't preserve RAX. |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 static void GenerateDispatcherCode(Assembler* assembler, | 491 static void GenerateDispatcherCode(Assembler* assembler, |
492 Label* call_target_function) { | 492 Label* call_target_function) { |
493 __ Comment("NoSuchMethodDispatch"); | 493 __ Comment("NoSuchMethodDispatch"); |
494 // When lazily generated invocation dispatchers are disabled, the | 494 // When lazily generated invocation dispatchers are disabled, the |
495 // miss-handler may return null. | 495 // miss-handler may return null. |
496 const Immediate& raw_null = | 496 __ CompareObject(RAX, Object::null_object()); |
497 Immediate(reinterpret_cast<intptr_t>(Object::null())); | |
498 __ cmpq(RAX, raw_null); | |
499 __ j(NOT_EQUAL, call_target_function); | 497 __ j(NOT_EQUAL, call_target_function); |
500 __ EnterStubFrame(); | 498 __ EnterStubFrame(); |
501 // Load the receiver. | 499 // Load the receiver. |
502 __ movq(RDI, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 500 __ movq(RDI, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
503 __ movq(RAX, Address( | 501 __ movq(RAX, Address( |
504 RBP, RDI, TIMES_HALF_WORD_SIZE, kParamEndSlotFromFp * kWordSize)); | 502 RBP, RDI, TIMES_HALF_WORD_SIZE, kParamEndSlotFromFp * kWordSize)); |
505 __ pushq(raw_null); // Setup space on stack for result. | 503 __ PushObject(Object::null_object()); // Setup space on stack for result. |
506 __ pushq(RAX); // Receiver. | 504 __ pushq(RAX); // Receiver. |
507 __ pushq(RBX); | 505 __ pushq(RBX); |
508 __ pushq(R10); // Arguments descriptor array. | 506 __ pushq(R10); // Arguments descriptor array. |
509 __ movq(R10, RDI); | 507 __ movq(R10, RDI); |
510 // EDX: Smi-tagged arguments array length. | 508 // EDX: Smi-tagged arguments array length. |
511 PushArgumentsArray(assembler); | 509 PushArgumentsArray(assembler); |
512 const intptr_t kNumArgs = 4; | 510 const intptr_t kNumArgs = 4; |
513 __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs); | 511 __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs); |
514 __ Drop(4); | 512 __ Drop(4); |
515 __ popq(RAX); // Return value. | 513 __ popq(RAX); // Return value. |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 // Result: | 2121 // Result: |
2124 // RCX: entry point. | 2122 // RCX: entry point. |
2125 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2123 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2126 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); | 2124 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); |
2127 __ ret(); | 2125 __ ret(); |
2128 } | 2126 } |
2129 | 2127 |
2130 } // namespace dart | 2128 } // namespace dart |
2131 | 2129 |
2132 #endif // defined TARGET_ARCH_X64 | 2130 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |