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

Side by Side Diff: runtime/vm/compiler.cc

Issue 10832150: Get rid of ast node ids. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/debugger.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_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); 49 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count());
50 const Function& function = Function::CheckedHandle(arguments.At(0)); 50 const Function& function = Function::CheckedHandle(arguments.At(0));
51 ASSERT(!function.HasCode()); 51 ASSERT(!function.HasCode());
52 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 52 const Error& error = Error::Handle(Compiler::CompileFunction(function));
53 if (!error.IsNull()) { 53 if (!error.IsNull()) {
54 Exceptions::PropagateError(error); 54 Exceptions::PropagateError(error);
55 } 55 }
56 } 56 }
57 57
58 58
59 // Returns an array indexed by computation id, containing the extracted ICData. 59 // Returns an array indexed by deopt id, containing the extracted ICData.
60 static RawArray* ExtractTypeFeedbackArray(const Code& code) { 60 static RawArray* ExtractTypeFeedbackArray(const Code& code) {
61 ASSERT(!code.IsNull() && !code.is_optimized()); 61 ASSERT(!code.IsNull() && !code.is_optimized());
62 GrowableArray<intptr_t> computation_ids; 62 GrowableArray<intptr_t> deopt_ids;
63 const GrowableObjectArray& ic_data_objs = 63 const GrowableObjectArray& ic_data_objs =
64 GrowableObjectArray::Handle(GrowableObjectArray::New()); 64 GrowableObjectArray::Handle(GrowableObjectArray::New());
65 const intptr_t max_id = 65 const intptr_t max_id =
66 code.ExtractIcDataArraysAtCalls(&computation_ids, ic_data_objs); 66 code.ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs);
67 const Array& result = Array::Handle(Array::New(max_id + 1)); 67 const Array& result = Array::Handle(Array::New(max_id + 1));
68 for (intptr_t i = 0; i < computation_ids.length(); i++) { 68 for (intptr_t i = 0; i < deopt_ids.length(); i++) {
69 intptr_t result_index = computation_ids[i]; 69 intptr_t result_index = deopt_ids[i];
70 ASSERT(result.At(result_index) == Object::null()); 70 ASSERT(result.At(result_index) == Object::null());
71 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i))); 71 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i)));
72 } 72 }
73 return result.raw(); 73 return result.raw();
74 } 74 }
75 75
76 76
77 RawError* Compiler::Compile(const Library& library, const Script& script) { 77 RawError* Compiler::Compile(const Library& library, const Script& script) {
78 Isolate* isolate = Isolate::Current(); 78 Isolate* isolate = Isolate::Current();
79 LongJump* base = isolate->long_jump_base(); 79 LongJump* base = isolate->long_jump_base();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 124
125 // Return false if bailed out. 125 // Return false if bailed out.
126 static bool CompileParsedFunctionHelper( 126 static bool CompileParsedFunctionHelper(
127 const ParsedFunction& parsed_function, bool optimized, bool use_ssa) { 127 const ParsedFunction& parsed_function, bool optimized, bool use_ssa) {
128 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); 128 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer);
129 bool is_compiled = false; 129 bool is_compiled = false;
130 Isolate* isolate = Isolate::Current(); 130 Isolate* isolate = Isolate::Current();
131 ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null. 131 ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null.
132 const intptr_t prev_cid = isolate->computation_id(); 132 const intptr_t prev_deopt_id = isolate->deopt_id();
133 isolate->set_computation_id(0); 133 isolate->set_deopt_id(0);
134 LongJump* old_base = isolate->long_jump_base(); 134 LongJump* old_base = isolate->long_jump_base();
135 LongJump bailout_jump; 135 LongJump bailout_jump;
136 isolate->set_long_jump_base(&bailout_jump); 136 isolate->set_long_jump_base(&bailout_jump);
137 if (setjmp(*bailout_jump.Set()) == 0) { 137 if (setjmp(*bailout_jump.Set()) == 0) {
138 GrowableArray<BlockEntryInstr*> block_order; 138 GrowableArray<BlockEntryInstr*> block_order;
139 // TimerScope needs an isolate to be properly terminated in case of a 139 // TimerScope needs an isolate to be properly terminated in case of a
140 // LongJump. 140 // LongJump.
141 { 141 {
142 TimerScope timer(FLAG_compiler_stats, 142 TimerScope timer(FLAG_compiler_stats,
143 &CompilerStats::graphbuilder_timer, 143 &CompilerStats::graphbuilder_timer,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (FLAG_trace_bailout) { 243 if (FLAG_trace_bailout) {
244 OS::Print("%s\n", bailout_error.ToErrorCString()); 244 OS::Print("%s\n", bailout_error.ToErrorCString());
245 } 245 }
246 // We only bail out from generating ssa code. 246 // We only bail out from generating ssa code.
247 ASSERT(optimized && use_ssa); 247 ASSERT(optimized && use_ssa);
248 is_compiled = false; 248 is_compiled = false;
249 } 249 }
250 // Reset global isolate state. 250 // Reset global isolate state.
251 isolate->set_ic_data_array(Array::null()); 251 isolate->set_ic_data_array(Array::null());
252 isolate->set_long_jump_base(old_base); 252 isolate->set_long_jump_base(old_base);
253 isolate->set_computation_id(prev_cid); 253 isolate->set_deopt_id(prev_deopt_id);
254 return is_compiled; 254 return is_compiled;
255 } 255 }
256 256
257 257
258 static RawError* CompileFunctionHelper(const Function& function, 258 static RawError* CompileFunctionHelper(const Function& function,
259 bool optimized) { 259 bool optimized) {
260 Isolate* isolate = Isolate::Current(); 260 Isolate* isolate = Isolate::Current();
261 LongJump* base = isolate->long_jump_base(); 261 LongJump* base = isolate->long_jump_base();
262 LongJump jump; 262 LongJump jump;
263 isolate->set_long_jump_base(&jump); 263 isolate->set_long_jump_base(&jump);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 isolate->object_store()->clear_sticky_error(); 485 isolate->object_store()->clear_sticky_error();
486 isolate->set_long_jump_base(base); 486 isolate->set_long_jump_base(base);
487 return result.raw(); 487 return result.raw();
488 } 488 }
489 UNREACHABLE(); 489 UNREACHABLE();
490 return Object::null(); 490 return Object::null();
491 } 491 }
492 492
493 493
494 } // namespace dart 494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698