OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 uint32_t ExternalReferenceEncoder::Encode(Address key) const { | 554 uint32_t ExternalReferenceEncoder::Encode(Address key) const { |
555 int index = IndexOf(key); | 555 int index = IndexOf(key); |
556 ASSERT(key == NULL || index >= 0); | 556 ASSERT(key == NULL || index >= 0); |
557 return index >= 0 ? | 557 return index >= 0 ? |
558 ExternalReferenceTable::instance(isolate_)->code(index) : 0; | 558 ExternalReferenceTable::instance(isolate_)->code(index) : 0; |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 const char* ExternalReferenceEncoder::NameOfAddress(Address key) const { | 562 const char* ExternalReferenceEncoder::NameOfAddress(Address key) const { |
563 int index = IndexOf(key); | 563 int index = IndexOf(key); |
564 return index >= 0 ? | 564 return index >= 0 ? ExternalReferenceTable::instance(isolate_)->name(index) |
565 ExternalReferenceTable::instance(isolate_)->name(index) : NULL; | 565 : "<unknown>"; |
566 } | 566 } |
567 | 567 |
568 | 568 |
569 int ExternalReferenceEncoder::IndexOf(Address key) const { | 569 int ExternalReferenceEncoder::IndexOf(Address key) const { |
570 if (key == NULL) return -1; | 570 if (key == NULL) return -1; |
571 HashMap::Entry* entry = | 571 HashMap::Entry* entry = |
572 const_cast<HashMap&>(encodings_).Lookup(key, Hash(key), false); | 572 const_cast<HashMap&>(encodings_).Lookup(key, Hash(key), false); |
573 return entry == NULL | 573 return entry == NULL |
574 ? -1 | 574 ? -1 |
575 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 575 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 deserializer.set_reservation( | 1905 deserializer.set_reservation( |
1906 i, raw_data[CodeSerializer::kReservationsOffset + i]); | 1906 i, raw_data[CodeSerializer::kReservationsOffset + i]); |
1907 } | 1907 } |
1908 Object* root; | 1908 Object* root; |
1909 deserializer.DeserializePartial(isolate, &root); | 1909 deserializer.DeserializePartial(isolate, &root); |
1910 deserializer.FlushICacheForNewCodeObjects(); | 1910 deserializer.FlushICacheForNewCodeObjects(); |
1911 ASSERT(root->IsSharedFunctionInfo()); | 1911 ASSERT(root->IsSharedFunctionInfo()); |
1912 return root; | 1912 return root; |
1913 } | 1913 } |
1914 } } // namespace v8::internal | 1914 } } // namespace v8::internal |
OLD | NEW |