| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ASSERT(type_arguments.IsInstantiated()); | 208 ASSERT(type_arguments.IsInstantiated()); |
| 209 Error& malformed_error = Error::Handle(); | 209 Error& malformed_error = Error::Handle(); |
| 210 if (!type_arguments.IsWithinBoundsOf(cls, | 210 if (!type_arguments.IsWithinBoundsOf(cls, |
| 211 bounds_instantiator, | 211 bounds_instantiator, |
| 212 &malformed_error)) { | 212 &malformed_error)) { |
| 213 ASSERT(!malformed_error.IsNull()); | 213 ASSERT(!malformed_error.IsNull()); |
| 214 // Throw a dynamic type error. | 214 // Throw a dynamic type error. |
| 215 const intptr_t location = GetCallerLocation(); | 215 const intptr_t location = GetCallerLocation(); |
| 216 String& malformed_error_message = String::Handle( | 216 String& malformed_error_message = String::Handle( |
| 217 String::New(malformed_error.ToErrorCString())); | 217 String::New(malformed_error.ToErrorCString())); |
| 218 const String& no_name = String::Handle(Symbols::New("")); | 218 const String& no_name = String::Handle(Symbols::Empty()); |
| 219 Exceptions::CreateAndThrowTypeError( | 219 Exceptions::CreateAndThrowTypeError( |
| 220 location, no_name, no_name, no_name, malformed_error_message); | 220 location, no_name, no_name, no_name, malformed_error_message); |
| 221 UNREACHABLE(); | 221 UNREACHABLE(); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 instance.SetTypeArguments(type_arguments); | 224 instance.SetTypeArguments(type_arguments); |
| 225 } | 225 } |
| 226 | 226 |
| 227 | 227 |
| 228 // Instantiate type arguments. | 228 // Instantiate type arguments. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 Bool::True() : Bool::False()); | 571 Bool::True() : Bool::False()); |
| 572 if (FLAG_trace_type_checks) { | 572 if (FLAG_trace_type_checks) { |
| 573 PrintTypeCheck("InstanceOf", | 573 PrintTypeCheck("InstanceOf", |
| 574 instance, type, instantiator_type_arguments, result); | 574 instance, type, instantiator_type_arguments, result); |
| 575 } | 575 } |
| 576 if (!result.value() && !malformed_error.IsNull()) { | 576 if (!result.value() && !malformed_error.IsNull()) { |
| 577 // Throw a dynamic type error only if the instanceof test fails. | 577 // Throw a dynamic type error only if the instanceof test fails. |
| 578 const intptr_t location = GetCallerLocation(); | 578 const intptr_t location = GetCallerLocation(); |
| 579 String& malformed_error_message = String::Handle( | 579 String& malformed_error_message = String::Handle( |
| 580 String::New(malformed_error.ToErrorCString())); | 580 String::New(malformed_error.ToErrorCString())); |
| 581 const String& no_name = String::Handle(Symbols::New("")); | 581 const String& no_name = String::Handle(Symbols::Empty()); |
| 582 Exceptions::CreateAndThrowTypeError( | 582 Exceptions::CreateAndThrowTypeError( |
| 583 location, no_name, no_name, no_name, malformed_error_message); | 583 location, no_name, no_name, no_name, malformed_error_message); |
| 584 UNREACHABLE(); | 584 UNREACHABLE(); |
| 585 } | 585 } |
| 586 UpdateTypeTestCache(node_id, instance, type, instantiator, | 586 UpdateTypeTestCache(node_id, instance, type, instantiator, |
| 587 instantiator_type_arguments, result, cache); | 587 instantiator_type_arguments, result, cache); |
| 588 arguments.SetReturn(result); | 588 arguments.SetReturn(result); |
| 589 } | 589 } |
| 590 | 590 |
| 591 | 591 |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 const String& original_function_name = String::Handle(ic_data.target_name()); | 1184 const String& original_function_name = String::Handle(ic_data.target_name()); |
| 1185 ASSERT(!Array::CheckedHandle(arguments.At(2)).IsNull()); | 1185 ASSERT(!Array::CheckedHandle(arguments.At(2)).IsNull()); |
| 1186 const Array& orig_arguments = Array::CheckedHandle(arguments.At(3)); | 1186 const Array& orig_arguments = Array::CheckedHandle(arguments.At(3)); |
| 1187 // TODO(regis): The signature of the "noSuchMethod" method has to change from | 1187 // TODO(regis): The signature of the "noSuchMethod" method has to change from |
| 1188 // noSuchMethod(String name, Array arguments) to something like | 1188 // noSuchMethod(String name, Array arguments) to something like |
| 1189 // noSuchMethod(InvocationMirror call). | 1189 // noSuchMethod(InvocationMirror call). |
| 1190 const int kNumArguments = 3; | 1190 const int kNumArguments = 3; |
| 1191 const int kNumNamedArguments = 0; | 1191 const int kNumNamedArguments = 0; |
| 1192 const Array& kNoArgumentNames = Array::Handle(); | 1192 const Array& kNoArgumentNames = Array::Handle(); |
| 1193 const String& function_name = | 1193 const String& function_name = |
| 1194 String::Handle(Symbols::New("noSuchMethod")); | 1194 String::Handle(Symbols::NoSuchMethod()); |
| 1195 const Function& function = Function::ZoneHandle( | 1195 const Function& function = Function::ZoneHandle( |
| 1196 Resolver::ResolveDynamic(receiver, | 1196 Resolver::ResolveDynamic(receiver, |
| 1197 function_name, | 1197 function_name, |
| 1198 kNumArguments, | 1198 kNumArguments, |
| 1199 kNumNamedArguments)); | 1199 kNumNamedArguments)); |
| 1200 ASSERT(!function.IsNull()); | 1200 ASSERT(!function.IsNull()); |
| 1201 GrowableArray<const Object*> invoke_arguments(2); | 1201 GrowableArray<const Object*> invoke_arguments(2); |
| 1202 invoke_arguments.Add(&original_function_name); | 1202 invoke_arguments.Add(&original_function_name); |
| 1203 invoke_arguments.Add(&orig_arguments); | 1203 invoke_arguments.Add(&orig_arguments); |
| 1204 const Object& result = Object::Handle( | 1204 const Object& result = Object::Handle( |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 } | 1569 } |
| 1570 } | 1570 } |
| 1571 } | 1571 } |
| 1572 // The cache is null terminated, therefore the loop above should never | 1572 // The cache is null terminated, therefore the loop above should never |
| 1573 // terminate by itself. | 1573 // terminate by itself. |
| 1574 UNREACHABLE(); | 1574 UNREACHABLE(); |
| 1575 return Code::null(); | 1575 return Code::null(); |
| 1576 } | 1576 } |
| 1577 | 1577 |
| 1578 } // namespace dart | 1578 } // namespace dart |
| OLD | NEW |