| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 // Returns: | 1382 // Returns: |
| 1383 // - true or false on stack. | 1383 // - true or false on stack. |
| 1384 void CodeGenerator::GenerateInstanceOf(intptr_t node_id, | 1384 void CodeGenerator::GenerateInstanceOf(intptr_t node_id, |
| 1385 intptr_t token_index, | 1385 intptr_t token_index, |
| 1386 const Type& type, | 1386 const Type& type, |
| 1387 bool negate_result) { | 1387 bool negate_result) { |
| 1388 ASSERT(type.IsFinalized()); | 1388 ASSERT(type.IsFinalized()); |
| 1389 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 1389 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| 1390 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 1390 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
| 1391 | 1391 |
| 1392 // All instances are of a subtype of the Object type. | 1392 // All instances are of type Object. |
| 1393 const Type& object_type = | 1393 const Type& object_type = |
| 1394 Type::Handle(Isolate::Current()->object_store()->object_type()); | 1394 Type::Handle(Isolate::Current()->object_store()->object_type()); |
| 1395 if (type.IsInstantiated() && object_type.IsSubtypeOf(type)) { | 1395 if (type.IsInstantiated() && object_type.IsSubtypeOf(type)) { |
| 1396 // All objects are an instance of the Object class. |
| 1396 __ PushObject(negate_result ? bool_false : bool_true); | 1397 __ PushObject(negate_result ? bool_false : bool_true); |
| 1397 return; | 1398 return; |
| 1398 } | 1399 } |
| 1399 | 1400 |
| 1400 // A NULL object always returns false for all types other than Object | 1401 // A NULL object always returns false for all types other than Object |
| 1401 // (and Null). | 1402 // (and Null). |
| 1402 const Immediate raw_null = | 1403 const Immediate raw_null = |
| 1403 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1404 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1404 Label non_null, done; | 1405 Label non_null, done; |
| 1405 __ cmpl(EAX, raw_null); | 1406 __ cmpl(EAX, raw_null); |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 const Class& cls = Class::Handle(parsed_function_.function().owner()); | 2708 const Class& cls = Class::Handle(parsed_function_.function().owner()); |
| 2708 const Script& script = Script::Handle(cls.script()); | 2709 const Script& script = Script::Handle(cls.script()); |
| 2709 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); | 2710 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); |
| 2710 Isolate::Current()->long_jump_base()->Jump(1, error_msg); | 2711 Isolate::Current()->long_jump_base()->Jump(1, error_msg); |
| 2711 UNREACHABLE(); | 2712 UNREACHABLE(); |
| 2712 } | 2713 } |
| 2713 | 2714 |
| 2714 } // namespace dart | 2715 } // namespace dart |
| 2715 | 2716 |
| 2716 #endif // defined TARGET_ARCH_IA32 | 2717 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |