OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 if (old_entry != NULL) { | 462 if (old_entry != NULL) { |
463 old_entry->name = entry->name; | 463 old_entry->name = entry->name; |
464 old_entry->method = entry->method; | 464 old_entry->method = entry->method; |
465 } | 465 } |
466 entry->name = new_entry.name; | 466 entry->name = new_entry.name; |
467 entry->method = new_entry.method; | 467 entry->method = new_entry.method; |
468 return true; | 468 return true; |
469 } | 469 } |
470 | 470 |
471 | 471 |
| 472 static inline void RecordPositions(CodeGenerator* cgen, int pos) { |
| 473 if (pos != RelocInfo::kNoPosition) { |
| 474 cgen->masm()->RecordStatementPosition(pos); |
| 475 cgen->masm()->RecordPosition(pos); |
| 476 } |
| 477 } |
| 478 |
| 479 |
472 void CodeGenerator::CodeForFunctionPosition(FunctionLiteral* fun) { | 480 void CodeGenerator::CodeForFunctionPosition(FunctionLiteral* fun) { |
473 if (FLAG_debug_info) { | 481 if (FLAG_debug_info) RecordPositions(this, fun->start_position()); |
474 int pos = fun->start_position(); | |
475 if (pos != RelocInfo::kNoPosition) { | |
476 masm()->RecordStatementPosition(pos); | |
477 masm()->RecordPosition(pos); | |
478 } | |
479 } | |
480 } | 482 } |
481 | 483 |
482 | 484 |
483 void CodeGenerator::CodeForReturnPosition(FunctionLiteral* fun) { | 485 void CodeGenerator::CodeForReturnPosition(FunctionLiteral* fun) { |
484 if (FLAG_debug_info) { | 486 if (FLAG_debug_info) RecordPositions(this, fun->end_position()); |
485 int pos = fun->end_position(); | |
486 if (pos != RelocInfo::kNoPosition) { | |
487 masm()->RecordStatementPosition(pos); | |
488 masm()->RecordPosition(pos); | |
489 } | |
490 } | |
491 } | 487 } |
492 | 488 |
493 | 489 |
494 void CodeGenerator::CodeForStatementPosition(AstNode* node) { | 490 void CodeGenerator::CodeForStatementPosition(Statement* stmt) { |
495 if (FLAG_debug_info) { | 491 if (FLAG_debug_info) RecordPositions(this, stmt->statement_pos()); |
496 int pos = node->statement_pos(); | |
497 if (pos != RelocInfo::kNoPosition) { | |
498 masm()->RecordStatementPosition(pos); | |
499 masm()->RecordPosition(pos); | |
500 } | |
501 } | |
502 } | 492 } |
503 | 493 |
504 | 494 |
505 void CodeGenerator::CodeForSourcePosition(int pos) { | 495 void CodeGenerator::CodeForSourcePosition(int pos) { |
506 if (FLAG_debug_info) { | 496 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) { |
507 if (pos != RelocInfo::kNoPosition) { | 497 masm()->RecordPosition(pos); |
508 masm()->RecordPosition(pos); | |
509 } | |
510 } | 498 } |
511 } | 499 } |
512 | 500 |
513 | 501 |
514 const char* RuntimeStub::GetName() { | 502 const char* RuntimeStub::GetName() { |
515 return Runtime::FunctionForId(id_)->stub_name; | 503 return Runtime::FunctionForId(id_)->stub_name; |
516 } | 504 } |
517 | 505 |
518 | 506 |
519 void RuntimeStub::Generate(MacroAssembler* masm) { | 507 void RuntimeStub::Generate(MacroAssembler* masm) { |
520 Runtime::Function* f = Runtime::FunctionForId(id_); | 508 Runtime::Function* f = Runtime::FunctionForId(id_); |
521 masm->TailCallRuntime(ExternalReference(f), | 509 masm->TailCallRuntime(ExternalReference(f), |
522 num_arguments_, | 510 num_arguments_, |
523 f->result_size); | 511 f->result_size); |
524 } | 512 } |
525 | 513 |
526 | 514 |
527 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 515 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
528 switch (type_) { | 516 switch (type_) { |
529 case READ_LENGTH: GenerateReadLength(masm); break; | 517 case READ_LENGTH: GenerateReadLength(masm); break; |
530 case READ_ELEMENT: GenerateReadElement(masm); break; | 518 case READ_ELEMENT: GenerateReadElement(masm); break; |
531 case NEW_OBJECT: GenerateNewObject(masm); break; | 519 case NEW_OBJECT: GenerateNewObject(masm); break; |
532 } | 520 } |
533 } | 521 } |
534 | 522 |
535 | 523 |
536 } } // namespace v8::internal | 524 } } // namespace v8::internal |
OLD | NEW |