| OLD | NEW |
| 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" // 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 // Generate inline type check, linking to runtime call if not assignable. | 336 // Generate inline type check, linking to runtime call if not assignable. |
| 337 GenerateInlineInstanceof(dst_type, &is_assignable, &runtime_call); | 337 GenerateInlineInstanceof(dst_type, &is_assignable, &runtime_call); |
| 338 | 338 |
| 339 __ Bind(&runtime_call); | 339 __ Bind(&runtime_call); |
| 340 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 340 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 341 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. | 341 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. |
| 342 __ pushq(Immediate(Smi::RawValue(cid))); // Computation id. | 342 __ pushq(Immediate(Smi::RawValue(cid))); // Computation id. |
| 343 __ pushq(RAX); // Push the source object. | 343 __ pushq(RAX); // Push the source object. |
| 344 __ PushObject(dst_type); // Push the type of the destination. | 344 __ PushObject(dst_type); // Push the type of the destination. |
| 345 if (!dst_type.IsInstantiated()) { | 345 __ pushq(raw_null); // TODO(srdjan): Instantiator. |
| 346 if (dst_type.IsInstantiated()) { |
| 347 __ pushq(raw_null); // Null instantiator type arguments. |
| 348 } else { |
| 346 __ pushq(RDX); // Instantiator type arguments. | 349 __ pushq(RDX); // Instantiator type arguments. |
| 347 } else { | |
| 348 __ pushq(raw_null); // Null instantiator. | |
| 349 } | 350 } |
| 350 __ PushObject(dst_name); // Push the name of the destination. | 351 __ PushObject(dst_name); // Push the name of the destination. |
| 351 __ pushq(raw_null); // SubtypeTestCache not yet supported. | 352 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 352 GenerateCallRuntime(cid, | 353 GenerateCallRuntime(cid, |
| 353 token_index, | 354 token_index, |
| 354 try_index, | 355 try_index, |
| 355 kTypeCheckRuntimeEntry); | 356 kTypeCheckRuntimeEntry); |
| 356 // Pop the parameters supplied to the runtime entry. The result of the | 357 // Pop the parameters supplied to the runtime entry. The result of the |
| 357 // type check runtime call is the checked value. | 358 // type check runtime call is the checked value. |
| 358 __ addq(RSP, Immediate(7 * kWordSize)); | 359 __ addq(RSP, Immediate(8 * kWordSize)); |
| 359 __ popq(RAX); | 360 __ popq(RAX); |
| 360 | 361 |
| 361 __ Bind(&is_assignable); | 362 __ Bind(&is_assignable); |
| 362 } | 363 } |
| 363 | 364 |
| 364 | 365 |
| 365 void FlowGraphCompiler::LoadValue(Register dst, Value* value) { | 366 void FlowGraphCompiler::LoadValue(Register dst, Value* value) { |
| 366 if (value->IsConstant()) { | 367 if (value->IsConstant()) { |
| 367 ConstantVal* constant = value->AsConstant(); | 368 ConstantVal* constant = value->AsConstant(); |
| 368 if (constant->value().IsSmi()) { | 369 if (constant->value().IsSmi()) { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 833 |
| 833 // Generate inline instanceof test. | 834 // Generate inline instanceof test. |
| 834 GenerateInlineInstanceof(type, &is_instance, &is_not_instance); | 835 GenerateInlineInstanceof(type, &is_instance, &is_not_instance); |
| 835 | 836 |
| 836 // Generate runtime call. | 837 // Generate runtime call. |
| 837 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 838 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 838 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. | 839 __ pushq(Immediate(Smi::RawValue(token_index))); // Source location. |
| 839 __ pushq(Immediate(Smi::RawValue(cid))); // Computation id. | 840 __ pushq(Immediate(Smi::RawValue(cid))); // Computation id. |
| 840 __ pushq(RAX); // Push the instance. | 841 __ pushq(RAX); // Push the instance. |
| 841 __ PushObject(type); // Push the type. | 842 __ PushObject(type); // Push the type. |
| 842 if (!type.IsInstantiated()) { | 843 __ pushq(raw_null); // TODO(srdjan): Pass instantiator instead of null. |
| 844 if (type.IsInstantiated()) { |
| 845 __ pushq(raw_null); // Null instantiator type arguments. |
| 846 } else { |
| 843 __ pushq(RDX); // Instantiator type arguments. | 847 __ pushq(RDX); // Instantiator type arguments. |
| 844 } else { | |
| 845 __ pushq(raw_null); // Null instantiator. | |
| 846 } | 848 } |
| 847 __ pushq(raw_null); // SubtypeTestCache not yet supported. | 849 __ pushq(raw_null); // SubtypeTestCache not yet supported. |
| 848 GenerateCallRuntime(cid, token_index, try_index, kInstanceofRuntimeEntry); | 850 GenerateCallRuntime(cid, token_index, try_index, kInstanceofRuntimeEntry); |
| 849 // Pop the two parameters supplied to the runtime entry. The result of the | 851 // Pop the two parameters supplied to the runtime entry. The result of the |
| 850 // instanceof runtime call will be left as the result of the operation. | 852 // instanceof runtime call will be left as the result of the operation. |
| 851 __ addq(RSP, Immediate(6 * kWordSize)); | 853 __ addq(RSP, Immediate(7 * kWordSize)); |
| 852 Label done; | 854 Label done; |
| 853 if (negate_result) { | 855 if (negate_result) { |
| 854 __ popq(RDX); | 856 __ popq(RDX); |
| 855 __ LoadObject(RAX, bool_true); | 857 __ LoadObject(RAX, bool_true); |
| 856 __ cmpq(RDX, RAX); | 858 __ cmpq(RDX, RAX); |
| 857 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 859 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 858 __ LoadObject(RAX, bool_false); | 860 __ LoadObject(RAX, bool_false); |
| 859 } else { | 861 } else { |
| 860 __ popq(RAX); | 862 __ popq(RAX); |
| 861 } | 863 } |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 ASSERT(exception_handlers_list_ != NULL); | 1725 ASSERT(exception_handlers_list_ != NULL); |
| 1724 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 1726 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
| 1725 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 1727 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
| 1726 code.set_exception_handlers(handlers); | 1728 code.set_exception_handlers(handlers); |
| 1727 } | 1729 } |
| 1728 | 1730 |
| 1729 | 1731 |
| 1730 } // namespace dart | 1732 } // namespace dart |
| 1731 | 1733 |
| 1732 #endif // defined TARGET_ARCH_X64 | 1734 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |