| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 comp->function_name(), | 230 comp->function_name(), |
| 231 comp->ArgumentCount(), | 231 comp->ArgumentCount(), |
| 232 comp->argument_names(), | 232 comp->argument_names(), |
| 233 comp->checked_argument_count()); | 233 comp->checked_argument_count()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 void FlowGraphCompiler::VisitStrictCompare(StrictCompareComp* comp) { | 237 void FlowGraphCompiler::VisitStrictCompare(StrictCompareComp* comp) { |
| 238 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 238 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| 239 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 239 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
| 240 LoadValue(RDX, comp->right()); |
| 240 LoadValue(RAX, comp->left()); | 241 LoadValue(RAX, comp->left()); |
| 241 LoadValue(RDX, comp->right()); | |
| 242 __ cmpq(RAX, RDX); | 242 __ cmpq(RAX, RDX); |
| 243 Label load_true, done; | 243 Label load_true, done; |
| 244 if (comp->kind() == Token::kEQ_STRICT) { | 244 if (comp->kind() == Token::kEQ_STRICT) { |
| 245 __ j(EQUAL, &load_true, Assembler::kNearJump); | 245 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 246 } else { | 246 } else { |
| 247 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); | 247 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); |
| 248 } | 248 } |
| 249 __ LoadObject(RAX, bool_false); | 249 __ LoadObject(RAX, bool_false); |
| 250 __ jmp(&done, Assembler::kNearJump); | 250 __ jmp(&done, Assembler::kNearJump); |
| 251 __ Bind(&load_true); | 251 __ Bind(&load_true); |
| 252 __ LoadObject(RAX, bool_true); | 252 __ LoadObject(RAX, bool_true); |
| 253 __ Bind(&done); | 253 __ Bind(&done); |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 void FlowGraphCompiler::VisitEqualityCompare(EqualityCompareComp* comp) { |
| 258 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| 259 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
| 260 const Immediate raw_null = |
| 261 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 262 Label done, load_true, non_null_compare; |
| 263 LoadValue(RDX, comp->right()); |
| 264 LoadValue(RAX, comp->left()); |
| 265 __ cmpq(RAX, raw_null); |
| 266 __ j(NOT_EQUAL, &non_null_compare, Assembler::kNearJump); |
| 267 // Comparison with NULL is "===". |
| 268 __ cmpq(RAX, RDX); |
| 269 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 270 __ LoadObject(RAX, bool_false); |
| 271 __ jmp(&done, Assembler::kNearJump); |
| 272 __ Bind(&load_true); |
| 273 __ LoadObject(RAX, bool_true); |
| 274 __ jmp(&done); |
| 275 |
| 276 __ Bind(&non_null_compare); |
| 277 __ pushq(RAX); |
| 278 __ pushq(RDX); |
| 279 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); |
| 280 const int kNumberOfArguments = 2; |
| 281 const Array& kNoArgumentNames = Array::Handle(); |
| 282 const int kNumArgumentsChecked = 1; |
| 283 |
| 284 EmitInstanceCall(comp->node_id(), |
| 285 comp->token_index(), |
| 286 comp->try_index(), |
| 287 operator_name, |
| 288 kNumberOfArguments, |
| 289 kNoArgumentNames, |
| 290 kNumArgumentsChecked); |
| 291 __ Bind(&done); |
| 292 } |
| 293 |
| 294 |
| 257 void FlowGraphCompiler::VisitStaticCall(StaticCallComp* comp) { | 295 void FlowGraphCompiler::VisitStaticCall(StaticCallComp* comp) { |
| 258 ASSERT(VerifyCallComputation(comp)); | 296 ASSERT(VerifyCallComputation(comp)); |
| 259 EmitStaticCall(comp->token_index(), | 297 EmitStaticCall(comp->token_index(), |
| 260 comp->try_index(), | 298 comp->try_index(), |
| 261 comp->function(), | 299 comp->function(), |
| 262 comp->ArgumentCount(), | 300 comp->ArgumentCount(), |
| 263 comp->argument_names()); | 301 comp->argument_names()); |
| 264 } | 302 } |
| 265 | 303 |
| 266 | 304 |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 ASSERT(exception_handlers_list_ != NULL); | 1391 ASSERT(exception_handlers_list_ != NULL); |
| 1354 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( | 1392 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( |
| 1355 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); | 1393 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); |
| 1356 code.set_exception_handlers(handlers); | 1394 code.set_exception_handlers(handlers); |
| 1357 } | 1395 } |
| 1358 | 1396 |
| 1359 | 1397 |
| 1360 } // namespace dart | 1398 } // namespace dart |
| 1361 | 1399 |
| 1362 #endif // defined TARGET_ARCH_X64 | 1400 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |