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

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

Issue 9464009: Add enough compiler support to compile empty functions on x64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Include file inadvertently left out. 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
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/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 codegen_->set_state(this); 56 codegen_->set_state(this);
57 } 57 }
58 58
59 59
60 CodeGeneratorState::~CodeGeneratorState() { 60 CodeGeneratorState::~CodeGeneratorState() {
61 codegen_->set_state(parent_); 61 codegen_->set_state(parent_);
62 } 62 }
63 63
64 64
65 class CodeGenerator::DescriptorList : public ZoneAllocated {
66 public:
67 struct PcDesc {
68 intptr_t pc_offset; // PC offset value of the descriptor.
69 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther).
70 intptr_t node_id; // AST node id.
71 intptr_t token_index; // Token position in source of PC.
72 intptr_t try_index; // Try block index of PC.
73 };
74
75 DescriptorList() : list_() {
76 }
77 ~DescriptorList() { }
78
79 intptr_t Length() const {
80 return list_.length();
81 }
82
83 intptr_t PcOffset(int index) const {
84 return list_[index].pc_offset;
85 }
86 PcDescriptors::Kind Kind(int index) const {
87 return list_[index].kind;
88 }
89 intptr_t NodeId(int index) const {
90 return list_[index].node_id;
91 }
92 intptr_t TokenIndex(int index) const {
93 return list_[index].token_index;
94 }
95 intptr_t TryIndex(int index) const {
96 return list_[index].try_index;
97 }
98
99 void AddDescriptor(PcDescriptors::Kind kind,
100 intptr_t pc_offset,
101 intptr_t node_id,
102 intptr_t token_index,
103 intptr_t try_index) {
104 struct PcDesc data;
105 data.pc_offset = pc_offset;
106 data.kind = kind;
107 data.node_id = node_id;
108 data.token_index = token_index;
109 data.try_index = try_index;
110 list_.Add(data);
111 }
112
113 RawPcDescriptors* FinalizePcDescriptors(uword entry_point) {
114 intptr_t num_descriptors = Length();
115 const PcDescriptors& descriptors =
116 PcDescriptors::Handle(PcDescriptors::New(num_descriptors));
117 for (intptr_t i = 0; i < num_descriptors; i++) {
118 descriptors.AddDescriptor(i,
119 (entry_point + PcOffset(i)),
120 Kind(i),
121 NodeId(i),
122 TokenIndex(i),
123 TryIndex(i));
124 }
125 return descriptors.raw();
126 }
127
128 private:
129 GrowableArray<struct PcDesc> list_;
130 DISALLOW_COPY_AND_ASSIGN(DescriptorList);
131 };
132
133
134 class CodeGenerator::HandlerList : public ZoneAllocated { 65 class CodeGenerator::HandlerList : public ZoneAllocated {
135 public: 66 public:
136 struct HandlerDesc { 67 struct HandlerDesc {
137 intptr_t try_index; // Try block index handled by the handler. 68 intptr_t try_index; // Try block index handled by the handler.
138 intptr_t pc_offset; // Handler PC offset value. 69 intptr_t pc_offset; // Handler PC offset value.
139 }; 70 };
140 71
141 HandlerList() : list_() { 72 HandlerList() : list_() {
142 } 73 }
143 ~HandlerList() { } 74 ~HandlerList() { }
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 const Error& error = Error::Handle( 2744 const Error& error = Error::Handle(
2814 Parser::FormatError(script, token_index, "Error", format, args)); 2745 Parser::FormatError(script, token_index, "Error", format, args));
2815 va_end(args); 2746 va_end(args);
2816 Isolate::Current()->long_jump_base()->Jump(1, error); 2747 Isolate::Current()->long_jump_base()->Jump(1, error);
2817 UNREACHABLE(); 2748 UNREACHABLE();
2818 } 2749 }
2819 2750
2820 } // namespace dart 2751 } // namespace dart
2821 2752
2822 #endif // defined TARGET_ARCH_X64 2753 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698