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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // at entry point. | 317 // at entry point. |
318 pc_descriptors_list_->AddDescriptor(PcDescriptors::kPatchCode, | 318 pc_descriptors_list_->AddDescriptor(PcDescriptors::kPatchCode, |
319 assembler_->CodeSize(), | 319 assembler_->CodeSize(), |
320 AstNode::kNoId, | 320 AstNode::kNoId, |
321 0, | 321 0, |
322 -1); | 322 -1); |
323 __ jmp(&StubCode::FixCallersTargetLabel()); | 323 __ jmp(&StubCode::FixCallersTargetLabel()); |
324 } | 324 } |
325 | 325 |
326 | 326 |
| 327 void FlowGraphCompiler::EmitInstanceCall(intptr_t cid, |
| 328 intptr_t token_index, |
| 329 intptr_t try_index, |
| 330 const String& function_name, |
| 331 intptr_t argument_count, |
| 332 const Array& argument_names, |
| 333 intptr_t checked_argument_count) { |
| 334 ICData& ic_data = ICData::ZoneHandle(ICData::New(parsed_function_.function(), |
| 335 function_name, |
| 336 cid, |
| 337 checked_argument_count)); |
| 338 const Array& arguments_descriptor = |
| 339 CodeGenerator::ArgumentsDescriptor(argument_count, argument_names); |
| 340 __ LoadObject(ECX, ic_data); |
| 341 __ LoadObject(EDX, arguments_descriptor); |
| 342 |
| 343 uword label_address = 0; |
| 344 switch (checked_argument_count) { |
| 345 case 1: |
| 346 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); |
| 347 break; |
| 348 case 2: |
| 349 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint(); |
| 350 break; |
| 351 default: |
| 352 UNIMPLEMENTED(); |
| 353 } |
| 354 ExternalLabel target_label("InlineCache", label_address); |
| 355 __ call(&target_label); |
| 356 AddCurrentDescriptor(PcDescriptors::kIcCall, cid, token_index, try_index); |
| 357 __ Drop(argument_count); |
| 358 } |
| 359 |
| 360 |
| 361 void FlowGraphCompiler::EmitStaticCall(intptr_t token_index, |
| 362 intptr_t try_index, |
| 363 const Function& function, |
| 364 intptr_t argument_count, |
| 365 const Array& argument_names) { |
| 366 const Array& arguments_descriptor = |
| 367 CodeGenerator::ArgumentsDescriptor(argument_count, argument_names); |
| 368 __ LoadObject(ECX, function); |
| 369 __ LoadObject(EDX, arguments_descriptor); |
| 370 |
| 371 GenerateCall(token_index, |
| 372 try_index, |
| 373 &StubCode::CallStaticFunctionLabel(), |
| 374 PcDescriptors::kFuncCall); |
| 375 __ Drop(argument_count); |
| 376 } |
| 377 |
| 378 |
| 379 void FlowGraphCompiler::GenerateCall(intptr_t token_index, |
| 380 intptr_t try_index, |
| 381 const ExternalLabel* label, |
| 382 PcDescriptors::Kind kind) { |
| 383 __ call(label); |
| 384 AddCurrentDescriptor(kind, AstNode::kNoId, token_index, try_index); |
| 385 } |
| 386 |
| 387 |
327 void FlowGraphCompiler::GenerateDeferredCode() { | 388 void FlowGraphCompiler::GenerateDeferredCode() { |
328 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { | 389 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { |
329 deopt_stubs_[i]->GenerateCode(this); | 390 deopt_stubs_[i]->GenerateCode(this); |
330 } | 391 } |
331 } | 392 } |
332 | 393 |
333 | 394 |
334 void FlowGraphCompiler::EmitComment(Instruction* instr) { | 395 void FlowGraphCompiler::EmitComment(Instruction* instr) { |
335 char buffer[80]; | 396 char buffer[80]; |
336 BufferFormatter f(buffer, sizeof(buffer)); | 397 BufferFormatter f(buffer, sizeof(buffer)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 492 |
432 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 493 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
433 code.set_comments(assembler_->GetCodeComments()); | 494 code.set_comments(assembler_->GetCodeComments()); |
434 } | 495 } |
435 | 496 |
436 #undef __ | 497 #undef __ |
437 | 498 |
438 } // namespace dart | 499 } // namespace dart |
439 | 500 |
440 #endif // defined TARGET_ARCH_IA32 | 501 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |