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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 Class::ZoneHandle(Z, isolate()->object_store()->closure_class()); | 2387 Class::ZoneHandle(Z, isolate()->object_store()->closure_class()); |
2388 ZoneGrowableArray<PushArgumentInstr*>* no_arguments = | 2388 ZoneGrowableArray<PushArgumentInstr*>* no_arguments = |
2389 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0); | 2389 new (Z) ZoneGrowableArray<PushArgumentInstr*>(0); |
2390 AllocateObjectInstr* alloc = new (Z) | 2390 AllocateObjectInstr* alloc = new (Z) |
2391 AllocateObjectInstr(node->token_pos(), closure_class, no_arguments); | 2391 AllocateObjectInstr(node->token_pos(), closure_class, no_arguments); |
2392 alloc->set_closure_function(function); | 2392 alloc->set_closure_function(function); |
2393 | 2393 |
2394 Value* closure_val = Bind(alloc); | 2394 Value* closure_val = Bind(alloc); |
2395 { | 2395 { |
2396 LocalVariable* closure_tmp_var = EnterTempLocalScope(closure_val); | 2396 LocalVariable* closure_tmp_var = EnterTempLocalScope(closure_val); |
2397 // Store type arguments if scope class is generic. | 2397 // Store instantiator type arguments if scope class is generic. |
2398 const Type& function_type = Type::ZoneHandle(Z, function.SignatureType()); | 2398 const Type& function_type = Type::ZoneHandle(Z, function.SignatureType()); |
2399 const Class& scope_cls = Class::ZoneHandle(Z, function_type.type_class()); | 2399 const Class& scope_cls = Class::ZoneHandle(Z, function_type.type_class()); |
2400 if (scope_cls.IsGeneric()) { | 2400 if (scope_cls.IsGeneric()) { |
2401 ASSERT(function.Owner() == scope_cls.raw()); | 2401 ASSERT(function.Owner() == scope_cls.raw()); |
2402 Value* closure_tmp_val = | 2402 Value* closure_tmp_val = |
2403 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos())); | 2403 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos())); |
2404 const Class& instantiator_class = | 2404 const Class& instantiator_class = |
2405 Class::Handle(Z, owner()->function().Owner()); | 2405 Class::Handle(Z, owner()->function().Owner()); |
2406 Value* type_arguments = BuildInstantiatorTypeArguments( | 2406 Value* type_arguments = BuildInstantiatorTypeArguments( |
2407 node->token_pos(), instantiator_class, NULL); | 2407 node->token_pos(), instantiator_class, NULL); |
2408 Do(new (Z) StoreInstanceFieldInstr(Closure::type_arguments_offset(), | 2408 Do(new (Z) StoreInstanceFieldInstr(Closure::instantiator_offset(), |
2409 closure_tmp_val, type_arguments, | 2409 closure_tmp_val, type_arguments, |
2410 kEmitStoreBarrier, node->token_pos())); | 2410 kEmitStoreBarrier, node->token_pos())); |
2411 } | 2411 } |
2412 | 2412 |
2413 // Store function. | 2413 // Store function. |
2414 Value* closure_tmp_val = | 2414 Value* closure_tmp_val = |
2415 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos())); | 2415 Bind(new (Z) LoadLocalInstr(*closure_tmp_var, node->token_pos())); |
2416 Value* func_val = | 2416 Value* func_val = |
2417 Bind(new (Z) ConstantInstr(Function::ZoneHandle(Z, function.raw()))); | 2417 Bind(new (Z) ConstantInstr(Function::ZoneHandle(Z, function.raw()))); |
2418 Do(new (Z) StoreInstanceFieldInstr(Closure::function_offset(), | 2418 Do(new (Z) StoreInstanceFieldInstr(Closure::function_offset(), |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4378 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); | 4378 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); |
4379 ASSERT(found); | 4379 ASSERT(found); |
4380 } | 4380 } |
4381 | 4381 |
4382 | 4382 |
4383 void FlowGraphBuilder::Bailout(const char* reason) const { | 4383 void FlowGraphBuilder::Bailout(const char* reason) const { |
4384 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4384 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4385 } | 4385 } |
4386 | 4386 |
4387 } // namespace dart | 4387 } // namespace dart |
OLD | NEW |