Chromium Code Reviews| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver. | 64 __ movl(EAX, Address(ESP, 2 * kWordSize)); // Receiver. |
| 65 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value. | 65 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Value. |
| 66 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX); | 66 __ StoreIntoObject(EAX, FieldAddress(EAX, offset), EBX); |
| 67 const Immediate raw_null = | 67 const Immediate raw_null = |
| 68 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 68 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 69 __ movl(EAX, raw_null); | 69 __ movl(EAX, raw_null); |
| 70 __ ret(); | 70 __ ret(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 // TODO(srdjan): For Math.sqrt read type feedback in Math.sqrt and decide | |
| 75 // if the argument is double, smi or something else. | |
|
srdjan
2012/06/14 23:30:08
Math.sqrt is a static method, we do not collect ty
regis
2012/06/15 00:33:59
Removed TODO.
| |
| 76 void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) { | |
| 77 Label smi_to_double, call_method; | |
| 78 __ movl(EAX, Address(ESP, 0)); | |
| 79 __ testl(EAX, Immediate(kSmiTagMask)); | |
| 80 __ j(ZERO, &smi_to_double, Assembler::kNearJump); | |
| 81 __ CompareClassId(EAX, kDouble, EBX); | |
| 82 __ j(NOT_EQUAL, &call_method, Assembler::kNearJump); | |
| 83 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); | |
| 84 __ sqrtsd(XMM0, XMM1); | |
| 85 // TODO(regis): Should we cache double_class in FlowGraphCompiler instance? | |
|
srdjan
2012/06/14 23:30:08
Yes, there are also similar TODO's for vegorov.
regis
2012/06/15 00:33:59
Done.
| |
| 86 const Class& double_class = | |
| 87 Class::ZoneHandle(Isolate::Current()->object_store()->double_class()); | |
| 88 AssemblerMacros::TryAllocate(assembler_, | |
| 89 double_class, | |
| 90 &call_method, | |
| 91 EAX); // Result register. | |
| 92 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | |
| 93 __ jmp(done); | |
| 94 __ Bind(&smi_to_double); | |
|
srdjan
2012/06/14 23:30:08
Add comment: Smi to Double calls static method?
Wh
regis
2012/06/15 00:33:59
Done.
| |
| 95 __ Bind(&call_method); | |
| 96 } | |
| 97 | |
| 98 | |
| 74 void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid, | 99 void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid, |
| 75 intptr_t token_index, | 100 intptr_t token_index, |
| 76 intptr_t try_index, | 101 intptr_t try_index, |
| 77 const RuntimeEntry& entry) { | 102 const RuntimeEntry& entry) { |
| 78 __ CallRuntime(entry); | 103 __ CallRuntime(entry); |
| 79 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); | 104 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); |
| 80 } | 105 } |
| 81 | 106 |
| 82 | 107 |
| 83 void FlowGraphCompiler::CopyParameters() { | 108 void FlowGraphCompiler::CopyParameters() { |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1006 __ cvtsi2sd(result, temp); | 1031 __ cvtsi2sd(result, temp); |
| 1007 __ Bind(&done); | 1032 __ Bind(&done); |
| 1008 } | 1033 } |
| 1009 | 1034 |
| 1010 | 1035 |
| 1011 #undef __ | 1036 #undef __ |
| 1012 | 1037 |
| 1013 } // namespace dart | 1038 } // namespace dart |
| 1014 | 1039 |
| 1015 #endif // defined TARGET_ARCH_IA32 | 1040 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |