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

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

Issue 9624025: Implement strict comparison and native calls in flow graph compiler x64. (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 | « no previous file | 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 EmitInstanceCall(comp->node_id(), 142 EmitInstanceCall(comp->node_id(),
143 comp->token_index(), 143 comp->token_index(),
144 comp->function_name(), 144 comp->function_name(),
145 comp->ArgumentCount(), 145 comp->ArgumentCount(),
146 comp->argument_names(), 146 comp->argument_names(),
147 comp->checked_argument_count()); 147 comp->checked_argument_count());
148 } 148 }
149 149
150 150
151 void FlowGraphCompiler::VisitStrictCompare(StrictCompareComp* comp) { 151 void FlowGraphCompiler::VisitStrictCompare(StrictCompareComp* comp) {
152 Bailout("StrictCompareComp"); 152 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
153 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
154 LoadValue(comp->left());
155 __ movq(RDX, RAX);
156 LoadValue(comp->right());
157 __ cmpq(RAX, RDX);
158 Label load_true, done;
159 if (comp->kind() == Token::kEQ_STRICT) {
160 __ j(EQUAL, &load_true, Assembler::kNearJump);
161 } else {
162 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump);
163 }
164 __ LoadObject(RAX, bool_false);
165 __ jmp(&done, Assembler::kNearJump);
166 __ Bind(&load_true);
167 __ LoadObject(RAX, bool_true);
168 __ Bind(&done);
153 } 169 }
154 170
155 171
156 172
157 void FlowGraphCompiler::VisitStaticCall(StaticCallComp* comp) { 173 void FlowGraphCompiler::VisitStaticCall(StaticCallComp* comp) {
158 ASSERT(VerifyCallComputation(comp)); 174 ASSERT(VerifyCallComputation(comp));
159 175
160 int argument_count = comp->ArgumentCount(); 176 int argument_count = comp->ArgumentCount();
161 const Array& arguments_descriptor = 177 const Array& arguments_descriptor =
162 CodeGenerator::ArgumentsDescriptor(argument_count, 178 CodeGenerator::ArgumentsDescriptor(argument_count,
(...skipping 19 matching lines...) Expand all
182 void FlowGraphCompiler::VisitStoreLocal(StoreLocalComp* comp) { 198 void FlowGraphCompiler::VisitStoreLocal(StoreLocalComp* comp) {
183 if (comp->local().is_captured()) { 199 if (comp->local().is_captured()) {
184 Bailout("store to context variable"); 200 Bailout("store to context variable");
185 } 201 }
186 LoadValue(comp->value()); 202 LoadValue(comp->value());
187 __ movq(Address(RBP, comp->local().index() * kWordSize), RAX); 203 __ movq(Address(RBP, comp->local().index() * kWordSize), RAX);
188 } 204 }
189 205
190 206
191 void FlowGraphCompiler::VisitNativeCall(NativeCallComp* comp) { 207 void FlowGraphCompiler::VisitNativeCall(NativeCallComp* comp) {
192 Bailout("NativeCallComp"); 208 // Push the result place holder initialized to NULL.
209 __ PushObject(Object::ZoneHandle());
210 // Pass a pointer to the first argument in RAX.
211 if (!comp->has_optional_parameters()) {
212 __ leaq(RAX, Address(RBP, (1 + comp->argument_count()) * kWordSize));
213 } else {
214 __ leaq(RAX, Address(RBP, -1 * kWordSize));
215 }
216 __ movq(RBX, Immediate(reinterpret_cast<uword>(comp->native_c_function())));
217 __ movq(R10, Immediate(comp->argument_count()));
218 GenerateCall(comp->token_index(),
219 &StubCode::CallNativeCFunctionLabel(),
220 PcDescriptors::kOther);
221 __ popq(RAX);
193 } 222 }
194 223
195 224
196 void FlowGraphCompiler::VisitLoadInstanceField(LoadInstanceFieldComp* comp) { 225 void FlowGraphCompiler::VisitLoadInstanceField(LoadInstanceFieldComp* comp) {
197 LoadValue(comp->instance()); // -> RAX. 226 LoadValue(comp->instance()); // -> RAX.
198 __ movq(RAX, FieldAddress(RAX, comp->field().Offset())); 227 __ movq(RAX, FieldAddress(RAX, comp->field().Offset()));
199 } 228 }
200 229
201 230
202 void FlowGraphCompiler::VisitStoreInstanceField(StoreInstanceFieldComp* comp) { 231 void FlowGraphCompiler::VisitStoreInstanceField(StoreInstanceFieldComp* comp) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { 536 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) {
508 // We don't compile exception handlers yet. 537 // We don't compile exception handlers yet.
509 code.set_exception_handlers( 538 code.set_exception_handlers(
510 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); 539 ExceptionHandlers::Handle(ExceptionHandlers::New(0)));
511 } 540 }
512 541
513 542
514 } // namespace dart 543 } // namespace dart
515 544
516 #endif // defined TARGET_ARCH_X64 545 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698