| 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/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_index_table.h" | 10 #include "vm/code_index_table.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 | 46 |
| 47 // Extracts IC data associated with a node id. | 47 // Extracts IC data associated with a node id. |
| 48 // TODO(srdjan): Check performance impact of node id search loop. | 48 // TODO(srdjan): Check performance impact of node id search loop. |
| 49 static void ExtractTypeFeedback(const Code& code, | 49 static void ExtractTypeFeedback(const Code& code, |
| 50 SequenceNode* sequence_node) { | 50 SequenceNode* sequence_node) { |
| 51 ASSERT(!code.IsNull() && !code.is_optimized()); | 51 ASSERT(!code.IsNull() && !code.is_optimized()); |
| 52 GrowableArray<AstNode*> all_nodes; | 52 GrowableArray<AstNode*> all_nodes; |
| 53 sequence_node->CollectAllNodes(&all_nodes); | 53 sequence_node->CollectAllNodes(&all_nodes); |
| 54 GrowableArray<intptr_t> node_ids; | 54 GrowableArray<intptr_t> node_ids; |
| 55 GrowableArray<const Array*> arrays; | 55 GrowableArray<const ICData*> ic_data_objs; |
| 56 code.ExtractIcDataArraysAtCalls(&node_ids, &arrays); | 56 code.ExtractIcDataArraysAtCalls(&node_ids, &ic_data_objs); |
| 57 for (intptr_t i = 0; i < node_ids.length(); i++) { | 57 for (intptr_t i = 0; i < node_ids.length(); i++) { |
| 58 intptr_t node_id = node_ids[i]; | 58 intptr_t node_id = node_ids[i]; |
| 59 bool found_node = false; | 59 bool found_node = false; |
| 60 for (intptr_t n = 0; n < all_nodes.length(); n++) { | 60 for (intptr_t n = 0; n < all_nodes.length(); n++) { |
| 61 if (all_nodes[n]->HasId(node_id)) { | 61 if (all_nodes[n]->HasId(node_id)) { |
| 62 found_node = true; | 62 found_node = true; |
| 63 // Make sure we assign ic data array only once. | 63 // Make sure we assign ic data array only once. |
| 64 ASSERT(all_nodes[n]->ICDataAtId(node_id).NumberOfChecks() == 0); | 64 ASSERT(all_nodes[n]->ICDataAtId(node_id).IsNull()); |
| 65 all_nodes[n]->SetIcDataArrayAtId(node_id, *arrays[i]); | 65 all_nodes[n]->SetIcDataAtId(node_id, *ic_data_objs[i]); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 ASSERT(found_node); | 68 ASSERT(found_node); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 RawError* Compiler::Compile(const Library& library, const Script& script) { | 73 RawError* Compiler::Compile(const Library& library, const Script& script) { |
| 74 Isolate* isolate = Isolate::Current(); | 74 Isolate* isolate = Isolate::Current(); |
| 75 Error& error = Error::Handle(); | 75 Error& error = Error::Handle(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } else { | 333 } else { |
| 334 result = isolate->object_store()->sticky_error(); | 334 result = isolate->object_store()->sticky_error(); |
| 335 isolate->object_store()->clear_sticky_error(); | 335 isolate->object_store()->clear_sticky_error(); |
| 336 } | 336 } |
| 337 isolate->set_long_jump_base(base); | 337 isolate->set_long_jump_base(base); |
| 338 return result.raw(); | 338 return result.raw(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 } // namespace dart | 342 } // namespace dart |
| OLD | NEW |