| 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void FlowGraphCompiler::VisitNativeCall(NativeCallComp* comp) { | 174 void FlowGraphCompiler::VisitNativeCall(NativeCallComp* comp) { |
| 175 Bailout("NativeCallComp"); | 175 Bailout("NativeCallComp"); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 void FlowGraphCompiler::VisitStoreIndexed(StoreIndexedComp* comp) { | 179 void FlowGraphCompiler::VisitStoreIndexed(StoreIndexedComp* comp) { |
| 180 // Call operator []= but preserve the third argument value under the | 180 // Call operator []= but preserve the third argument value under the |
| 181 // arguments as the result of the computation. | 181 // arguments as the result of the computation. |
| 182 const String& function_name = | 182 const String& function_name = |
| 183 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); | 183 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); |
| 184 // Placeholder is under value, index, and receiver. | 184 |
| 185 const int kPlaceholderOffset = 3 * kWordSize; | 185 // Insert a copy of the third (last) argument under the arguments. |
| 186 __ movq(RAX, Address(RSP, 0)); // Value. | 186 __ popq(RAX); // Value. |
| 187 __ movq(Address(RSP, kPlaceholderOffset), RAX); | 187 __ popq(RBX); // Index. |
| 188 __ popq(RCX); // Receiver. |
| 189 __ pushq(RAX); |
| 190 __ pushq(RCX); |
| 191 __ pushq(RBX); |
| 192 __ pushq(RAX); |
| 188 EmitInstanceCall(comp->node_id(), comp->token_index(), function_name, 3, | 193 EmitInstanceCall(comp->node_id(), comp->token_index(), function_name, 3, |
| 189 Array::ZoneHandle(), 1); | 194 Array::ZoneHandle(), 1); |
| 190 __ popq(RAX); | 195 __ popq(RAX); |
| 191 } | 196 } |
| 192 | 197 |
| 193 | 198 |
| 194 void FlowGraphCompiler::VisitInstanceSetter(InstanceSetterComp* comp) { | 199 void FlowGraphCompiler::VisitInstanceSetter(InstanceSetterComp* comp) { |
| 195 // Preserve the second argument under the arguments as the result of the | 200 // Preserve the second argument under the arguments as the result of the |
| 196 // computation, then call the getter. | 201 // computation, then call the getter. |
| 197 const String& function_name = | 202 const String& function_name = |
| 198 String::ZoneHandle(Field::SetterSymbol(comp->field_name())); | 203 String::ZoneHandle(Field::SetterSymbol(comp->field_name())); |
| 199 // Placeholder is under value and receiver. | 204 |
| 200 const int kPlaceholderOffset = 2 * kWordSize; | 205 // Insert a copy of the second (last) argument under the arguments. |
| 201 __ movq(RAX, Address(RSP, 0)); // Value. | 206 __ popq(RAX); // Value. |
| 202 __ movq(Address(RSP, kPlaceholderOffset), RAX); | 207 __ popq(RBX); // Reciever. |
| 208 __ pushq(RAX); |
| 209 __ pushq(RBX); |
| 210 __ pushq(RAX); |
| 203 EmitInstanceCall(comp->node_id(), comp->token_index(), function_name, 2, | 211 EmitInstanceCall(comp->node_id(), comp->token_index(), function_name, 2, |
| 204 Array::ZoneHandle(), 1); | 212 Array::ZoneHandle(), 1); |
| 205 __ popq(RAX); | 213 __ popq(RAX); |
| 206 } | 214 } |
| 207 | 215 |
| 208 | 216 |
| 209 void FlowGraphCompiler::VisitJoinEntry(JoinEntryInstr* instr) { | 217 void FlowGraphCompiler::VisitJoinEntry(JoinEntryInstr* instr) { |
| 210 Bailout("JoinEntryInstr"); | 218 Bailout("JoinEntryInstr"); |
| 211 } | 219 } |
| 212 | 220 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 420 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 413 // We don't compile exception handlers yet. | 421 // We don't compile exception handlers yet. |
| 414 code.set_exception_handlers( | 422 code.set_exception_handlers( |
| 415 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); | 423 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); |
| 416 } | 424 } |
| 417 | 425 |
| 418 | 426 |
| 419 } // namespace dart | 427 } // namespace dart |
| 420 | 428 |
| 421 #endif // defined TARGET_ARCH_X64 | 429 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |