Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: src/snapshot/serializer-common.cc

Issue 2426913002: Fix android build. (Closed)
Patch Set: actual include the include Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/snapshot/serializer-common.h" 5 #include "src/snapshot/serializer-common.h"
6 6
7 #include "src/external-reference-table.h" 7 #include "src/external-reference-table.h"
8 #include "src/ic/stub-cache.h" 8 #include "src/ic/stub-cache.h"
9 #include "src/list-inl.h" 9 #include "src/list-inl.h"
10 10
11 #if defined(DEBUG) && defined(V8_OS_LINUX) 11 #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
12 #define SYMBOLIZE_FUNCTION
12 #include <execinfo.h> 13 #include <execinfo.h>
13 #endif // DEBUG && V8_OS_LINUX 14 #endif // DEBUG && V8_OS_LINUX && !V8_OS_ANDROID
14 15
15 namespace v8 { 16 namespace v8 {
16 namespace internal { 17 namespace internal {
17 18
18 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) { 19 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) {
19 map_ = isolate->external_reference_map(); 20 map_ = isolate->external_reference_map();
20 if (map_ != NULL) return; 21 if (map_ != NULL) return;
21 map_ = new base::HashMap(); 22 map_ = new base::HashMap();
22 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate); 23 ExternalReferenceTable* table = ExternalReferenceTable::instance(isolate);
23 for (int i = 0; i < table->size(); ++i) { 24 for (int i = 0; i < table->size(); ++i) {
24 Address addr = table->address(i); 25 Address addr = table->address(i);
25 if (addr == ExternalReferenceTable::NotAvailable()) continue; 26 if (addr == ExternalReferenceTable::NotAvailable()) continue;
26 // We expect no duplicate external references entries in the table. 27 // We expect no duplicate external references entries in the table.
27 // AccessorRefTable getter may have duplicates, indicated by an empty string 28 // AccessorRefTable getter may have duplicates, indicated by an empty string
28 // as name. 29 // as name.
29 DCHECK(table->name(i)[0] == '\0' || 30 DCHECK(table->name(i)[0] == '\0' ||
30 map_->Lookup(addr, Hash(addr)) == nullptr); 31 map_->Lookup(addr, Hash(addr)) == nullptr);
31 map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i); 32 map_->LookupOrInsert(addr, Hash(addr))->value = reinterpret_cast<void*>(i);
32 } 33 }
33 isolate->set_external_reference_map(map_); 34 isolate->set_external_reference_map(map_);
34 } 35 }
35 36
36 uint32_t ExternalReferenceEncoder::Encode(Address address) const { 37 uint32_t ExternalReferenceEncoder::Encode(Address address) const {
37 DCHECK_NOT_NULL(address); 38 DCHECK_NOT_NULL(address);
38 base::HashMap::Entry* entry = 39 base::HashMap::Entry* entry =
39 const_cast<base::HashMap*>(map_)->Lookup(address, Hash(address)); 40 const_cast<base::HashMap*>(map_)->Lookup(address, Hash(address));
40 if (entry == nullptr) { 41 if (entry == nullptr) {
41 void* function_addr = address; 42 void* function_addr = address;
42 v8::base::OS::PrintError("Unknown external reference %p.\n", function_addr); 43 v8::base::OS::PrintError("Unknown external reference %p.\n", function_addr);
43 #if defined(DEBUG) && defined(V8_OS_LINUX) 44 #ifdef SYMBOLIZE_FUNCTION
44 v8::base::OS::PrintError("%s\n", backtrace_symbols(&function_addr, 1)[0]); 45 v8::base::OS::PrintError("%s\n", backtrace_symbols(&function_addr, 1)[0]);
45 #endif // DEBUG && V8_OS_LINUX 46 #endif // SYMBOLIZE_FUNCTION
46 v8::base::OS::Abort(); 47 v8::base::OS::Abort();
47 } 48 }
48 return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value)); 49 return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
49 } 50 }
50 51
51 const char* ExternalReferenceEncoder::NameOfAddress(Isolate* isolate, 52 const char* ExternalReferenceEncoder::NameOfAddress(Isolate* isolate,
52 Address address) const { 53 Address address) const {
53 base::HashMap::Entry* entry = 54 base::HashMap::Entry* entry =
54 const_cast<base::HashMap*>(map_)->Lookup(address, Hash(address)); 55 const_cast<base::HashMap*>(map_)->Lookup(address, Hash(address));
55 if (entry == NULL) return "<unknown>"; 56 if (entry == NULL) return "<unknown>";
(...skipping 26 matching lines...) Expand all
82 if (cache->at(i)->IsUndefined(isolate)) break; 83 if (cache->at(i)->IsUndefined(isolate)) break;
83 } 84 }
84 } 85 }
85 86
86 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { 87 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) {
87 return !o->IsString() && !o->IsScript(); 88 return !o->IsString() && !o->IsScript();
88 } 89 }
89 90
90 } // namespace internal 91 } // namespace internal
91 } // namespace v8 92 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698