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

Side by Side Diff: src/serialize.cc

Issue 6713074: Require an isolate parameter for most external reference creation to (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Further cleanup Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/x64/assembler-x64.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 struct ExternalReferenceEntry { 96 struct ExternalReferenceEntry {
97 Address address; 97 Address address;
98 uint32_t code; 98 uint32_t code;
99 const char* name; 99 const char* name;
100 }; 100 };
101 101
102 void PopulateTable(Isolate* isolate); 102 void PopulateTable(Isolate* isolate);
103 103
104 // For a few types of references, we can get their address from their id. 104 // For a few types of references, we can get their address from their id.
105 void AddFromId(TypeCode type, uint16_t id, const char* name); 105 void AddFromId(TypeCode type,
106 uint16_t id,
107 const char* name,
108 Isolate* isolate);
106 109
107 // For other types of references, the caller will figure out the address. 110 // For other types of references, the caller will figure out the address.
108 void Add(Address address, TypeCode type, uint16_t id, const char* name); 111 void Add(Address address, TypeCode type, uint16_t id, const char* name);
109 112
110 List<ExternalReferenceEntry> refs_; 113 List<ExternalReferenceEntry> refs_;
111 int max_id_[kTypeCodeCount]; 114 int max_id_[kTypeCodeCount];
112 }; 115 };
113 116
114 117
115 void ExternalReferenceTable::AddFromId(TypeCode type, 118 void ExternalReferenceTable::AddFromId(TypeCode type,
116 uint16_t id, 119 uint16_t id,
117 const char* name) { 120 const char* name,
121 Isolate* isolate) {
118 Address address; 122 Address address;
119 switch (type) { 123 switch (type) {
120 case C_BUILTIN: { 124 case C_BUILTIN: {
121 ExternalReference ref(static_cast<Builtins::CFunctionId>(id)); 125 ExternalReference ref(static_cast<Builtins::CFunctionId>(id), isolate);
122 address = ref.address(); 126 address = ref.address();
123 break; 127 break;
124 } 128 }
125 case BUILTIN: { 129 case BUILTIN: {
126 ExternalReference ref(static_cast<Builtins::Name>(id)); 130 ExternalReference ref(static_cast<Builtins::Name>(id), isolate);
127 address = ref.address(); 131 address = ref.address();
128 break; 132 break;
129 } 133 }
130 case RUNTIME_FUNCTION: { 134 case RUNTIME_FUNCTION: {
131 ExternalReference ref(static_cast<Runtime::FunctionId>(id)); 135 ExternalReference ref(static_cast<Runtime::FunctionId>(id), isolate);
132 address = ref.address(); 136 address = ref.address();
133 break; 137 break;
134 } 138 }
135 case IC_UTILITY: { 139 case IC_UTILITY: {
136 ExternalReference ref(IC_Utility(static_cast<IC::UtilityId>(id))); 140 ExternalReference ref(IC_Utility(static_cast<IC::UtilityId>(id)),
141 isolate);
137 address = ref.address(); 142 address = ref.address();
138 break; 143 break;
139 } 144 }
140 default: 145 default:
141 UNREACHABLE(); 146 UNREACHABLE();
142 return; 147 return;
143 } 148 }
144 Add(address, type, id, name); 149 Add(address, type, id, name);
145 } 150 }
146 151
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 #define IC_ENTRY(name) \ 219 #define IC_ENTRY(name) \
215 { IC_UTILITY, \ 220 { IC_UTILITY, \
216 IC::k##name, \ 221 IC::k##name, \
217 "IC::" #name }, 222 "IC::" #name },
218 223
219 IC_UTIL_LIST(IC_ENTRY) 224 IC_UTIL_LIST(IC_ENTRY)
220 #undef IC_ENTRY 225 #undef IC_ENTRY
221 }; // end of ref_table[]. 226 }; // end of ref_table[].
222 227
223 for (size_t i = 0; i < ARRAY_SIZE(ref_table); ++i) { 228 for (size_t i = 0; i < ARRAY_SIZE(ref_table); ++i) {
224 AddFromId(ref_table[i].type, ref_table[i].id, ref_table[i].name); 229 AddFromId(ref_table[i].type,
230 ref_table[i].id,
231 ref_table[i].name,
232 isolate);
225 } 233 }
226 234
227 #ifdef ENABLE_DEBUGGER_SUPPORT 235 #ifdef ENABLE_DEBUGGER_SUPPORT
228 // Debug addresses 236 // Debug addresses
229 Add(Debug_Address(Debug::k_after_break_target_address).address(isolate), 237 Add(Debug_Address(Debug::k_after_break_target_address).address(isolate),
230 DEBUG_ADDRESS, 238 DEBUG_ADDRESS,
231 Debug::k_after_break_target_address << kDebugIdShift, 239 Debug::k_after_break_target_address << kDebugIdShift,
232 "Debug::after_break_target_address()"); 240 "Debug::after_break_target_address()");
233 Add(Debug_Address(Debug::k_debug_break_slot_address).address(isolate), 241 Add(Debug_Address(Debug::k_debug_break_slot_address).address(isolate),
234 DEBUG_ADDRESS, 242 DEBUG_ADDRESS,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 Add(stub_cache->key_reference(StubCache::kSecondary).address(), 318 Add(stub_cache->key_reference(StubCache::kSecondary).address(),
311 STUB_CACHE_TABLE, 319 STUB_CACHE_TABLE,
312 3, 320 3,
313 "StubCache::secondary_->key"); 321 "StubCache::secondary_->key");
314 Add(stub_cache->value_reference(StubCache::kSecondary).address(), 322 Add(stub_cache->value_reference(StubCache::kSecondary).address(),
315 STUB_CACHE_TABLE, 323 STUB_CACHE_TABLE,
316 4, 324 4,
317 "StubCache::secondary_->value"); 325 "StubCache::secondary_->value");
318 326
319 // Runtime entries 327 // Runtime entries
320 Add(ExternalReference::perform_gc_function().address(), 328 Add(ExternalReference::perform_gc_function(isolate).address(),
321 RUNTIME_ENTRY, 329 RUNTIME_ENTRY,
322 1, 330 1,
323 "Runtime::PerformGC"); 331 "Runtime::PerformGC");
324 Add(ExternalReference::fill_heap_number_with_random_function().address(), 332 Add(ExternalReference::fill_heap_number_with_random_function(
333 isolate).address(),
325 RUNTIME_ENTRY, 334 RUNTIME_ENTRY,
326 2, 335 2,
327 "V8::FillHeapNumberWithRandom"); 336 "V8::FillHeapNumberWithRandom");
328 Add(ExternalReference::random_uint32_function().address(), 337 Add(ExternalReference::random_uint32_function(isolate).address(),
329 RUNTIME_ENTRY, 338 RUNTIME_ENTRY,
330 3, 339 3,
331 "V8::Random"); 340 "V8::Random");
332 Add(ExternalReference::delete_handle_scope_extensions().address(), 341 Add(ExternalReference::delete_handle_scope_extensions(isolate).address(),
333 RUNTIME_ENTRY, 342 RUNTIME_ENTRY,
334 4, 343 4,
335 "HandleScope::DeleteExtensions"); 344 "HandleScope::DeleteExtensions");
336 345
337 // Miscellaneous 346 // Miscellaneous
338 Add(ExternalReference::the_hole_value_location().address(), 347 Add(ExternalReference::the_hole_value_location(isolate).address(),
339 UNCLASSIFIED, 348 UNCLASSIFIED,
340 2, 349 2,
341 "Factory::the_hole_value().location()"); 350 "Factory::the_hole_value().location()");
342 Add(ExternalReference::roots_address().address(), 351 Add(ExternalReference::roots_address(isolate).address(),
343 UNCLASSIFIED, 352 UNCLASSIFIED,
344 3, 353 3,
345 "Heap::roots_address()"); 354 "Heap::roots_address()");
346 Add(ExternalReference::address_of_stack_limit().address(), 355 Add(ExternalReference::address_of_stack_limit(isolate).address(),
347 UNCLASSIFIED, 356 UNCLASSIFIED,
348 4, 357 4,
349 "StackGuard::address_of_jslimit()"); 358 "StackGuard::address_of_jslimit()");
350 Add(ExternalReference::address_of_real_stack_limit().address(), 359 Add(ExternalReference::address_of_real_stack_limit(isolate).address(),
351 UNCLASSIFIED, 360 UNCLASSIFIED,
352 5, 361 5,
353 "StackGuard::address_of_real_jslimit()"); 362 "StackGuard::address_of_real_jslimit()");
354 #ifndef V8_INTERPRETED_REGEXP 363 #ifndef V8_INTERPRETED_REGEXP
355 Add(ExternalReference::address_of_regexp_stack_limit().address(), 364 Add(ExternalReference::address_of_regexp_stack_limit(isolate).address(),
356 UNCLASSIFIED, 365 UNCLASSIFIED,
357 6, 366 6,
358 "RegExpStack::limit_address()"); 367 "RegExpStack::limit_address()");
359 Add(ExternalReference::address_of_regexp_stack_memory_address().address(), 368 Add(ExternalReference::address_of_regexp_stack_memory_address(
369 isolate).address(),
360 UNCLASSIFIED, 370 UNCLASSIFIED,
361 7, 371 7,
362 "RegExpStack::memory_address()"); 372 "RegExpStack::memory_address()");
363 Add(ExternalReference::address_of_regexp_stack_memory_size().address(), 373 Add(ExternalReference::address_of_regexp_stack_memory_size(isolate).address(),
364 UNCLASSIFIED, 374 UNCLASSIFIED,
365 8, 375 8,
366 "RegExpStack::memory_size()"); 376 "RegExpStack::memory_size()");
367 Add(ExternalReference::address_of_static_offsets_vector().address(), 377 Add(ExternalReference::address_of_static_offsets_vector(isolate).address(),
368 UNCLASSIFIED, 378 UNCLASSIFIED,
369 9, 379 9,
370 "OffsetsVector::static_offsets_vector"); 380 "OffsetsVector::static_offsets_vector");
371 #endif // V8_INTERPRETED_REGEXP 381 #endif // V8_INTERPRETED_REGEXP
372 Add(ExternalReference::new_space_start().address(), 382 Add(ExternalReference::new_space_start(isolate).address(),
373 UNCLASSIFIED, 383 UNCLASSIFIED,
374 10, 384 10,
375 "Heap::NewSpaceStart()"); 385 "Heap::NewSpaceStart()");
376 Add(ExternalReference::new_space_mask().address(), 386 Add(ExternalReference::new_space_mask(isolate).address(),
377 UNCLASSIFIED, 387 UNCLASSIFIED,
378 11, 388 11,
379 "Heap::NewSpaceMask()"); 389 "Heap::NewSpaceMask()");
380 Add(ExternalReference::heap_always_allocate_scope_depth().address(), 390 Add(ExternalReference::heap_always_allocate_scope_depth(isolate).address(),
381 UNCLASSIFIED, 391 UNCLASSIFIED,
382 12, 392 12,
383 "Heap::always_allocate_scope_depth()"); 393 "Heap::always_allocate_scope_depth()");
384 Add(ExternalReference::new_space_allocation_limit_address().address(), 394 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(),
385 UNCLASSIFIED, 395 UNCLASSIFIED,
386 13, 396 13,
387 "Heap::NewSpaceAllocationLimitAddress()"); 397 "Heap::NewSpaceAllocationLimitAddress()");
388 Add(ExternalReference::new_space_allocation_top_address().address(), 398 Add(ExternalReference::new_space_allocation_top_address(isolate).address(),
389 UNCLASSIFIED, 399 UNCLASSIFIED,
390 14, 400 14,
391 "Heap::NewSpaceAllocationTopAddress()"); 401 "Heap::NewSpaceAllocationTopAddress()");
392 #ifdef ENABLE_DEBUGGER_SUPPORT 402 #ifdef ENABLE_DEBUGGER_SUPPORT
393 Add(ExternalReference::debug_break().address(), 403 Add(ExternalReference::debug_break(isolate).address(),
394 UNCLASSIFIED, 404 UNCLASSIFIED,
395 15, 405 15,
396 "Debug::Break()"); 406 "Debug::Break()");
397 Add(ExternalReference::debug_step_in_fp_address().address(), 407 Add(ExternalReference::debug_step_in_fp_address(isolate).address(),
398 UNCLASSIFIED, 408 UNCLASSIFIED,
399 16, 409 16,
400 "Debug::step_in_fp_addr()"); 410 "Debug::step_in_fp_addr()");
401 #endif 411 #endif
402 Add(ExternalReference::double_fp_operation(Token::ADD).address(), 412 Add(ExternalReference::double_fp_operation(Token::ADD, isolate).address(),
403 UNCLASSIFIED, 413 UNCLASSIFIED,
404 17, 414 17,
405 "add_two_doubles"); 415 "add_two_doubles");
406 Add(ExternalReference::double_fp_operation(Token::SUB).address(), 416 Add(ExternalReference::double_fp_operation(Token::SUB, isolate).address(),
407 UNCLASSIFIED, 417 UNCLASSIFIED,
408 18, 418 18,
409 "sub_two_doubles"); 419 "sub_two_doubles");
410 Add(ExternalReference::double_fp_operation(Token::MUL).address(), 420 Add(ExternalReference::double_fp_operation(Token::MUL, isolate).address(),
411 UNCLASSIFIED, 421 UNCLASSIFIED,
412 19, 422 19,
413 "mul_two_doubles"); 423 "mul_two_doubles");
414 Add(ExternalReference::double_fp_operation(Token::DIV).address(), 424 Add(ExternalReference::double_fp_operation(Token::DIV, isolate).address(),
415 UNCLASSIFIED, 425 UNCLASSIFIED,
416 20, 426 20,
417 "div_two_doubles"); 427 "div_two_doubles");
418 Add(ExternalReference::double_fp_operation(Token::MOD).address(), 428 Add(ExternalReference::double_fp_operation(Token::MOD, isolate).address(),
419 UNCLASSIFIED, 429 UNCLASSIFIED,
420 21, 430 21,
421 "mod_two_doubles"); 431 "mod_two_doubles");
422 Add(ExternalReference::compare_doubles().address(), 432 Add(ExternalReference::compare_doubles(isolate).address(),
423 UNCLASSIFIED, 433 UNCLASSIFIED,
424 22, 434 22,
425 "compare_doubles"); 435 "compare_doubles");
426 #ifndef V8_INTERPRETED_REGEXP 436 #ifndef V8_INTERPRETED_REGEXP
427 Add(ExternalReference::re_case_insensitive_compare_uc16().address(), 437 Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(),
428 UNCLASSIFIED, 438 UNCLASSIFIED,
429 23, 439 23,
430 "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()"); 440 "NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
431 Add(ExternalReference::re_check_stack_guard_state().address(), 441 Add(ExternalReference::re_check_stack_guard_state(isolate).address(),
432 UNCLASSIFIED, 442 UNCLASSIFIED,
433 24, 443 24,
434 "RegExpMacroAssembler*::CheckStackGuardState()"); 444 "RegExpMacroAssembler*::CheckStackGuardState()");
435 Add(ExternalReference::re_grow_stack().address(), 445 Add(ExternalReference::re_grow_stack(isolate).address(),
436 UNCLASSIFIED, 446 UNCLASSIFIED,
437 25, 447 25,
438 "NativeRegExpMacroAssembler::GrowStack()"); 448 "NativeRegExpMacroAssembler::GrowStack()");
439 Add(ExternalReference::re_word_character_map().address(), 449 Add(ExternalReference::re_word_character_map().address(),
440 UNCLASSIFIED, 450 UNCLASSIFIED,
441 26, 451 26,
442 "NativeRegExpMacroAssembler::word_character_map"); 452 "NativeRegExpMacroAssembler::word_character_map");
443 #endif // V8_INTERPRETED_REGEXP 453 #endif // V8_INTERPRETED_REGEXP
444 // Keyed lookup cache. 454 // Keyed lookup cache.
445 Add(ExternalReference::keyed_lookup_cache_keys().address(), 455 Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(),
446 UNCLASSIFIED, 456 UNCLASSIFIED,
447 27, 457 27,
448 "KeyedLookupCache::keys()"); 458 "KeyedLookupCache::keys()");
449 Add(ExternalReference::keyed_lookup_cache_field_offsets().address(), 459 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(),
450 UNCLASSIFIED, 460 UNCLASSIFIED,
451 28, 461 28,
452 "KeyedLookupCache::field_offsets()"); 462 "KeyedLookupCache::field_offsets()");
453 Add(ExternalReference::transcendental_cache_array_address().address(), 463 Add(ExternalReference::transcendental_cache_array_address(isolate).address(),
454 UNCLASSIFIED, 464 UNCLASSIFIED,
455 29, 465 29,
456 "TranscendentalCache::caches()"); 466 "TranscendentalCache::caches()");
457 Add(ExternalReference::handle_scope_next_address().address(), 467 Add(ExternalReference::handle_scope_next_address().address(),
458 UNCLASSIFIED, 468 UNCLASSIFIED,
459 30, 469 30,
460 "HandleScope::next"); 470 "HandleScope::next");
461 Add(ExternalReference::handle_scope_limit_address().address(), 471 Add(ExternalReference::handle_scope_limit_address().address(),
462 UNCLASSIFIED, 472 UNCLASSIFIED,
463 31, 473 31,
464 "HandleScope::limit"); 474 "HandleScope::limit");
465 Add(ExternalReference::handle_scope_level_address().address(), 475 Add(ExternalReference::handle_scope_level_address().address(),
466 UNCLASSIFIED, 476 UNCLASSIFIED,
467 32, 477 32,
468 "HandleScope::level"); 478 "HandleScope::level");
469 Add(ExternalReference::new_deoptimizer_function().address(), 479 Add(ExternalReference::new_deoptimizer_function(isolate).address(),
470 UNCLASSIFIED, 480 UNCLASSIFIED,
471 33, 481 33,
472 "Deoptimizer::New()"); 482 "Deoptimizer::New()");
473 Add(ExternalReference::compute_output_frames_function().address(), 483 Add(ExternalReference::compute_output_frames_function(isolate).address(),
474 UNCLASSIFIED, 484 UNCLASSIFIED,
475 34, 485 34,
476 "Deoptimizer::ComputeOutputFrames()"); 486 "Deoptimizer::ComputeOutputFrames()");
477 Add(ExternalReference::address_of_min_int().address(), 487 Add(ExternalReference::address_of_min_int().address(),
478 UNCLASSIFIED, 488 UNCLASSIFIED,
479 35, 489 35,
480 "LDoubleConstant::min_int"); 490 "LDoubleConstant::min_int");
481 Add(ExternalReference::address_of_one_half().address(), 491 Add(ExternalReference::address_of_one_half().address(),
482 UNCLASSIFIED, 492 UNCLASSIFIED,
483 36, 493 36,
484 "LDoubleConstant::one_half"); 494 "LDoubleConstant::one_half");
485 Add(ExternalReference::isolate_address().address(), 495 Add(ExternalReference::isolate_address().address(),
486 UNCLASSIFIED, 496 UNCLASSIFIED,
487 37, 497 37,
488 "isolate"); 498 "isolate");
489 Add(ExternalReference::address_of_minus_zero().address(), 499 Add(ExternalReference::address_of_minus_zero().address(),
490 UNCLASSIFIED, 500 UNCLASSIFIED,
491 38, 501 38,
492 "LDoubleConstant::minus_zero"); 502 "LDoubleConstant::minus_zero");
493 Add(ExternalReference::address_of_negative_infinity().address(), 503 Add(ExternalReference::address_of_negative_infinity().address(),
494 UNCLASSIFIED, 504 UNCLASSIFIED,
495 39, 505 39,
496 "LDoubleConstant::negative_infinity"); 506 "LDoubleConstant::negative_infinity");
497 Add(ExternalReference::power_double_double_function().address(), 507 Add(ExternalReference::power_double_double_function(isolate).address(),
498 UNCLASSIFIED, 508 UNCLASSIFIED,
499 40, 509 40,
500 "power_double_double_function"); 510 "power_double_double_function");
501 Add(ExternalReference::power_double_int_function().address(), 511 Add(ExternalReference::power_double_int_function(isolate).address(),
502 UNCLASSIFIED, 512 UNCLASSIFIED,
503 41, 513 41,
504 "power_double_int_function"); 514 "power_double_int_function");
505 Add(ExternalReference::arguments_marker_location().address(), 515 Add(ExternalReference::arguments_marker_location(isolate).address(),
506 UNCLASSIFIED, 516 UNCLASSIFIED,
507 42, 517 42,
508 "Factory::arguments_marker().location()"); 518 "Factory::arguments_marker().location()");
509 } 519 }
510 520
511 521
512 ExternalReferenceEncoder::ExternalReferenceEncoder() 522 ExternalReferenceEncoder::ExternalReferenceEncoder()
513 : encodings_(Match), 523 : encodings_(Match),
514 isolate_(Isolate::Current()) { 524 isolate_(Isolate::Current()) {
515 ExternalReferenceTable* external_references = 525 ExternalReferenceTable* external_references =
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1565 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1556 } 1566 }
1557 } 1567 }
1558 int allocation_address = fullness_[space]; 1568 int allocation_address = fullness_[space];
1559 fullness_[space] = allocation_address + size; 1569 fullness_[space] = allocation_address + size;
1560 return allocation_address; 1570 return allocation_address;
1561 } 1571 }
1562 1572
1563 1573
1564 } } // namespace v8::internal 1574 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698