| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "src/objects/scope-info.h" | 7 #include "src/objects/scope-info.h" |
| 8 | 8 |
| 9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 389 |
| 390 DCHECK_EQ(index, scope_info->FunctionNameInfoIndex()); | 390 DCHECK_EQ(index, scope_info->FunctionNameInfoIndex()); |
| 391 DCHECK_EQ(index, scope_info->OuterScopeInfoIndex()); | 391 DCHECK_EQ(index, scope_info->OuterScopeInfoIndex()); |
| 392 DCHECK_EQ(index, scope_info->length()); | 392 DCHECK_EQ(index, scope_info->length()); |
| 393 DCHECK_EQ(scope_info->ParameterCount(), 0); | 393 DCHECK_EQ(scope_info->ParameterCount(), 0); |
| 394 DCHECK_EQ(scope_info->ContextLength(), Context::MIN_CONTEXT_SLOTS + 1); | 394 DCHECK_EQ(scope_info->ContextLength(), Context::MIN_CONTEXT_SLOTS + 1); |
| 395 | 395 |
| 396 return scope_info; | 396 return scope_info; |
| 397 } | 397 } |
| 398 | 398 |
| 399 | |
| 400 ScopeInfo* ScopeInfo::Empty(Isolate* isolate) { | 399 ScopeInfo* ScopeInfo::Empty(Isolate* isolate) { |
| 401 return isolate->heap()->empty_scope_info(); | 400 return isolate->heap()->empty_scope_info(); |
| 402 } | 401 } |
| 403 | 402 |
| 404 | |
| 405 ScopeType ScopeInfo::scope_type() { | 403 ScopeType ScopeInfo::scope_type() { |
| 406 DCHECK_LT(0, length()); | 404 DCHECK_LT(0, length()); |
| 407 return ScopeTypeField::decode(Flags()); | 405 return ScopeTypeField::decode(Flags()); |
| 408 } | 406 } |
| 409 | 407 |
| 410 | |
| 411 bool ScopeInfo::CallsEval() { | 408 bool ScopeInfo::CallsEval() { |
| 412 return length() > 0 && CallsEvalField::decode(Flags()); | 409 return length() > 0 && CallsEvalField::decode(Flags()); |
| 413 } | 410 } |
| 414 | 411 |
| 415 | |
| 416 LanguageMode ScopeInfo::language_mode() { | 412 LanguageMode ScopeInfo::language_mode() { |
| 417 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY; | 413 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY; |
| 418 } | 414 } |
| 419 | 415 |
| 420 | |
| 421 bool ScopeInfo::is_declaration_scope() { | 416 bool ScopeInfo::is_declaration_scope() { |
| 422 return DeclarationScopeField::decode(Flags()); | 417 return DeclarationScopeField::decode(Flags()); |
| 423 } | 418 } |
| 424 | 419 |
| 425 | 420 int ScopeInfo::LocalCount() { return StackLocalCount() + ContextLocalCount(); } |
| 426 int ScopeInfo::LocalCount() { | |
| 427 return StackLocalCount() + ContextLocalCount(); | |
| 428 } | |
| 429 | |
| 430 | 421 |
| 431 int ScopeInfo::StackSlotCount() { | 422 int ScopeInfo::StackSlotCount() { |
| 432 if (length() > 0) { | 423 if (length() > 0) { |
| 433 bool function_name_stack_slot = | 424 bool function_name_stack_slot = |
| 434 FunctionVariableField::decode(Flags()) == STACK; | 425 FunctionVariableField::decode(Flags()) == STACK; |
| 435 return StackLocalCount() + (function_name_stack_slot ? 1 : 0); | 426 return StackLocalCount() + (function_name_stack_slot ? 1 : 0); |
| 436 } | 427 } |
| 437 return 0; | 428 return 0; |
| 438 } | 429 } |
| 439 | 430 |
| 440 | |
| 441 int ScopeInfo::ContextLength() { | 431 int ScopeInfo::ContextLength() { |
| 442 if (length() > 0) { | 432 if (length() > 0) { |
| 443 int context_locals = ContextLocalCount(); | 433 int context_locals = ContextLocalCount(); |
| 444 bool function_name_context_slot = | 434 bool function_name_context_slot = |
| 445 FunctionVariableField::decode(Flags()) == CONTEXT; | 435 FunctionVariableField::decode(Flags()) == CONTEXT; |
| 446 bool has_context = context_locals > 0 || function_name_context_slot || | 436 bool has_context = context_locals > 0 || function_name_context_slot || |
| 447 scope_type() == WITH_SCOPE || | 437 scope_type() == WITH_SCOPE || |
| 448 (scope_type() == BLOCK_SCOPE && CallsSloppyEval() && | 438 (scope_type() == BLOCK_SCOPE && CallsSloppyEval() && |
| 449 is_declaration_scope()) || | 439 is_declaration_scope()) || |
| 450 (scope_type() == FUNCTION_SCOPE && CallsSloppyEval()) || | 440 (scope_type() == FUNCTION_SCOPE && CallsSloppyEval()) || |
| 451 (scope_type() == FUNCTION_SCOPE && IsAsmModule()) || | 441 (scope_type() == FUNCTION_SCOPE && IsAsmModule()) || |
| 452 scope_type() == MODULE_SCOPE; | 442 scope_type() == MODULE_SCOPE; |
| 453 | 443 |
| 454 if (has_context) { | 444 if (has_context) { |
| 455 return Context::MIN_CONTEXT_SLOTS + context_locals + | 445 return Context::MIN_CONTEXT_SLOTS + context_locals + |
| 456 (function_name_context_slot ? 1 : 0); | 446 (function_name_context_slot ? 1 : 0); |
| 457 } | 447 } |
| 458 } | 448 } |
| 459 return 0; | 449 return 0; |
| 460 } | 450 } |
| 461 | 451 |
| 462 | |
| 463 bool ScopeInfo::HasReceiver() { | 452 bool ScopeInfo::HasReceiver() { |
| 464 if (length() > 0) { | 453 if (length() > 0) { |
| 465 return NONE != ReceiverVariableField::decode(Flags()); | 454 return NONE != ReceiverVariableField::decode(Flags()); |
| 466 } else { | 455 } else { |
| 467 return false; | 456 return false; |
| 468 } | 457 } |
| 469 } | 458 } |
| 470 | 459 |
| 471 | |
| 472 bool ScopeInfo::HasAllocatedReceiver() { | 460 bool ScopeInfo::HasAllocatedReceiver() { |
| 473 if (length() > 0) { | 461 if (length() > 0) { |
| 474 VariableAllocationInfo allocation = ReceiverVariableField::decode(Flags()); | 462 VariableAllocationInfo allocation = ReceiverVariableField::decode(Flags()); |
| 475 return allocation == STACK || allocation == CONTEXT; | 463 return allocation == STACK || allocation == CONTEXT; |
| 476 } else { | 464 } else { |
| 477 return false; | 465 return false; |
| 478 } | 466 } |
| 479 } | 467 } |
| 480 | 468 |
| 481 | |
| 482 bool ScopeInfo::HasNewTarget() { return HasNewTargetField::decode(Flags()); } | 469 bool ScopeInfo::HasNewTarget() { return HasNewTargetField::decode(Flags()); } |
| 483 | 470 |
| 484 | |
| 485 bool ScopeInfo::HasFunctionName() { | 471 bool ScopeInfo::HasFunctionName() { |
| 486 if (length() > 0) { | 472 if (length() > 0) { |
| 487 return NONE != FunctionVariableField::decode(Flags()); | 473 return NONE != FunctionVariableField::decode(Flags()); |
| 488 } else { | 474 } else { |
| 489 return false; | 475 return false; |
| 490 } | 476 } |
| 491 } | 477 } |
| 492 | 478 |
| 493 bool ScopeInfo::HasOuterScopeInfo() { | 479 bool ScopeInfo::HasOuterScopeInfo() { |
| 494 if (length() > 0) { | 480 if (length() > 0) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 516 } | 502 } |
| 517 | 503 |
| 518 bool ScopeInfo::HasHeapAllocatedLocals() { | 504 bool ScopeInfo::HasHeapAllocatedLocals() { |
| 519 if (length() > 0) { | 505 if (length() > 0) { |
| 520 return ContextLocalCount() > 0; | 506 return ContextLocalCount() > 0; |
| 521 } else { | 507 } else { |
| 522 return false; | 508 return false; |
| 523 } | 509 } |
| 524 } | 510 } |
| 525 | 511 |
| 526 | 512 bool ScopeInfo::HasContext() { return ContextLength() > 0; } |
| 527 bool ScopeInfo::HasContext() { | |
| 528 return ContextLength() > 0; | |
| 529 } | |
| 530 | |
| 531 | 513 |
| 532 String* ScopeInfo::FunctionName() { | 514 String* ScopeInfo::FunctionName() { |
| 533 DCHECK(HasFunctionName()); | 515 DCHECK(HasFunctionName()); |
| 534 return String::cast(get(FunctionNameInfoIndex())); | 516 return String::cast(get(FunctionNameInfoIndex())); |
| 535 } | 517 } |
| 536 | 518 |
| 537 ScopeInfo* ScopeInfo::OuterScopeInfo() { | 519 ScopeInfo* ScopeInfo::OuterScopeInfo() { |
| 538 DCHECK(HasOuterScopeInfo()); | 520 DCHECK(HasOuterScopeInfo()); |
| 539 return ScopeInfo::cast(get(OuterScopeInfoIndex())); | 521 return ScopeInfo::cast(get(OuterScopeInfoIndex())); |
| 540 } | 522 } |
| 541 | 523 |
| 542 ModuleInfo* ScopeInfo::ModuleDescriptorInfo() { | 524 ModuleInfo* ScopeInfo::ModuleDescriptorInfo() { |
| 543 DCHECK(scope_type() == MODULE_SCOPE); | 525 DCHECK(scope_type() == MODULE_SCOPE); |
| 544 return ModuleInfo::cast(get(ModuleInfoIndex())); | 526 return ModuleInfo::cast(get(ModuleInfoIndex())); |
| 545 } | 527 } |
| 546 | 528 |
| 547 String* ScopeInfo::ParameterName(int var) { | 529 String* ScopeInfo::ParameterName(int var) { |
| 548 DCHECK_LE(0, var); | 530 DCHECK_LE(0, var); |
| 549 DCHECK_LT(var, ParameterCount()); | 531 DCHECK_LT(var, ParameterCount()); |
| 550 int info_index = ParameterNamesIndex() + var; | 532 int info_index = ParameterNamesIndex() + var; |
| 551 return String::cast(get(info_index)); | 533 return String::cast(get(info_index)); |
| 552 } | 534 } |
| 553 | 535 |
| 554 | |
| 555 String* ScopeInfo::LocalName(int var) { | 536 String* ScopeInfo::LocalName(int var) { |
| 556 DCHECK_LE(0, var); | 537 DCHECK_LE(0, var); |
| 557 DCHECK_LT(var, LocalCount()); | 538 DCHECK_LT(var, LocalCount()); |
| 558 DCHECK(StackLocalNamesIndex() + StackLocalCount() == | 539 DCHECK(StackLocalNamesIndex() + StackLocalCount() == |
| 559 ContextLocalNamesIndex()); | 540 ContextLocalNamesIndex()); |
| 560 int info_index = StackLocalNamesIndex() + var; | 541 int info_index = StackLocalNamesIndex() + var; |
| 561 return String::cast(get(info_index)); | 542 return String::cast(get(info_index)); |
| 562 } | 543 } |
| 563 | 544 |
| 564 | |
| 565 String* ScopeInfo::StackLocalName(int var) { | 545 String* ScopeInfo::StackLocalName(int var) { |
| 566 DCHECK_LE(0, var); | 546 DCHECK_LE(0, var); |
| 567 DCHECK_LT(var, StackLocalCount()); | 547 DCHECK_LT(var, StackLocalCount()); |
| 568 int info_index = StackLocalNamesIndex() + var; | 548 int info_index = StackLocalNamesIndex() + var; |
| 569 return String::cast(get(info_index)); | 549 return String::cast(get(info_index)); |
| 570 } | 550 } |
| 571 | 551 |
| 572 | |
| 573 int ScopeInfo::StackLocalIndex(int var) { | 552 int ScopeInfo::StackLocalIndex(int var) { |
| 574 DCHECK_LE(0, var); | 553 DCHECK_LE(0, var); |
| 575 DCHECK_LT(var, StackLocalCount()); | 554 DCHECK_LT(var, StackLocalCount()); |
| 576 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 555 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); |
| 577 return first_slot_index + var; | 556 return first_slot_index + var; |
| 578 } | 557 } |
| 579 | 558 |
| 580 | |
| 581 String* ScopeInfo::ContextLocalName(int var) { | 559 String* ScopeInfo::ContextLocalName(int var) { |
| 582 DCHECK_LE(0, var); | 560 DCHECK_LE(0, var); |
| 583 DCHECK_LT(var, ContextLocalCount()); | 561 DCHECK_LT(var, ContextLocalCount()); |
| 584 int info_index = ContextLocalNamesIndex() + var; | 562 int info_index = ContextLocalNamesIndex() + var; |
| 585 return String::cast(get(info_index)); | 563 return String::cast(get(info_index)); |
| 586 } | 564 } |
| 587 | 565 |
| 588 | |
| 589 VariableMode ScopeInfo::ContextLocalMode(int var) { | 566 VariableMode ScopeInfo::ContextLocalMode(int var) { |
| 590 DCHECK_LE(0, var); | 567 DCHECK_LE(0, var); |
| 591 DCHECK_LT(var, ContextLocalCount()); | 568 DCHECK_LT(var, ContextLocalCount()); |
| 592 int info_index = ContextLocalInfosIndex() + var; | 569 int info_index = ContextLocalInfosIndex() + var; |
| 593 int value = Smi::cast(get(info_index))->value(); | 570 int value = Smi::cast(get(info_index))->value(); |
| 594 return VariableModeField::decode(value); | 571 return VariableModeField::decode(value); |
| 595 } | 572 } |
| 596 | 573 |
| 597 | |
| 598 InitializationFlag ScopeInfo::ContextLocalInitFlag(int var) { | 574 InitializationFlag ScopeInfo::ContextLocalInitFlag(int var) { |
| 599 DCHECK_LE(0, var); | 575 DCHECK_LE(0, var); |
| 600 DCHECK_LT(var, ContextLocalCount()); | 576 DCHECK_LT(var, ContextLocalCount()); |
| 601 int info_index = ContextLocalInfosIndex() + var; | 577 int info_index = ContextLocalInfosIndex() + var; |
| 602 int value = Smi::cast(get(info_index))->value(); | 578 int value = Smi::cast(get(info_index))->value(); |
| 603 return InitFlagField::decode(value); | 579 return InitFlagField::decode(value); |
| 604 } | 580 } |
| 605 | 581 |
| 606 | |
| 607 MaybeAssignedFlag ScopeInfo::ContextLocalMaybeAssignedFlag(int var) { | 582 MaybeAssignedFlag ScopeInfo::ContextLocalMaybeAssignedFlag(int var) { |
| 608 DCHECK_LE(0, var); | 583 DCHECK_LE(0, var); |
| 609 DCHECK_LT(var, ContextLocalCount()); | 584 DCHECK_LT(var, ContextLocalCount()); |
| 610 int info_index = ContextLocalInfosIndex() + var; | 585 int info_index = ContextLocalInfosIndex() + var; |
| 611 int value = Smi::cast(get(info_index))->value(); | 586 int value = Smi::cast(get(info_index))->value(); |
| 612 return MaybeAssignedFlagField::decode(value); | 587 return MaybeAssignedFlagField::decode(value); |
| 613 } | 588 } |
| 614 | 589 |
| 615 bool ScopeInfo::VariableIsSynthetic(String* name) { | 590 bool ScopeInfo::VariableIsSynthetic(String* name) { |
| 616 // There's currently no flag stored on the ScopeInfo to indicate that a | 591 // There's currently no flag stored on the ScopeInfo to indicate that a |
| 617 // variable is a compiler-introduced temporary. However, to avoid conflict | 592 // variable is a compiler-introduced temporary. However, to avoid conflict |
| 618 // with user declarations, the current temporaries like .generator_object and | 593 // with user declarations, the current temporaries like .generator_object and |
| 619 // .result start with a dot, so we can use that as a flag. It's a hack! | 594 // .result start with a dot, so we can use that as a flag. It's a hack! |
| 620 return name->length() == 0 || name->Get(0) == '.' || | 595 return name->length() == 0 || name->Get(0) == '.' || |
| 621 name->Equals(name->GetHeap()->this_string()); | 596 name->Equals(name->GetHeap()->this_string()); |
| 622 } | 597 } |
| 623 | 598 |
| 624 | |
| 625 int ScopeInfo::StackSlotIndex(String* name) { | 599 int ScopeInfo::StackSlotIndex(String* name) { |
| 626 DCHECK(name->IsInternalizedString()); | 600 DCHECK(name->IsInternalizedString()); |
| 627 if (length() > 0) { | 601 if (length() > 0) { |
| 628 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 602 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); |
| 629 int start = StackLocalNamesIndex(); | 603 int start = StackLocalNamesIndex(); |
| 630 int end = start + StackLocalCount(); | 604 int end = start + StackLocalCount(); |
| 631 for (int i = start; i < end; ++i) { | 605 for (int i = start; i < end; ++i) { |
| 632 if (name == get(i)) { | 606 if (name == get(i)) { |
| 633 return i - start + first_slot_index; | 607 return i - start + first_slot_index; |
| 634 } | 608 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 return -1; | 677 return -1; |
| 704 } | 678 } |
| 705 | 679 |
| 706 String* ScopeInfo::ContextSlotName(int slot_index) { | 680 String* ScopeInfo::ContextSlotName(int slot_index) { |
| 707 int const var = slot_index - Context::MIN_CONTEXT_SLOTS; | 681 int const var = slot_index - Context::MIN_CONTEXT_SLOTS; |
| 708 DCHECK_LE(0, var); | 682 DCHECK_LE(0, var); |
| 709 DCHECK_LT(var, ContextLocalCount()); | 683 DCHECK_LT(var, ContextLocalCount()); |
| 710 return ContextLocalName(var); | 684 return ContextLocalName(var); |
| 711 } | 685 } |
| 712 | 686 |
| 713 | |
| 714 int ScopeInfo::ParameterIndex(String* name) { | 687 int ScopeInfo::ParameterIndex(String* name) { |
| 715 DCHECK(name->IsInternalizedString()); | 688 DCHECK(name->IsInternalizedString()); |
| 716 if (length() > 0) { | 689 if (length() > 0) { |
| 717 // We must read parameters from the end since for | 690 // We must read parameters from the end since for |
| 718 // multiply declared parameters the value of the | 691 // multiply declared parameters the value of the |
| 719 // last declaration of that parameter is used | 692 // last declaration of that parameter is used |
| 720 // inside a function (and thus we need to look | 693 // inside a function (and thus we need to look |
| 721 // at the last index). Was bug# 1110337. | 694 // at the last index). Was bug# 1110337. |
| 722 int start = ParameterNamesIndex(); | 695 int start = ParameterNamesIndex(); |
| 723 int end = start + ParameterCount(); | 696 int end = start + ParameterCount(); |
| 724 for (int i = end - 1; i >= start; --i) { | 697 for (int i = end - 1; i >= start; --i) { |
| 725 if (name == get(i)) { | 698 if (name == get(i)) { |
| 726 return i - start; | 699 return i - start; |
| 727 } | 700 } |
| 728 } | 701 } |
| 729 } | 702 } |
| 730 return -1; | 703 return -1; |
| 731 } | 704 } |
| 732 | 705 |
| 733 | |
| 734 int ScopeInfo::ReceiverContextSlotIndex() { | 706 int ScopeInfo::ReceiverContextSlotIndex() { |
| 735 if (length() > 0 && ReceiverVariableField::decode(Flags()) == CONTEXT) | 707 if (length() > 0 && ReceiverVariableField::decode(Flags()) == CONTEXT) |
| 736 return Smi::cast(get(ReceiverInfoIndex()))->value(); | 708 return Smi::cast(get(ReceiverInfoIndex()))->value(); |
| 737 return -1; | 709 return -1; |
| 738 } | 710 } |
| 739 | 711 |
| 740 int ScopeInfo::FunctionContextSlotIndex(String* name) { | 712 int ScopeInfo::FunctionContextSlotIndex(String* name) { |
| 741 DCHECK(name->IsInternalizedString()); | 713 DCHECK(name->IsInternalizedString()); |
| 742 if (length() > 0) { | 714 if (length() > 0) { |
| 743 if (FunctionVariableField::decode(Flags()) == CONTEXT && | 715 if (FunctionVariableField::decode(Flags()) == CONTEXT && |
| 744 FunctionName() == name) { | 716 FunctionName() == name) { |
| 745 return Smi::cast(get(FunctionNameInfoIndex() + 1))->value(); | 717 return Smi::cast(get(FunctionNameInfoIndex() + 1))->value(); |
| 746 } | 718 } |
| 747 } | 719 } |
| 748 return -1; | 720 return -1; |
| 749 } | 721 } |
| 750 | 722 |
| 751 | |
| 752 FunctionKind ScopeInfo::function_kind() { | 723 FunctionKind ScopeInfo::function_kind() { |
| 753 return FunctionKindField::decode(Flags()); | 724 return FunctionKindField::decode(Flags()); |
| 754 } | 725 } |
| 755 | 726 |
| 756 int ScopeInfo::ParameterNamesIndex() { | 727 int ScopeInfo::ParameterNamesIndex() { |
| 757 DCHECK_LT(0, length()); | 728 DCHECK_LT(0, length()); |
| 758 return kVariablePartIndex; | 729 return kVariablePartIndex; |
| 759 } | 730 } |
| 760 | 731 |
| 761 | |
| 762 int ScopeInfo::StackLocalFirstSlotIndex() { | 732 int ScopeInfo::StackLocalFirstSlotIndex() { |
| 763 return ParameterNamesIndex() + ParameterCount(); | 733 return ParameterNamesIndex() + ParameterCount(); |
| 764 } | 734 } |
| 765 | 735 |
| 766 int ScopeInfo::StackLocalNamesIndex() { return StackLocalFirstSlotIndex() + 1; } | 736 int ScopeInfo::StackLocalNamesIndex() { return StackLocalFirstSlotIndex() + 1; } |
| 767 | 737 |
| 768 int ScopeInfo::ContextLocalNamesIndex() { | 738 int ScopeInfo::ContextLocalNamesIndex() { |
| 769 return StackLocalNamesIndex() + StackLocalCount(); | 739 return StackLocalNamesIndex() + StackLocalCount(); |
| 770 } | 740 } |
| 771 | 741 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 if (init_flag != nullptr) { | 787 if (init_flag != nullptr) { |
| 818 *init_flag = InitFlagField::decode(properties); | 788 *init_flag = InitFlagField::decode(properties); |
| 819 } | 789 } |
| 820 if (maybe_assigned_flag != nullptr) { | 790 if (maybe_assigned_flag != nullptr) { |
| 821 *maybe_assigned_flag = MaybeAssignedFlagField::decode(properties); | 791 *maybe_assigned_flag = MaybeAssignedFlagField::decode(properties); |
| 822 } | 792 } |
| 823 } | 793 } |
| 824 | 794 |
| 825 #ifdef DEBUG | 795 #ifdef DEBUG |
| 826 | 796 |
| 827 static void PrintList(const char* list_name, | 797 static void PrintList(const char* list_name, int nof_internal_slots, int start, |
| 828 int nof_internal_slots, | 798 int end, ScopeInfo* scope_info) { |
| 829 int start, | |
| 830 int end, | |
| 831 ScopeInfo* scope_info) { | |
| 832 if (start < end) { | 799 if (start < end) { |
| 833 PrintF("\n // %s\n", list_name); | 800 PrintF("\n // %s\n", list_name); |
| 834 if (nof_internal_slots > 0) { | 801 if (nof_internal_slots > 0) { |
| 835 PrintF(" %2d - %2d [internal slots]\n", 0 , nof_internal_slots - 1); | 802 PrintF(" %2d - %2d [internal slots]\n", 0, nof_internal_slots - 1); |
| 836 } | 803 } |
| 837 for (int i = nof_internal_slots; start < end; ++i, ++start) { | 804 for (int i = nof_internal_slots; start < end; ++i, ++start) { |
| 838 PrintF(" %2d ", i); | 805 PrintF(" %2d ", i); |
| 839 String::cast(scope_info->get(start))->ShortPrint(); | 806 String::cast(scope_info->get(start))->ShortPrint(); |
| 840 PrintF("\n"); | 807 PrintF("\n"); |
| 841 } | 808 } |
| 842 } | 809 } |
| 843 } | 810 } |
| 844 | 811 |
| 845 | |
| 846 void ScopeInfo::Print() { | 812 void ScopeInfo::Print() { |
| 847 PrintF("ScopeInfo "); | 813 PrintF("ScopeInfo "); |
| 848 if (HasFunctionName()) { | 814 if (HasFunctionName()) { |
| 849 FunctionName()->ShortPrint(); | 815 FunctionName()->ShortPrint(); |
| 850 } else { | 816 } else { |
| 851 PrintF("/* no function name */"); | 817 PrintF("/* no function name */"); |
| 852 } | 818 } |
| 853 PrintF("{"); | 819 PrintF("{"); |
| 854 | 820 |
| 855 if (length() > 0) { | 821 if (length() > 0) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 if (String::cast(entry->local_name())->Equals(*local_name)) { | 938 if (String::cast(entry->local_name())->Equals(*local_name)) { |
| 973 return entry; | 939 return entry; |
| 974 } | 940 } |
| 975 } | 941 } |
| 976 UNREACHABLE(); | 942 UNREACHABLE(); |
| 977 return Handle<ModuleInfoEntry>(); | 943 return Handle<ModuleInfoEntry>(); |
| 978 } | 944 } |
| 979 | 945 |
| 980 } // namespace internal | 946 } // namespace internal |
| 981 } // namespace v8 | 947 } // namespace v8 |
| OLD | NEW |