| 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 type Object. | 1392 // All instances are of a subtype of the Object type. |
| 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. | |
| 1397 __ PushObject(negate_result ? bool_false : bool_true); | 1396 __ PushObject(negate_result ? bool_false : bool_true); |
| 1398 return; | 1397 return; |
| 1399 } | 1398 } |
| 1400 | 1399 |
| 1401 // A NULL object always returns false for all types other than Object | 1400 // A NULL object always returns false for all types other than Object |
| 1402 // (and Null). | 1401 // (and Null). |
| 1403 const Immediate raw_null = | 1402 const Immediate raw_null = |
| 1404 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1403 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1405 Label non_null, done; | 1404 Label non_null, done; |
| 1406 __ cmpl(EAX, raw_null); | 1405 __ cmpl(EAX, raw_null); |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 const Class& cls = Class::Handle(parsed_function_.function().owner()); | 2679 const Class& cls = Class::Handle(parsed_function_.function().owner()); |
| 2681 const Script& script = Script::Handle(cls.script()); | 2680 const Script& script = Script::Handle(cls.script()); |
| 2682 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); | 2681 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); |
| 2683 Isolate::Current()->long_jump_base()->Jump(1, error_msg); | 2682 Isolate::Current()->long_jump_base()->Jump(1, error_msg); |
| 2684 UNREACHABLE(); | 2683 UNREACHABLE(); |
| 2685 } | 2684 } |
| 2686 | 2685 |
| 2687 } // namespace dart | 2686 } // namespace dart |
| 2688 | 2687 |
| 2689 #endif // defined TARGET_ARCH_IA32 | 2688 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |