Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" | 5 #include "vm/kernel_binary_flowgraph.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 4560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4571 const TypeArguments& type_arguments) { | 4571 const TypeArguments& type_arguments) { |
| 4572 return flow_graph_builder_->TranslateInstantiatedTypeArguments( | 4572 return flow_graph_builder_->TranslateInstantiatedTypeArguments( |
| 4573 type_arguments); | 4573 type_arguments); |
| 4574 } | 4574 } |
| 4575 | 4575 |
| 4576 Fragment StreamingFlowGraphBuilder::StrictCompare(Token::Kind kind, | 4576 Fragment StreamingFlowGraphBuilder::StrictCompare(Token::Kind kind, |
| 4577 bool number_check) { | 4577 bool number_check) { |
| 4578 return flow_graph_builder_->StrictCompare(kind, number_check); | 4578 return flow_graph_builder_->StrictCompare(kind, number_check); |
| 4579 } | 4579 } |
| 4580 | 4580 |
| 4581 Fragment StreamingFlowGraphBuilder::AllocateObject(const dart::Class& klass, | 4581 Fragment StreamingFlowGraphBuilder::AllocateObject(TokenPosition position, |
| 4582 const dart::Class& klass, | |
| 4582 intptr_t argument_count) { | 4583 intptr_t argument_count) { |
| 4583 return flow_graph_builder_->AllocateObject(klass, argument_count); | 4584 return flow_graph_builder_->AllocateObject(position, klass, argument_count); |
| 4584 } | 4585 } |
| 4585 | 4586 |
| 4586 Fragment StreamingFlowGraphBuilder::InstanceCall(TokenPosition position, | 4587 Fragment StreamingFlowGraphBuilder::InstanceCall(TokenPosition position, |
| 4587 const dart::String& name, | 4588 const dart::String& name, |
| 4588 Token::Kind kind, | 4589 Token::Kind kind, |
| 4589 intptr_t argument_count, | 4590 intptr_t argument_count, |
| 4590 const Array& argument_names, | 4591 const Array& argument_names, |
| 4591 intptr_t num_args_checked) { | 4592 intptr_t num_args_checked) { |
| 4592 return flow_graph_builder_->InstanceCall(position, name, kind, argument_count, | 4593 return flow_graph_builder_->InstanceCall(position, name, kind, argument_count, |
| 4593 argument_names, num_args_checked); | 4594 argument_names, num_args_checked); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5212 // In that case we'll make an instance and pass it as first argument. | 5213 // In that case we'll make an instance and pass it as first argument. |
| 5213 // | 5214 // |
| 5214 // TODO(27590): Get rid of this after we're using core libraries compiled | 5215 // TODO(27590): Get rid of this after we're using core libraries compiled |
| 5215 // into Kernel. | 5216 // into Kernel. |
| 5216 if (target.IsGenerativeConstructor()) { | 5217 if (target.IsGenerativeConstructor()) { |
| 5217 if (klass.NumTypeArguments() > 0) { | 5218 if (klass.NumTypeArguments() > 0) { |
| 5218 const TypeArguments& type_arguments = | 5219 const TypeArguments& type_arguments = |
| 5219 PeekArgumentsInstantiatedType(klass); | 5220 PeekArgumentsInstantiatedType(klass); |
| 5220 instructions += TranslateInstantiatedTypeArguments(type_arguments); | 5221 instructions += TranslateInstantiatedTypeArguments(type_arguments); |
| 5221 instructions += PushArgument(); | 5222 instructions += PushArgument(); |
| 5222 instructions += AllocateObject(klass, 1); | 5223 instructions += AllocateObject(position, klass, 1); |
| 5223 } else { | 5224 } else { |
| 5224 instructions += AllocateObject(klass, 0); | 5225 instructions += AllocateObject(position, klass, 0); |
| 5225 } | 5226 } |
| 5226 | 5227 |
| 5227 instance_variable = MakeTemporary(); | 5228 instance_variable = MakeTemporary(); |
| 5228 | 5229 |
| 5229 instructions += LoadLocal(instance_variable); | 5230 instructions += LoadLocal(instance_variable); |
| 5230 instructions += PushArgument(); | 5231 instructions += PushArgument(); |
| 5231 } else if (target.IsFactory()) { | 5232 } else if (target.IsFactory()) { |
| 5232 // The VM requires currently a TypeArguments object as first parameter for | 5233 // The VM requires currently a TypeArguments object as first parameter for |
| 5233 // every factory constructor :-/ ! | 5234 // every factory constructor :-/ ! |
| 5234 // | 5235 // |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5332 TypeArguments& canonicalized_type_arguments = | 5333 TypeArguments& canonicalized_type_arguments = |
| 5333 TypeArguments::ZoneHandle(Z, type.arguments()); | 5334 TypeArguments::ZoneHandle(Z, type.arguments()); |
| 5334 canonicalized_type_arguments = | 5335 canonicalized_type_arguments = |
| 5335 canonicalized_type_arguments.Canonicalize(); | 5336 canonicalized_type_arguments.Canonicalize(); |
| 5336 instructions += Constant(canonicalized_type_arguments); | 5337 instructions += Constant(canonicalized_type_arguments); |
| 5337 } else { | 5338 } else { |
| 5338 instructions += TranslateInstantiatedTypeArguments(type_arguments); | 5339 instructions += TranslateInstantiatedTypeArguments(type_arguments); |
| 5339 } | 5340 } |
| 5340 | 5341 |
| 5341 instructions += PushArgument(); | 5342 instructions += PushArgument(); |
| 5342 instructions += AllocateObject(klass, 1); | 5343 instructions += AllocateObject(position, klass, 1); |
| 5343 } else { | 5344 } else { |
| 5344 instructions += AllocateObject(klass, 0); | 5345 instructions += AllocateObject(position, klass, 0); |
| 5345 } | 5346 } |
| 5346 LocalVariable* variable = MakeTemporary(); | 5347 LocalVariable* variable = MakeTemporary(); |
| 5347 | 5348 |
| 5348 instructions += LoadLocal(variable); | 5349 instructions += LoadLocal(variable); |
| 5349 instructions += PushArgument(); | 5350 instructions += PushArgument(); |
| 5350 | 5351 |
| 5351 Array& argument_names = Array::ZoneHandle(Z); | 5352 Array& argument_names = Array::ZoneHandle(Z); |
| 5352 intptr_t argument_count; | 5353 intptr_t argument_count; |
| 5353 instructions += | 5354 instructions += |
| 5354 BuildArguments(&argument_names, &argument_count); // read arguments. | 5355 BuildArguments(&argument_names, &argument_count); // read arguments. |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5911 Z, klass.LookupConstructorAllowPrivate( | 5912 Z, klass.LookupConstructorAllowPrivate( |
| 5912 H.DartSymbol("_AssertionError._create"))); | 5913 H.DartSymbol("_AssertionError._create"))); |
| 5913 ASSERT(!constructor.IsNull()); | 5914 ASSERT(!constructor.IsNull()); |
| 5914 | 5915 |
| 5915 const dart::String& url = H.DartString( | 5916 const dart::String& url = H.DartString( |
| 5916 parsed_function()->function().ToLibNamePrefixedQualifiedCString(), | 5917 parsed_function()->function().ToLibNamePrefixedQualifiedCString(), |
| 5917 Heap::kOld); | 5918 Heap::kOld); |
| 5918 | 5919 |
| 5919 // Create instance of _AssertionError | 5920 // Create instance of _AssertionError |
| 5920 Fragment otherwise_fragment(otherwise); | 5921 Fragment otherwise_fragment(otherwise); |
| 5921 otherwise_fragment += AllocateObject(klass, 0); | 5922 otherwise_fragment += AllocateObject(TokenPosition::kNoSource, klass, 0); |
| 5922 LocalVariable* instance = MakeTemporary(); | 5923 LocalVariable* instance = MakeTemporary(); |
| 5923 | 5924 |
| 5924 // Call _AssertionError._create constructor. | 5925 // Call _AssertionError._create constructor. |
| 5925 otherwise_fragment += LoadLocal(instance); | 5926 otherwise_fragment += LoadLocal(instance); |
| 5926 otherwise_fragment += PushArgument(); // this | 5927 otherwise_fragment += PushArgument(); // this |
| 5927 | 5928 |
| 5928 otherwise_fragment += Constant(H.DartString("<no message>", Heap::kOld)); | 5929 otherwise_fragment += Constant(H.DartString("<no message>", Heap::kOld)); |
| 5929 otherwise_fragment += PushArgument(); // failedAssertion | 5930 otherwise_fragment += PushArgument(); // failedAssertion |
| 5930 | 5931 |
| 5931 otherwise_fragment += Constant(url); | 5932 otherwise_fragment += Constant(url); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6231 ASSERT(!klass.IsNull()); | 6232 ASSERT(!klass.IsNull()); |
| 6232 const dart::Function& constructor = dart::Function::ZoneHandle( | 6233 const dart::Function& constructor = dart::Function::ZoneHandle( |
| 6233 Z, klass.LookupConstructorAllowPrivate( | 6234 Z, klass.LookupConstructorAllowPrivate( |
| 6234 H.DartSymbol("FallThroughError._create"))); | 6235 H.DartSymbol("FallThroughError._create"))); |
| 6235 ASSERT(!constructor.IsNull()); | 6236 ASSERT(!constructor.IsNull()); |
| 6236 const dart::String& url = H.DartString( | 6237 const dart::String& url = H.DartString( |
| 6237 parsed_function()->function().ToLibNamePrefixedQualifiedCString(), | 6238 parsed_function()->function().ToLibNamePrefixedQualifiedCString(), |
| 6238 Heap::kOld); | 6239 Heap::kOld); |
| 6239 | 6240 |
| 6240 // Create instance of _FallThroughError | 6241 // Create instance of _FallThroughError |
| 6241 body_fragment += AllocateObject(klass, 0); | 6242 body_fragment += AllocateObject(TokenPosition::kNoSource, klass, 0); |
|
Vyacheslav Egorov (Google)
2017/06/16 11:09:18
I guess this needs some informative position event
jensj
2017/06/16 11:39:07
I'll give parser.cc an extra look to see if I can
jensj
2017/06/16 11:55:33
Actually, this gives us the excellent exception
``
| |
| 6242 LocalVariable* instance = MakeTemporary(); | 6243 LocalVariable* instance = MakeTemporary(); |
| 6243 | 6244 |
| 6244 // Call _FallThroughError._create constructor. | 6245 // Call _FallThroughError._create constructor. |
| 6245 body_fragment += LoadLocal(instance); | 6246 body_fragment += LoadLocal(instance); |
| 6246 body_fragment += PushArgument(); // this | 6247 body_fragment += PushArgument(); // this |
| 6247 | 6248 |
| 6248 body_fragment += Constant(url); | 6249 body_fragment += Constant(url); |
| 6249 body_fragment += PushArgument(); // url | 6250 body_fragment += PushArgument(); // url |
| 6250 | 6251 |
| 6251 body_fragment += NullConstant(); | 6252 body_fragment += NullConstant(); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7150 metadata_values.SetAt(i, value); | 7151 metadata_values.SetAt(i, value); |
| 7151 } | 7152 } |
| 7152 | 7153 |
| 7153 return metadata_values.raw(); | 7154 return metadata_values.raw(); |
| 7154 } | 7155 } |
| 7155 | 7156 |
| 7156 } // namespace kernel | 7157 } // namespace kernel |
| 7157 } // namespace dart | 7158 } // namespace dart |
| 7158 | 7159 |
| 7159 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7160 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |