OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 int ScopeInfo<Allocator>::StackSlotIndex(Code* code, String* name) { | 411 int ScopeInfo<Allocator>::StackSlotIndex(Code* code, String* name) { |
412 ASSERT(name->IsSymbol()); | 412 ASSERT(name->IsSymbol()); |
413 if (code->sinfo_size() > 0) { | 413 if (code->sinfo_size() > 0) { |
414 // Loop below depends on the NULL sentinel after the stack slot names. | 414 // Loop below depends on the NULL sentinel after the stack slot names. |
415 ASSERT(NumberOfStackSlots(code) > 0 || | 415 ASSERT(NumberOfStackSlots(code) > 0 || |
416 *(StackSlotEntriesAddr(code) + 1) == NULL); | 416 *(StackSlotEntriesAddr(code) + 1) == NULL); |
417 // slots start after length entry | 417 // slots start after length entry |
418 Object** p0 = StackSlotEntriesAddr(code) + 1; | 418 Object** p0 = StackSlotEntriesAddr(code) + 1; |
419 Object** p = p0; | 419 Object** p = p0; |
420 while (*p != NULL) { | 420 while (*p != NULL) { |
421 if (*p == name) return p - p0; | 421 if (*p == name) return static_cast<int>(p - p0); |
422 p++; | 422 p++; |
423 } | 423 } |
424 } | 424 } |
425 return -1; | 425 return -1; |
426 } | 426 } |
427 | 427 |
428 | 428 |
429 template<class Allocator> | 429 template<class Allocator> |
430 int ScopeInfo<Allocator>::ContextSlotIndex(Code* code, | 430 int ScopeInfo<Allocator>::ContextSlotIndex(Code* code, |
431 String* name, | 431 String* name, |
(...skipping 10 matching lines...) Expand all Loading... |
442 Object** p0 = ContextEntriesAddr(code) + 1; | 442 Object** p0 = ContextEntriesAddr(code) + 1; |
443 Object** p = p0; | 443 Object** p = p0; |
444 // contexts may have no variable slots (in the presence of eval()). | 444 // contexts may have no variable slots (in the presence of eval()). |
445 while (*p != NULL) { | 445 while (*p != NULL) { |
446 if (*p == name) { | 446 if (*p == name) { |
447 ASSERT(((p - p0) & 1) == 0); | 447 ASSERT(((p - p0) & 1) == 0); |
448 int v; | 448 int v; |
449 ReadInt(p + 1, &v); | 449 ReadInt(p + 1, &v); |
450 Variable::Mode mode_value = static_cast<Variable::Mode>(v); | 450 Variable::Mode mode_value = static_cast<Variable::Mode>(v); |
451 if (mode != NULL) *mode = mode_value; | 451 if (mode != NULL) *mode = mode_value; |
452 result = ((p - p0) >> 1) + Context::MIN_CONTEXT_SLOTS; | 452 result = static_cast<int>((p - p0) >> 1) + Context::MIN_CONTEXT_SLOTS; |
453 ContextSlotCache::Update(code, name, mode_value, result); | 453 ContextSlotCache::Update(code, name, mode_value, result); |
454 return result; | 454 return result; |
455 } | 455 } |
456 p += 2; | 456 p += 2; |
457 } | 457 } |
458 } | 458 } |
459 ContextSlotCache::Update(code, name, Variable::INTERNAL, -1); | 459 ContextSlotCache::Update(code, name, Variable::INTERNAL, -1); |
460 return -1; | 460 return -1; |
461 } | 461 } |
462 | 462 |
(...skipping 11 matching lines...) Expand all Loading... |
474 // Eventually, we should only register such parameters | 474 // Eventually, we should only register such parameters |
475 // once, with corresponding index. This requires a new | 475 // once, with corresponding index. This requires a new |
476 // implementation of the ScopeInfo code. See also other | 476 // implementation of the ScopeInfo code. See also other |
477 // comments in this file regarding this. | 477 // comments in this file regarding this. |
478 Object** p = ParameterEntriesAddr(code); | 478 Object** p = ParameterEntriesAddr(code); |
479 int n; // number of parameters | 479 int n; // number of parameters |
480 Object** p0 = ReadInt(p, &n); | 480 Object** p0 = ReadInt(p, &n); |
481 p = p0 + n; | 481 p = p0 + n; |
482 while (p > p0) { | 482 while (p > p0) { |
483 p--; | 483 p--; |
484 if (*p == name) return p - p0; | 484 if (*p == name) return static_cast<int>(p - p0); |
485 } | 485 } |
486 } | 486 } |
487 return -1; | 487 return -1; |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 template<class Allocator> | 491 template<class Allocator> |
492 int ScopeInfo<Allocator>::FunctionContextSlotIndex(Code* code, String* name) { | 492 int ScopeInfo<Allocator>::FunctionContextSlotIndex(Code* code, String* name) { |
493 ASSERT(name->IsSymbol()); | 493 ASSERT(name->IsSymbol()); |
494 if (code->sinfo_size() > 0) { | 494 if (code->sinfo_size() > 0) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 640 } |
641 #endif // DEBUG | 641 #endif // DEBUG |
642 | 642 |
643 | 643 |
644 // Make sure the classes get instantiated by the template system. | 644 // Make sure the classes get instantiated by the template system. |
645 template class ScopeInfo<FreeStoreAllocationPolicy>; | 645 template class ScopeInfo<FreeStoreAllocationPolicy>; |
646 template class ScopeInfo<PreallocatedStorage>; | 646 template class ScopeInfo<PreallocatedStorage>; |
647 template class ScopeInfo<ZoneListAllocationPolicy>; | 647 template class ScopeInfo<ZoneListAllocationPolicy>; |
648 | 648 |
649 } } // namespace v8::internal | 649 } } // namespace v8::internal |
OLD | NEW |