Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 9646008: Implementing ConstructorCall. (part I) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 intptr_t token_index, 66 intptr_t token_index,
67 const AbstractType& dst_type, 67 const AbstractType& dst_type,
68 const String& dst_name) { 68 const String& dst_name) {
69 Bailout("GenerateAssertAssignable"); 69 Bailout("GenerateAssertAssignable");
70 } 70 }
71 71
72 72
73 void FlowGraphCompiler::LoadValue(Register dst, Value* value) { 73 void FlowGraphCompiler::LoadValue(Register dst, Value* value) {
74 if (value->IsConstant()) { 74 if (value->IsConstant()) {
75 ConstantVal* constant = value->AsConstant(); 75 ConstantVal* constant = value->AsConstant();
76 if (constant->instance().IsSmi()) { 76 if (constant->value().IsSmi()) {
77 int64_t imm = reinterpret_cast<int64_t>(constant->instance().raw()); 77 int64_t imm = reinterpret_cast<int64_t>(constant->value().raw());
78 __ movq(dst, Immediate(imm)); 78 __ movq(dst, Immediate(imm));
79 } else { 79 } else {
80 __ LoadObject(dst, value->AsConstant()->instance()); 80 __ LoadObject(dst, value->AsConstant()->value());
81 } 81 }
82 } else { 82 } else {
83 ASSERT(value->IsTemp()); 83 ASSERT(value->IsTemp());
84 __ popq(dst); 84 __ popq(dst);
85 } 85 }
86 } 86 }
87 87
88 88
89 void FlowGraphCompiler::VisitTemp(TempVal* val) { 89 void FlowGraphCompiler::VisitTemp(TempVal* val) {
90 LoadValue(RAX, val); 90 LoadValue(RAX, val);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 __ LoadObject(RAX, bool_false); 325 __ LoadObject(RAX, bool_false);
326 __ Bind(&done); 326 __ Bind(&done);
327 } 327 }
328 328
329 329
330 void FlowGraphCompiler::VisitInstanceOf(InstanceOfComp* comp) { 330 void FlowGraphCompiler::VisitInstanceOf(InstanceOfComp* comp) {
331 Bailout("InstanceOf"); 331 Bailout("InstanceOf");
332 } 332 }
333 333
334 334
335 void FlowGraphCompiler::VisitAllocateObject(AllocateObjectComp* comp) {
336 const Class& cls = Class::ZoneHandle(comp->constructor().owner());
337 const bool requires_type_arguments = cls.HasTypeArguments();
338 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls));
339 const ExternalLabel label(cls.ToCString(), stub.EntryPoint());
340 GenerateCall(comp->token_index(), &label, PcDescriptors::kOther);
341 for (intptr_t i = 0; i < comp->arguments().length(); i++) {
342 __ popq(RCX); // Discard allocation argument
343 }
344 }
345
346
335 void FlowGraphCompiler::VisitCreateArray(CreateArrayComp* comp) { 347 void FlowGraphCompiler::VisitCreateArray(CreateArrayComp* comp) {
336 // 1. Allocate the array. R10 = length, RBX = element type. 348 // 1. Allocate the array. R10 = length, RBX = element type.
337 __ movq(R10, Immediate(Smi::RawValue(comp->ElementCount()))); 349 __ movq(R10, Immediate(Smi::RawValue(comp->ElementCount())));
338 const AbstractTypeArguments& element_type = comp->type_arguments(); 350 const AbstractTypeArguments& element_type = comp->type_arguments();
339 ASSERT(element_type.IsNull() || element_type.IsInstantiated()); 351 ASSERT(element_type.IsNull() || element_type.IsInstantiated());
340 __ LoadObject(RBX, element_type); 352 __ LoadObject(RBX, element_type);
341 GenerateCall(comp->token_index(), 353 GenerateCall(comp->token_index(),
342 &StubCode::AllocateArrayLabel(), 354 &StubCode::AllocateArrayLabel(),
343 PcDescriptors::kOther); 355 PcDescriptors::kOther);
344 356
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { 633 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) {
622 // We don't compile exception handlers yet. 634 // We don't compile exception handlers yet.
623 code.set_exception_handlers( 635 code.set_exception_handlers(
624 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); 636 ExceptionHandlers::Handle(ExceptionHandlers::New(0)));
625 } 637 }
626 638
627 639
628 } // namespace dart 640 } // namespace dart
629 641
630 #endif // defined TARGET_ARCH_X64 642 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698