OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 void ContextSlotCache::Update(Object* data, | 441 void ContextSlotCache::Update(Object* data, |
442 String* name, | 442 String* name, |
443 VariableMode mode, | 443 VariableMode mode, |
444 InitializationFlag init_flag, | 444 InitializationFlag init_flag, |
445 int slot_index) { | 445 int slot_index) { |
446 String* internalized_name; | 446 String* internalized_name; |
447 ASSERT(slot_index > kNotFound); | 447 ASSERT(slot_index > kNotFound); |
448 if (HEAP->InternalizeStringIfExists(name, &internalized_name)) { | 448 if (name->GetIsolate()->heap()->InternalizeStringIfExists( |
| 449 name, &internalized_name)) { |
449 int index = Hash(data, internalized_name); | 450 int index = Hash(data, internalized_name); |
450 Key& key = keys_[index]; | 451 Key& key = keys_[index]; |
451 key.data = data; | 452 key.data = data; |
452 key.name = internalized_name; | 453 key.name = internalized_name; |
453 // Please note value only takes a uint as index. | 454 // Please note value only takes a uint as index. |
454 values_[index] = Value(mode, init_flag, slot_index - kNotFound).raw(); | 455 values_[index] = Value(mode, init_flag, slot_index - kNotFound).raw(); |
455 #ifdef DEBUG | 456 #ifdef DEBUG |
456 ValidateEntry(data, name, mode, init_flag, slot_index); | 457 ValidateEntry(data, name, mode, init_flag, slot_index); |
457 #endif | 458 #endif |
458 } | 459 } |
459 } | 460 } |
460 | 461 |
461 | 462 |
462 void ContextSlotCache::Clear() { | 463 void ContextSlotCache::Clear() { |
463 for (int index = 0; index < kLength; index++) keys_[index].data = NULL; | 464 for (int index = 0; index < kLength; index++) keys_[index].data = NULL; |
464 } | 465 } |
465 | 466 |
466 | 467 |
467 #ifdef DEBUG | 468 #ifdef DEBUG |
468 | 469 |
469 void ContextSlotCache::ValidateEntry(Object* data, | 470 void ContextSlotCache::ValidateEntry(Object* data, |
470 String* name, | 471 String* name, |
471 VariableMode mode, | 472 VariableMode mode, |
472 InitializationFlag init_flag, | 473 InitializationFlag init_flag, |
473 int slot_index) { | 474 int slot_index) { |
474 String* internalized_name; | 475 String* internalized_name; |
475 if (HEAP->InternalizeStringIfExists(name, &internalized_name)) { | 476 if (name->GetIsolate()->heap()->InternalizeStringIfExists( |
| 477 name, &internalized_name)) { |
476 int index = Hash(data, name); | 478 int index = Hash(data, name); |
477 Key& key = keys_[index]; | 479 Key& key = keys_[index]; |
478 ASSERT(key.data == data); | 480 ASSERT(key.data == data); |
479 ASSERT(key.name->Equals(name)); | 481 ASSERT(key.name->Equals(name)); |
480 Value result(values_[index]); | 482 Value result(values_[index]); |
481 ASSERT(result.mode() == mode); | 483 ASSERT(result.mode() == mode); |
482 ASSERT(result.initialization_flag() == init_flag); | 484 ASSERT(result.initialization_flag() == init_flag); |
483 ASSERT(result.index() + kNotFound == slot_index); | 485 ASSERT(result.index() + kNotFound == slot_index); |
484 } | 486 } |
485 } | 487 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 } else { | 555 } else { |
554 ASSERT(var->index() >= 0); | 556 ASSERT(var->index() >= 0); |
555 info->set_index(i, var->index()); | 557 info->set_index(i, var->index()); |
556 } | 558 } |
557 } | 559 } |
558 ASSERT(i == info->length()); | 560 ASSERT(i == info->length()); |
559 return info; | 561 return info; |
560 } | 562 } |
561 | 563 |
562 } } // namespace v8::internal | 564 } } // namespace v8::internal |
OLD | NEW |