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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| 11 #include "vm/compiler.h" |
11 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
12 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
13 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
14 #include "vm/locations.h" | 15 #include "vm/locations.h" |
15 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
16 #include "vm/parser.h" | 17 #include "vm/parser.h" |
17 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
18 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
19 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
20 | 21 |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 __ j(ZERO, &call_target_function, Assembler::kNearJump); | 1441 __ j(ZERO, &call_target_function, Assembler::kNearJump); |
1441 __ cmpq(RDX, RAX); | 1442 __ cmpq(RDX, RAX); |
1442 __ j(NOT_EQUAL, &update, Assembler::kNearJump); | 1443 __ j(NOT_EQUAL, &update, Assembler::kNearJump); |
1443 | 1444 |
1444 __ Bind(&call_target_function); | 1445 __ Bind(&call_target_function); |
1445 // Call the target found in the cache. For a class id match, this is a | 1446 // Call the target found in the cache. For a class id match, this is a |
1446 // proper target for the given name and arguments descriptor. If the | 1447 // proper target for the given name and arguments descriptor. If the |
1447 // illegal class id was found, the target is a cache miss handler that can | 1448 // illegal class id was found, the target is a cache miss handler that can |
1448 // be invoked as a normal Dart function. | 1449 // be invoked as a normal Dart function. |
1449 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); | 1450 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); |
1450 __ movq(RAX, FieldAddress(RAX, Function::code_offset())); | 1451 __ movq(RBX, FieldAddress(RAX, Function::code_offset())); |
1451 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); | 1452 if (FLAG_collect_code) { |
| 1453 // If we are collecting code, the code object may be null. |
| 1454 Label is_compiled; |
| 1455 const Immediate& raw_null = |
| 1456 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1457 __ cmpq(RBX, raw_null); |
| 1458 __ j(NOT_EQUAL, &is_compiled, Assembler::kNearJump); |
| 1459 __ call(&StubCode::CompileFunctionRuntimeCallLabel()); |
| 1460 __ movq(RBX, FieldAddress(RAX, Function::code_offset())); |
| 1461 __ Bind(&is_compiled); |
| 1462 } |
| 1463 __ movq(RAX, FieldAddress(RBX, Code::instructions_offset())); |
1452 __ LoadObject(RBX, ic_data, PP); | 1464 __ LoadObject(RBX, ic_data, PP); |
1453 __ LoadObject(R10, arguments_descriptor, PP); | 1465 __ LoadObject(R10, arguments_descriptor, PP); |
1454 __ AddImmediate( | 1466 __ AddImmediate( |
1455 RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); | 1467 RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); |
1456 __ call(RAX); | 1468 __ call(RAX); |
1457 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); | 1469 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); |
1458 RecordSafepoint(locs); | 1470 RecordSafepoint(locs); |
1459 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | 1471 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); |
1460 __ Drop(argument_count); | 1472 __ Drop(argument_count); |
1461 } | 1473 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 __ movups(reg, Address(RSP, 0)); | 1946 __ movups(reg, Address(RSP, 0)); |
1935 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1947 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
1936 } | 1948 } |
1937 | 1949 |
1938 | 1950 |
1939 #undef __ | 1951 #undef __ |
1940 | 1952 |
1941 } // namespace dart | 1953 } // namespace dart |
1942 | 1954 |
1943 #endif // defined TARGET_ARCH_X64 | 1955 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |