| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "api.h" | 8 #include "api.h" |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 #undef IC_ENTRY | 178 #undef IC_ENTRY |
| 179 }; // end of ref_table[]. | 179 }; // end of ref_table[]. |
| 180 | 180 |
| 181 for (size_t i = 0; i < ARRAY_SIZE(ref_table); ++i) { | 181 for (size_t i = 0; i < ARRAY_SIZE(ref_table); ++i) { |
| 182 AddFromId(ref_table[i].type, | 182 AddFromId(ref_table[i].type, |
| 183 ref_table[i].id, | 183 ref_table[i].id, |
| 184 ref_table[i].name, | 184 ref_table[i].name, |
| 185 isolate); | 185 isolate); |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Debug addresses | |
| 189 Add(Debug_Address(Debug::k_after_break_target_address).address(isolate), | |
| 190 DEBUG_ADDRESS, | |
| 191 Debug::k_after_break_target_address << kDebugIdShift, | |
| 192 "Debug::after_break_target_address()"); | |
| 193 Add(Debug_Address(Debug::k_restarter_frame_function_pointer).address(isolate), | |
| 194 DEBUG_ADDRESS, | |
| 195 Debug::k_restarter_frame_function_pointer << kDebugIdShift, | |
| 196 "Debug::restarter_frame_function_pointer_address()"); | |
| 197 | |
| 198 // Stat counters | 188 // Stat counters |
| 199 struct StatsRefTableEntry { | 189 struct StatsRefTableEntry { |
| 200 StatsCounter* (Counters::*counter)(); | 190 StatsCounter* (Counters::*counter)(); |
| 201 uint16_t id; | 191 uint16_t id; |
| 202 const char* name; | 192 const char* name; |
| 203 }; | 193 }; |
| 204 | 194 |
| 205 const StatsRefTableEntry stats_ref_table[] = { | 195 const StatsRefTableEntry stats_ref_table[] = { |
| 206 #define COUNTER_ENTRY(name, caption) \ | 196 #define COUNTER_ENTRY(name, caption) \ |
| 207 { &Counters::name, \ | 197 { &Counters::name, \ |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 Add(ExternalReference::invoke_function_callback(isolate).address(), | 518 Add(ExternalReference::invoke_function_callback(isolate).address(), |
| 529 UNCLASSIFIED, | 519 UNCLASSIFIED, |
| 530 65, | 520 65, |
| 531 "InvokeFunctionCallback"); | 521 "InvokeFunctionCallback"); |
| 532 | 522 |
| 533 Add(ExternalReference::invoke_accessor_getter_callback(isolate).address(), | 523 Add(ExternalReference::invoke_accessor_getter_callback(isolate).address(), |
| 534 UNCLASSIFIED, | 524 UNCLASSIFIED, |
| 535 66, | 525 66, |
| 536 "InvokeAccessorGetterCallback"); | 526 "InvokeAccessorGetterCallback"); |
| 537 | 527 |
| 528 // Debug addresses |
| 529 Add(ExternalReference::debug_after_break_target_address(isolate).address(), |
| 530 UNCLASSIFIED, |
| 531 67, |
| 532 "Debug::after_break_target_address()"); |
| 533 |
| 534 Add(ExternalReference::debug_restarter_frame_function_pointer_address( |
| 535 isolate).address(), |
| 536 UNCLASSIFIED, |
| 537 68, |
| 538 "Debug::restarter_frame_function_pointer_address()"); |
| 539 |
| 538 // Add a small set of deopt entry addresses to encoder without generating the | 540 // Add a small set of deopt entry addresses to encoder without generating the |
| 539 // deopt table code, which isn't possible at deserialization time. | 541 // deopt table code, which isn't possible at deserialization time. |
| 540 HandleScope scope(isolate); | 542 HandleScope scope(isolate); |
| 541 for (int entry = 0; entry < kDeoptTableSerializeEntryCount; ++entry) { | 543 for (int entry = 0; entry < kDeoptTableSerializeEntryCount; ++entry) { |
| 542 Address address = Deoptimizer::GetDeoptimizationEntry( | 544 Address address = Deoptimizer::GetDeoptimizationEntry( |
| 543 isolate, | 545 isolate, |
| 544 entry, | 546 entry, |
| 545 Deoptimizer::LAZY, | 547 Deoptimizer::LAZY, |
| 546 Deoptimizer::CALCULATE_ENTRY_ADDRESS); | 548 Deoptimizer::CALCULATE_ENTRY_ADDRESS); |
| 547 Add(address, LAZY_DEOPTIMIZATION, entry, "lazy_deopt"); | 549 Add(address, LAZY_DEOPTIMIZATION, entry, "lazy_deopt"); |
| 548 } | 550 } |
| 549 } | 551 } |
| 550 | 552 |
| 551 | 553 |
| 552 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) | 554 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) |
| 553 : encodings_(HashMap::PointersMatch), | 555 : encodings_(HashMap::PointersMatch), |
| 554 isolate_(isolate) { | 556 isolate_(isolate) { |
| 555 ExternalReferenceTable* external_references = | 557 ExternalReferenceTable* external_references = |
| 556 ExternalReferenceTable::instance(isolate_); | 558 ExternalReferenceTable::instance(isolate_); |
| 557 for (int i = 0; i < external_references->size(); ++i) { | 559 for (int i = 0; i < external_references->size(); ++i) { |
| 558 Put(external_references->address(i), i); | 560 Put(external_references->address(i), i); |
| 559 } | 561 } |
| 560 } | 562 } |
| 561 | 563 |
| 562 | 564 |
| 563 uint32_t ExternalReferenceEncoder::Encode(Address key) const { | 565 uint32_t ExternalReferenceEncoder::Encode(Address key) const { |
| 564 int index = IndexOf(key); | 566 int index = IndexOf(key); |
| 565 ASSERT(key == NULL || index >= 0); | 567 ASSERT(key == NULL || index >= 0); |
| 566 return index >=0 ? | 568 return index >= 0 ? |
| 567 ExternalReferenceTable::instance(isolate_)->code(index) : 0; | 569 ExternalReferenceTable::instance(isolate_)->code(index) : 0; |
| 568 } | 570 } |
| 569 | 571 |
| 570 | 572 |
| 571 const char* ExternalReferenceEncoder::NameOfAddress(Address key) const { | 573 const char* ExternalReferenceEncoder::NameOfAddress(Address key) const { |
| 572 int index = IndexOf(key); | 574 int index = IndexOf(key); |
| 573 return index >= 0 ? | 575 return index >= 0 ? |
| 574 ExternalReferenceTable::instance(isolate_)->name(index) : NULL; | 576 ExternalReferenceTable::instance(isolate_)->name(index) : NULL; |
| 575 } | 577 } |
| 576 | 578 |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 | 1867 |
| 1866 bool SnapshotByteSource::AtEOF() { | 1868 bool SnapshotByteSource::AtEOF() { |
| 1867 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1869 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
| 1868 for (int x = position_; x < length_; x++) { | 1870 for (int x = position_; x < length_; x++) { |
| 1869 if (data_[x] != SerializerDeserializer::nop()) return false; | 1871 if (data_[x] != SerializerDeserializer::nop()) return false; |
| 1870 } | 1872 } |
| 1871 return true; | 1873 return true; |
| 1872 } | 1874 } |
| 1873 | 1875 |
| 1874 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
| OLD | NEW |