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/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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 isolate->set_long_jump_base(base); | 366 isolate->set_long_jump_base(base); |
367 return Error::null(); | 367 return Error::null(); |
368 } | 368 } |
369 if (setjmp(*jump.Set()) == 0) { | 369 if (setjmp(*jump.Set()) == 0) { |
370 TIMERSCOPE(time_compilation); | 370 TIMERSCOPE(time_compilation); |
371 ParsedFunction parsed_function(function); | 371 ParsedFunction parsed_function(function); |
372 if (FLAG_trace_compiler) { | 372 if (FLAG_trace_compiler) { |
373 OS::Print("Compiling %sfunction: '%s' @ token %d\n", | 373 OS::Print("Compiling %sfunction: '%s' @ token %d\n", |
374 (optimized ? "optimized " : ""), | 374 (optimized ? "optimized " : ""), |
375 function.ToFullyQualifiedCString(), | 375 function.ToFullyQualifiedCString(), |
376 function.token_index()); | 376 function.token_pos()); |
377 } | 377 } |
378 Parser::ParseFunction(&parsed_function); | 378 Parser::ParseFunction(&parsed_function); |
379 parsed_function.AllocateVariables(); | 379 parsed_function.AllocateVariables(); |
380 | 380 |
381 CompileParsedFunctionHelper(parsed_function, optimized); | 381 CompileParsedFunctionHelper(parsed_function, optimized); |
382 | 382 |
383 if (FLAG_trace_compiler) { | 383 if (FLAG_trace_compiler) { |
384 OS::Print("--> '%s' entry: 0x%x\n", | 384 OS::Print("--> '%s' entry: 0x%x\n", |
385 function.ToFullyQualifiedCString(), | 385 function.ToFullyQualifiedCString(), |
386 Code::Handle(function.CurrentCode()).EntryPoint()); | 386 Code::Handle(function.CurrentCode()).EntryPoint()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 AstPrinter::PrintNode(fragment); | 534 AstPrinter::PrintNode(fragment); |
535 } | 535 } |
536 | 536 |
537 // Create a dummy function object for the code generator. | 537 // Create a dummy function object for the code generator. |
538 const char* kEvalConst = "eval_const"; | 538 const char* kEvalConst = "eval_const"; |
539 const Function& func = Function::Handle(Function::New( | 539 const Function& func = Function::Handle(Function::New( |
540 String::Handle(String::NewSymbol(kEvalConst)), | 540 String::Handle(String::NewSymbol(kEvalConst)), |
541 RawFunction::kConstImplicitGetter, | 541 RawFunction::kConstImplicitGetter, |
542 true, // static function. | 542 true, // static function. |
543 false, // not const function. | 543 false, // not const function. |
544 fragment->token_index())); | 544 fragment->token_pos())); |
545 | 545 |
546 func.set_result_type(Type::Handle(Type::DynamicType())); | 546 func.set_result_type(Type::Handle(Type::DynamicType())); |
547 func.set_num_fixed_parameters(0); | 547 func.set_num_fixed_parameters(0); |
548 func.set_num_optional_parameters(0); | 548 func.set_num_optional_parameters(0); |
549 | 549 |
550 // The function needs to be associated with a named Class: the interface | 550 // The function needs to be associated with a named Class: the interface |
551 // Function fits the bill. | 551 // Function fits the bill. |
552 func.set_owner(Class::Handle( | 552 func.set_owner(Class::Handle( |
553 Type::Handle(Type::FunctionInterface()).type_class())); | 553 Type::Handle(Type::FunctionInterface()).type_class())); |
554 | 554 |
(...skipping 24 matching lines...) Expand all Loading... |
579 isolate->object_store()->clear_sticky_error(); | 579 isolate->object_store()->clear_sticky_error(); |
580 isolate->set_long_jump_base(base); | 580 isolate->set_long_jump_base(base); |
581 return result.raw(); | 581 return result.raw(); |
582 } | 582 } |
583 UNREACHABLE(); | 583 UNREACHABLE(); |
584 return Object::null(); | 584 return Object::null(); |
585 } | 585 } |
586 | 586 |
587 | 587 |
588 } // namespace dart | 588 } // namespace dart |
OLD | NEW |