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 "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Fall through if bool_register contains null. | 55 // Fall through if bool_register contains null. |
56 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, | 56 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, |
57 Label* is_true, | 57 Label* is_true, |
58 Label* is_false) { | 58 Label* is_false) { |
59 const Immediate raw_null = | 59 const Immediate raw_null = |
60 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 60 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
61 Label fall_through; | 61 Label fall_through; |
62 __ cmpl(bool_register, raw_null); | 62 __ cmpl(bool_register, raw_null); |
63 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 63 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
64 __ CompareObject(bool_register, bool_true()); | 64 __ CompareObject(bool_register, Bool::True()); |
65 __ j(EQUAL, is_true); | 65 __ j(EQUAL, is_true); |
66 __ jmp(is_false); | 66 __ jmp(is_false); |
67 __ Bind(&fall_through); | 67 __ Bind(&fall_through); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 // Clobbers ECX. | 71 // Clobbers ECX. |
72 RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( | 72 RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( |
73 TypeTestStubKind test_kind, | 73 TypeTestStubKind test_kind, |
74 Register instance_reg, | 74 Register instance_reg, |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 __ pushl(ECX); // Instantiator. | 489 __ pushl(ECX); // Instantiator. |
490 __ pushl(EDX); // Instantiator type arguments. | 490 __ pushl(EDX); // Instantiator type arguments. |
491 __ LoadObject(EAX, test_cache); | 491 __ LoadObject(EAX, test_cache); |
492 __ pushl(EAX); | 492 __ pushl(EAX); |
493 GenerateCallRuntime(token_pos, kInstanceofRuntimeEntry, locs); | 493 GenerateCallRuntime(token_pos, kInstanceofRuntimeEntry, locs); |
494 // Pop the parameters supplied to the runtime entry. The result of the | 494 // Pop the parameters supplied to the runtime entry. The result of the |
495 // instanceof runtime call will be left as the result of the operation. | 495 // instanceof runtime call will be left as the result of the operation. |
496 __ Drop(5); | 496 __ Drop(5); |
497 if (negate_result) { | 497 if (negate_result) { |
498 __ popl(EDX); | 498 __ popl(EDX); |
499 __ LoadObject(EAX, bool_true()); | 499 __ LoadObject(EAX, Bool::True()); |
500 __ cmpl(EDX, EAX); | 500 __ cmpl(EDX, EAX); |
501 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 501 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
502 __ LoadObject(EAX, bool_false()); | 502 __ LoadObject(EAX, Bool::False()); |
503 } else { | 503 } else { |
504 __ popl(EAX); | 504 __ popl(EAX); |
505 } | 505 } |
506 __ jmp(&done, Assembler::kNearJump); | 506 __ jmp(&done, Assembler::kNearJump); |
507 } | 507 } |
508 __ Bind(&is_not_instance); | 508 __ Bind(&is_not_instance); |
509 __ LoadObject(EAX, negate_result ? bool_true() : bool_false()); | 509 __ LoadObject(EAX, negate_result ? Bool::True() : Bool::False()); |
510 __ jmp(&done, Assembler::kNearJump); | 510 __ jmp(&done, Assembler::kNearJump); |
511 | 511 |
512 __ Bind(&is_instance); | 512 __ Bind(&is_instance); |
513 __ LoadObject(EAX, negate_result ? bool_false() : bool_true()); | 513 __ LoadObject(EAX, negate_result ? Bool::False() : Bool::True()); |
514 __ Bind(&done); | 514 __ Bind(&done); |
515 __ popl(EDX); // Remove pushed instantiator type arguments. | 515 __ popl(EDX); // Remove pushed instantiator type arguments. |
516 __ popl(ECX); // Remove pushed instantiator. | 516 __ popl(ECX); // Remove pushed instantiator. |
517 } | 517 } |
518 | 518 |
519 | 519 |
520 // Optimize assignable type check by adding inlined tests for: | 520 // Optimize assignable type check by adding inlined tests for: |
521 // - NULL -> return NULL. | 521 // - NULL -> return NULL. |
522 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 522 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
523 // - Class equality (only if class is not parameterized). | 523 // - Class equality (only if class is not parameterized). |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 __ cmpl(Address(ESP, 0 * kWordSize), raw_null); | 1239 __ cmpl(Address(ESP, 0 * kWordSize), raw_null); |
1240 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 1240 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
1241 __ cmpl(Address(ESP, 1 * kWordSize), raw_null); | 1241 __ cmpl(Address(ESP, 1 * kWordSize), raw_null); |
1242 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 1242 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
1243 | 1243 |
1244 __ Bind(&check_identity); | 1244 __ Bind(&check_identity); |
1245 __ popl(result); | 1245 __ popl(result); |
1246 __ cmpl(result, Address(ESP, 0 * kWordSize)); | 1246 __ cmpl(result, Address(ESP, 0 * kWordSize)); |
1247 Label is_false; | 1247 Label is_false; |
1248 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump); | 1248 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump); |
1249 __ LoadObject(result, bool_true()); | 1249 __ LoadObject(result, Bool::True()); |
1250 __ Drop(1); | 1250 __ Drop(1); |
1251 __ jmp(skip_call); | 1251 __ jmp(skip_call); |
1252 __ Bind(&is_false); | 1252 __ Bind(&is_false); |
1253 __ LoadObject(result, bool_false()); | 1253 __ LoadObject(result, Bool::False()); |
1254 __ Drop(1); | 1254 __ Drop(1); |
1255 __ jmp(skip_call); | 1255 __ jmp(skip_call); |
1256 __ Bind(&fall_through); | 1256 __ Bind(&fall_through); |
1257 } | 1257 } |
1258 | 1258 |
1259 | 1259 |
1260 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1260 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
1261 Register reg, | 1261 Register reg, |
1262 Register temp, | 1262 Register temp, |
1263 Label* not_double_or_smi) { | 1263 Label* not_double_or_smi) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 __ popl(ECX); | 1499 __ popl(ECX); |
1500 __ popl(EAX); | 1500 __ popl(EAX); |
1501 } | 1501 } |
1502 | 1502 |
1503 | 1503 |
1504 #undef __ | 1504 #undef __ |
1505 | 1505 |
1506 } // namespace dart | 1506 } // namespace dart |
1507 | 1507 |
1508 #endif // defined TARGET_ARCH_IA32 | 1508 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |