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

Side by Side Diff: src/external-reference-table.cc

Issue 2490783004: [serializer] small fixes for blink snapshot. (Closed)
Patch Set: rebase and fix Created 4 years, 1 month 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 | « src/external-reference-table.h ('k') | src/isolate.h » ('j') | 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/external-reference-table.h" 5 #include "src/external-reference-table.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/builtins/builtins.h" 9 #include "src/builtins/builtins.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 13 matching lines...) Expand all
24 ExternalReferenceTable* external_reference_table = 24 ExternalReferenceTable* external_reference_table =
25 isolate->external_reference_table(); 25 isolate->external_reference_table();
26 if (external_reference_table == NULL) { 26 if (external_reference_table == NULL) {
27 external_reference_table = new ExternalReferenceTable(isolate); 27 external_reference_table = new ExternalReferenceTable(isolate);
28 isolate->set_external_reference_table(external_reference_table); 28 isolate->set_external_reference_table(external_reference_table);
29 } 29 }
30 return external_reference_table; 30 return external_reference_table;
31 } 31 }
32 32
33 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) { 33 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
34 // nullptr is preserved through serialization/deserialization.
35 Add(nullptr, "nullptr");
34 AddReferences(isolate); 36 AddReferences(isolate);
35 AddBuiltins(isolate); 37 AddBuiltins(isolate);
36 AddRuntimeFunctions(isolate); 38 AddRuntimeFunctions(isolate);
37 AddStatCounters(isolate);
38 AddIsolateAddresses(isolate); 39 AddIsolateAddresses(isolate);
39 AddAccessors(isolate); 40 AddAccessors(isolate);
40 AddStubCache(isolate); 41 AddStubCache(isolate);
41 AddDeoptEntries(isolate); 42 AddDeoptEntries(isolate);
42 AddApiReferences(isolate); 43 AddApiReferences(isolate);
43 } 44 }
44 45
45 void ExternalReferenceTable::AddReferences(Isolate* isolate) { 46 void ExternalReferenceTable::AddReferences(Isolate* isolate) {
46 // Miscellaneous 47 // Miscellaneous
47 Add(ExternalReference::roots_array_start(isolate).address(), 48 Add(ExternalReference::roots_array_start(isolate).address(),
(...skipping 18 matching lines...) Expand all
66 "Deoptimizer::New()"); 67 "Deoptimizer::New()");
67 Add(ExternalReference::compute_output_frames_function(isolate).address(), 68 Add(ExternalReference::compute_output_frames_function(isolate).address(),
68 "Deoptimizer::ComputeOutputFrames()"); 69 "Deoptimizer::ComputeOutputFrames()");
69 Add(ExternalReference::address_of_min_int().address(), 70 Add(ExternalReference::address_of_min_int().address(),
70 "LDoubleConstant::min_int"); 71 "LDoubleConstant::min_int");
71 Add(ExternalReference::address_of_one_half().address(), 72 Add(ExternalReference::address_of_one_half().address(),
72 "LDoubleConstant::one_half"); 73 "LDoubleConstant::one_half");
73 Add(ExternalReference::isolate_address(isolate).address(), "isolate"); 74 Add(ExternalReference::isolate_address(isolate).address(), "isolate");
74 Add(ExternalReference::interpreter_dispatch_table_address(isolate).address(), 75 Add(ExternalReference::interpreter_dispatch_table_address(isolate).address(),
75 "Interpreter::dispatch_table_address"); 76 "Interpreter::dispatch_table_address");
76 Add(ExternalReference::interpreter_dispatch_counters(isolate).address(),
77 "Interpreter::interpreter_dispatch_counters");
78 Add(ExternalReference::address_of_negative_infinity().address(), 77 Add(ExternalReference::address_of_negative_infinity().address(),
79 "LDoubleConstant::negative_infinity"); 78 "LDoubleConstant::negative_infinity");
80 Add(ExternalReference::power_double_double_function(isolate).address(), 79 Add(ExternalReference::power_double_double_function(isolate).address(),
81 "power_double_double_function"); 80 "power_double_double_function");
82 Add(ExternalReference::ieee754_acos_function(isolate).address(), 81 Add(ExternalReference::ieee754_acos_function(isolate).address(),
83 "base::ieee754::acos"); 82 "base::ieee754::acos");
84 Add(ExternalReference::ieee754_acosh_function(isolate).address(), 83 Add(ExternalReference::ieee754_acosh_function(isolate).address(),
85 "base::ieee754::acosh"); 84 "base::ieee754::acosh");
86 Add(ExternalReference::ieee754_asin_function(isolate).address(), 85 Add(ExternalReference::ieee754_asin_function(isolate).address(),
87 "base::ieee754::asin"); 86 "base::ieee754::asin");
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 FOR_EACH_INTRINSIC(RUNTIME_ENTRY) 307 FOR_EACH_INTRINSIC(RUNTIME_ENTRY)
309 #undef RUNTIME_ENTRY 308 #undef RUNTIME_ENTRY
310 }; 309 };
311 310
312 for (unsigned i = 0; i < arraysize(runtime_functions); ++i) { 311 for (unsigned i = 0; i < arraysize(runtime_functions); ++i) {
313 ExternalReference ref(runtime_functions[i].id, isolate); 312 ExternalReference ref(runtime_functions[i].id, isolate);
314 Add(ref.address(), runtime_functions[i].name); 313 Add(ref.address(), runtime_functions[i].name);
315 } 314 }
316 } 315 }
317 316
318 void ExternalReferenceTable::AddStatCounters(Isolate* isolate) {
319 // Stat counters
320 struct StatsRefTableEntry {
321 StatsCounter* (Counters::*counter)();
322 const char* name;
323 };
324
325 static const StatsRefTableEntry stats_ref_table[] = {
326 #define COUNTER_ENTRY(name, caption) {&Counters::name, "Counters::" #name},
327 STATS_COUNTER_LIST_1(COUNTER_ENTRY) STATS_COUNTER_LIST_2(COUNTER_ENTRY)
328 #undef COUNTER_ENTRY
329 };
330
331 Counters* counters = isolate->counters();
332 for (unsigned i = 0; i < arraysize(stats_ref_table); ++i) {
333 // To make sure the indices are not dependent on whether counters are
334 // enabled, use a dummy address as filler.
335 Address address = NotAvailable();
336 StatsCounter* counter = (counters->*(stats_ref_table[i].counter))();
337 if (counter->Enabled()) {
338 address = reinterpret_cast<Address>(counter->GetInternalPointer());
339 }
340 Add(address, stats_ref_table[i].name);
341 }
342 }
343
344 void ExternalReferenceTable::AddIsolateAddresses(Isolate* isolate) { 317 void ExternalReferenceTable::AddIsolateAddresses(Isolate* isolate) {
345 // Top addresses 318 // Top addresses
346 static const char* address_names[] = { 319 static const char* address_names[] = {
347 #define BUILD_NAME_LITERAL(Name, name) "Isolate::" #name "_address", 320 #define BUILD_NAME_LITERAL(Name, name) "Isolate::" #name "_address",
348 FOR_EACH_ISOLATE_ADDRESS_NAME(BUILD_NAME_LITERAL) NULL 321 FOR_EACH_ISOLATE_ADDRESS_NAME(BUILD_NAME_LITERAL) NULL
349 #undef BUILD_NAME_LITERAL 322 #undef BUILD_NAME_LITERAL
350 }; 323 };
351 324
352 for (int i = 0; i < Isolate::kIsolateAddressCount; ++i) { 325 for (int i = 0; i < Isolate::kIsolateAddressCount; ++i) {
353 Add(isolate->get_address_from_id(static_cast<Isolate::AddressId>(i)), 326 Add(isolate->get_address_from_id(static_cast<Isolate::AddressId>(i)),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if (api_external_references != nullptr) { 413 if (api_external_references != nullptr) {
441 while (*api_external_references != 0) { 414 while (*api_external_references != 0) {
442 Add(reinterpret_cast<Address>(*api_external_references), "<embedder>"); 415 Add(reinterpret_cast<Address>(*api_external_references), "<embedder>");
443 api_external_references++; 416 api_external_references++;
444 } 417 }
445 } 418 }
446 } 419 }
447 420
448 } // namespace internal 421 } // namespace internal
449 } // namespace v8 422 } // namespace v8
OLDNEW
« no previous file with comments | « src/external-reference-table.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698