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

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

Issue 10796004: Consolidate a few fields in RawFunction using bitfields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 402
403 403
404 RawError* Compiler::CompileAllFunctions(const Class& cls) { 404 RawError* Compiler::CompileAllFunctions(const Class& cls) {
405 Error& error = Error::Handle(); 405 Error& error = Error::Handle();
406 Array& functions = Array::Handle(cls.functions()); 406 Array& functions = Array::Handle(cls.functions());
407 Function& func = Function::Handle(); 407 Function& func = Function::Handle();
408 for (int i = 0; i < functions.Length(); i++) { 408 for (int i = 0; i < functions.Length(); i++) {
409 func ^= functions.At(i); 409 func ^= functions.At(i);
410 ASSERT(!func.IsNull()); 410 ASSERT(!func.IsNull());
411 if (!func.HasCode() && !func.IsAbstract()) { 411 if (!func.HasCode() && !func.is_abstract()) {
412 error = CompileFunction(func); 412 error = CompileFunction(func);
413 if (!error.IsNull()) { 413 if (!error.IsNull()) {
414 return error.raw(); 414 return error.raw();
415 } 415 }
416 } 416 }
417 } 417 }
418 return error.raw(); 418 return error.raw();
419 } 419 }
420 420
421 421
422 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { 422 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
423 Isolate* isolate = Isolate::Current(); 423 Isolate* isolate = Isolate::Current();
424 LongJump* base = isolate->long_jump_base(); 424 LongJump* base = isolate->long_jump_base();
425 LongJump jump; 425 LongJump jump;
426 isolate->set_long_jump_base(&jump); 426 isolate->set_long_jump_base(&jump);
427 if (setjmp(*jump.Set()) == 0) { 427 if (setjmp(*jump.Set()) == 0) {
428 if (FLAG_trace_compiler) { 428 if (FLAG_trace_compiler) {
429 OS::Print("compiling expression: "); 429 OS::Print("compiling expression: ");
430 AstPrinter::PrintNode(fragment); 430 AstPrinter::PrintNode(fragment);
431 } 431 }
432 432
433 // Create a dummy function object for the code generator. 433 // Create a dummy function object for the code generator.
434 const char* kEvalConst = "eval_const"; 434 const char* kEvalConst = "eval_const";
435 const Function& func = Function::Handle(Function::New( 435 const Function& func = Function::Handle(Function::New(
436 String::Handle(String::NewSymbol(kEvalConst)), 436 String::Handle(String::NewSymbol(kEvalConst)),
437 RawFunction::kConstImplicitGetter, 437 RawFunction::kConstImplicitGetter,
438 true, // static function. 438 true, // static function.
439 false, // not const function. 439 false, // not const function.
440 false, // not abstract
440 fragment->token_pos())); 441 fragment->token_pos()));
441 442
442 func.set_result_type(Type::Handle(Type::DynamicType())); 443 func.set_result_type(Type::Handle(Type::DynamicType()));
443 func.set_num_fixed_parameters(0); 444 func.set_num_fixed_parameters(0);
444 func.set_num_optional_parameters(0); 445 func.set_num_optional_parameters(0);
445 446
446 // The function needs to be associated with a named Class: the interface 447 // The function needs to be associated with a named Class: the interface
447 // Function fits the bill. 448 // Function fits the bill.
448 func.set_owner(Class::Handle( 449 func.set_owner(Class::Handle(
449 Type::Handle(Type::FunctionInterface()).type_class())); 450 Type::Handle(Type::FunctionInterface()).type_class()));
(...skipping 26 matching lines...) Expand all
476 isolate->object_store()->clear_sticky_error(); 477 isolate->object_store()->clear_sticky_error();
477 isolate->set_long_jump_base(base); 478 isolate->set_long_jump_base(base);
478 return result.raw(); 479 return result.raw();
479 } 480 }
480 UNREACHABLE(); 481 UNREACHABLE();
481 return Object::null(); 482 return Object::null();
482 } 483 }
483 484
484 485
485 } // namespace dart 486 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698