| 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/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/scopeinfo.h" | 10 #include "src/scopeinfo.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); | 460 DCHECK(0 <= var && var < StrongModeFreeVariableCount()); |
| 461 int info_index = StrongModeFreeVariablePositionEntriesIndex() + var * 2 + 1; | 461 int info_index = StrongModeFreeVariablePositionEntriesIndex() + var * 2 + 1; |
| 462 int32_t value = 0; | 462 int32_t value = 0; |
| 463 bool ok = get(info_index)->ToInt32(&value); | 463 bool ok = get(info_index)->ToInt32(&value); |
| 464 USE(ok); | 464 USE(ok); |
| 465 DCHECK(ok); | 465 DCHECK(ok); |
| 466 return value; | 466 return value; |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 int ScopeInfo::StackSlotIndex(String* name) { | 470 int ScopeInfo::StackLocalSlotIndex(String* name) { |
| 471 DCHECK(name->IsInternalizedString()); | 471 DCHECK(name->IsInternalizedString()); |
| 472 if (length() > 0) { | 472 if (length() > 0) { |
| 473 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 473 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); |
| 474 int start = StackLocalEntriesIndex(); | 474 int start = StackLocalEntriesIndex() + first_slot_index; |
| 475 int end = StackLocalEntriesIndex() + StackLocalCount(); | 475 int end = StackLocalEntriesIndex() + StackLocalCount(); |
| 476 for (int i = start; i < end; ++i) { | 476 for (int i = start; i < end; ++i) { |
| 477 if (name == get(i)) { | 477 if (name == get(i)) { |
| 478 return i - start + first_slot_index; | 478 return i - start + first_slot_index; |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 return -1; | 482 return -1; |
| 483 } | 483 } |
| 484 | 484 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 info->set_mode(i, var->mode()); | 782 info->set_mode(i, var->mode()); |
| 783 DCHECK(var->index() >= 0); | 783 DCHECK(var->index() >= 0); |
| 784 info->set_index(i, var->index()); | 784 info->set_index(i, var->index()); |
| 785 } | 785 } |
| 786 DCHECK(i == info->length()); | 786 DCHECK(i == info->length()); |
| 787 return info; | 787 return info; |
| 788 } | 788 } |
| 789 | 789 |
| 790 } // namespace internal | 790 } // namespace internal |
| 791 } // namespace v8 | 791 } // namespace v8 |
| OLD | NEW |