| 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/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 const intptr_t class_id = create->Type()->ToCid(); | 1676 const intptr_t class_id = create->Type()->ToCid(); |
| 1677 const intptr_t deopt_id = Isolate::kNoDeoptId; | 1677 const intptr_t deopt_id = Isolate::kNoDeoptId; |
| 1678 for (int i = 0; i < node->length(); ++i) { | 1678 for (int i = 0; i < node->length(); ++i) { |
| 1679 Value* array = Bind( | 1679 Value* array = Bind( |
| 1680 new LoadLocalInstr(node->temp_local(), owner()->context_level())); | 1680 new LoadLocalInstr(node->temp_local(), owner()->context_level())); |
| 1681 Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(i)))); | 1681 Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(i)))); |
| 1682 ValueGraphVisitor for_value(owner(), temp_index()); | 1682 ValueGraphVisitor for_value(owner(), temp_index()); |
| 1683 node->ElementAt(i)->Visit(&for_value); | 1683 node->ElementAt(i)->Visit(&for_value); |
| 1684 Append(for_value); | 1684 Append(for_value); |
| 1685 // No store barrier needed for constants. | 1685 // No store barrier needed for constants. |
| 1686 const bool emit_store_barrier = !for_value.value()->BindsToConstant(); | 1686 const StoreBarrierType emit_store_barrier = |
| 1687 for_value.value()->BindsToConstant() |
| 1688 ? kNoStoreBarrier |
| 1689 : kEmitStoreBarrier; |
| 1687 StoreIndexedInstr* store = new StoreIndexedInstr( | 1690 StoreIndexedInstr* store = new StoreIndexedInstr( |
| 1688 array, index, for_value.value(), | 1691 array, index, for_value.value(), |
| 1689 emit_store_barrier, class_id, deopt_id); | 1692 emit_store_barrier, class_id, deopt_id); |
| 1690 Do(store); | 1693 Do(store); |
| 1691 } | 1694 } |
| 1692 | 1695 |
| 1693 ReturnDefinition( | 1696 ReturnDefinition( |
| 1694 new LoadLocalInstr(node->temp_local(), owner()->context_level())); | 1697 new LoadLocalInstr(node->temp_local(), owner()->context_level())); |
| 1695 } | 1698 } |
| 1696 | 1699 |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2559 Append(for_value); | 2562 Append(for_value); |
| 2560 Value* store_value = for_value.value(); | 2563 Value* store_value = for_value.value(); |
| 2561 if (FLAG_enable_type_checks) { | 2564 if (FLAG_enable_type_checks) { |
| 2562 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); | 2565 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); |
| 2563 const String& dst_name = String::ZoneHandle(node->field().name()); | 2566 const String& dst_name = String::ZoneHandle(node->field().name()); |
| 2564 store_value = BuildAssignableValue(node->value()->token_pos(), | 2567 store_value = BuildAssignableValue(node->value()->token_pos(), |
| 2565 store_value, | 2568 store_value, |
| 2566 type, | 2569 type, |
| 2567 dst_name); | 2570 dst_name); |
| 2568 } | 2571 } |
| 2569 const bool kEmitStoreBarrier = true; | |
| 2570 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr( | 2572 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr( |
| 2571 node->field(), for_instance.value(), store_value, kEmitStoreBarrier); | 2573 node->field(), for_instance.value(), store_value, kEmitStoreBarrier); |
| 2572 ReturnDefinition(store); | 2574 ReturnDefinition(store); |
| 2573 } | 2575 } |
| 2574 | 2576 |
| 2575 | 2577 |
| 2576 // StoreInstanceFieldNode does not return result. | 2578 // StoreInstanceFieldNode does not return result. |
| 2577 void ValueGraphVisitor::VisitStoreInstanceFieldNode( | 2579 void ValueGraphVisitor::VisitStoreInstanceFieldNode( |
| 2578 StoreInstanceFieldNode* node) { | 2580 StoreInstanceFieldNode* node) { |
| 2579 UNIMPLEMENTED(); | 2581 UNIMPLEMENTED(); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3266 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3265 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3267 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3266 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3268 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3267 const Error& error = Error::Handle( | 3269 const Error& error = Error::Handle( |
| 3268 LanguageError::New(String::Handle(String::New(chars)))); | 3270 LanguageError::New(String::Handle(String::New(chars)))); |
| 3269 Isolate::Current()->long_jump_base()->Jump(1, error); | 3271 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3270 } | 3272 } |
| 3271 | 3273 |
| 3272 | 3274 |
| 3273 } // namespace dart | 3275 } // namespace dart |
| OLD | NEW |