Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: vm/compiler.cc

Issue 9630003: Use GrowableObjectArray in ic-data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 57
58 // Extracts IC data associated with a node id. 58 // Extracts IC data associated with a node id.
59 // TODO(srdjan): Check performance impact of node id search loop. 59 // TODO(srdjan): Check performance impact of node id search loop.
60 static void ExtractTypeFeedback(const Code& code, 60 static void ExtractTypeFeedback(const Code& code,
61 SequenceNode* sequence_node) { 61 SequenceNode* sequence_node) {
62 ASSERT(!code.IsNull() && !code.is_optimized()); 62 ASSERT(!code.IsNull() && !code.is_optimized());
63 GrowableArray<AstNode*> all_nodes; 63 GrowableArray<AstNode*> all_nodes;
64 sequence_node->CollectAllNodes(&all_nodes); 64 sequence_node->CollectAllNodes(&all_nodes);
65 GrowableArray<intptr_t> node_ids; 65 GrowableArray<intptr_t> node_ids;
66 GrowableArray<const ICData*> ic_data_objs; 66 const GrowableObjectArray& ic_data_objs =
67 code.ExtractIcDataArraysAtCalls(&node_ids, &ic_data_objs); 67 GrowableObjectArray::Handle(GrowableObjectArray::New());
68 code.ExtractIcDataArraysAtCalls(&node_ids, ic_data_objs);
69 ICData& ic_data_obj = ICData::Handle();
68 for (intptr_t i = 0; i < node_ids.length(); i++) { 70 for (intptr_t i = 0; i < node_ids.length(); i++) {
69 intptr_t node_id = node_ids[i]; 71 intptr_t node_id = node_ids[i];
70 bool found_node = false; 72 bool found_node = false;
71 for (intptr_t n = 0; n < all_nodes.length(); n++) { 73 for (intptr_t n = 0; n < all_nodes.length(); n++) {
72 if (all_nodes[n]->HasId(node_id)) { 74 if (all_nodes[n]->HasId(node_id)) {
73 found_node = true; 75 found_node = true;
74 // Make sure we assign ic data array only once. 76 // Make sure we assign ic data array only once.
75 ASSERT(all_nodes[n]->ICDataAtId(node_id).IsNull()); 77 ASSERT(all_nodes[n]->ICDataAtId(node_id).IsNull());
76 all_nodes[n]->SetIcDataAtId(node_id, *ic_data_objs[i]); 78 ic_data_obj ^= ic_data_objs.At(i);
79 all_nodes[n]->SetIcDataAtId(node_id, ic_data_obj);
77 } 80 }
78 } 81 }
79 ASSERT(found_node); 82 ASSERT(found_node);
80 } 83 }
81 } 84 }
82 85
83 86
84 RawError* Compiler::Compile(const Library& library, const Script& script) { 87 RawError* Compiler::Compile(const Library& library, const Script& script) {
85 Isolate* isolate = Isolate::Current(); 88 Isolate* isolate = Isolate::Current();
86 Error& error = Error::Handle(); 89 Error& error = Error::Handle();
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } else { 395 } else {
393 result = isolate->object_store()->sticky_error(); 396 result = isolate->object_store()->sticky_error();
394 isolate->object_store()->clear_sticky_error(); 397 isolate->object_store()->clear_sticky_error();
395 } 398 }
396 isolate->set_long_jump_base(base); 399 isolate->set_long_jump_base(base);
397 return result.raw(); 400 return result.raw();
398 } 401 }
399 402
400 403
401 } // namespace dart 404 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698