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

Side by Side Diff: src/assembler.h

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/arm/stub-cache-arm.cc ('k') | src/assembler.cc » ('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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 26 matching lines...) Expand all
37 37
38 #include "gdb-jit.h" 38 #include "gdb-jit.h"
39 #include "runtime.h" 39 #include "runtime.h"
40 #include "token.h" 40 #include "token.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 // ----------------------------------------------------------------------------- 46 // -----------------------------------------------------------------------------
47 // Platform independent assembler base class.
48
49 class AssemblerBase: public Malloced {
50 public:
51 explicit AssemblerBase(Isolate* isolate) : isolate_(isolate) {}
52
53 Isolate* isolate() const { return isolate_; }
54
55 private:
56 Isolate* isolate_;
57 };
58
59 // -----------------------------------------------------------------------------
47 // Common double constants. 60 // Common double constants.
48 61
49 class DoubleConstant: public AllStatic { 62 class DoubleConstant: public AllStatic {
50 public: 63 public:
51 static const double min_int; 64 static const double min_int;
52 static const double one_half; 65 static const double one_half;
53 static const double minus_zero; 66 static const double minus_zero;
54 static const double negative_infinity; 67 static const double negative_infinity;
55 static const double nan; 68 static const double nan;
56 }; 69 };
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // Handle<Value> f(v8::Arguments&) 507 // Handle<Value> f(v8::Arguments&)
495 DIRECT_API_CALL, 508 DIRECT_API_CALL,
496 509
497 // Direct call to accessor getter callback. 510 // Direct call to accessor getter callback.
498 // Handle<value> f(Local<String> property, AccessorInfo& info) 511 // Handle<value> f(Local<String> property, AccessorInfo& info)
499 DIRECT_GETTER_CALL 512 DIRECT_GETTER_CALL
500 }; 513 };
501 514
502 typedef void* ExternalReferenceRedirector(void* original, Type type); 515 typedef void* ExternalReferenceRedirector(void* original, Type type);
503 516
504 explicit ExternalReference(Builtins::CFunctionId id); 517 ExternalReference(Builtins::CFunctionId id, Isolate* isolate);
505 518
506 explicit ExternalReference(ApiFunction* ptr, Type type); 519 ExternalReference(ApiFunction* ptr, Type type, Isolate* isolate);
507 520
508 explicit ExternalReference(Builtins::Name name); 521 ExternalReference(Builtins::Name name, Isolate* isolate);
509 522
510 explicit ExternalReference(Runtime::FunctionId id); 523 ExternalReference(Runtime::FunctionId id, Isolate* isolate);
511 524
512 explicit ExternalReference(const Runtime::Function* f); 525 ExternalReference(const Runtime::Function* f, Isolate* isolate);
513 526
514 explicit ExternalReference(const IC_Utility& ic_utility); 527 ExternalReference(const IC_Utility& ic_utility, Isolate* isolate);
515 528
516 #ifdef ENABLE_DEBUGGER_SUPPORT 529 #ifdef ENABLE_DEBUGGER_SUPPORT
517 explicit ExternalReference(const Debug_Address& debug_address); 530 ExternalReference(const Debug_Address& debug_address, Isolate* isolate);
518 #endif 531 #endif
519 532
520 explicit ExternalReference(StatsCounter* counter); 533 explicit ExternalReference(StatsCounter* counter);
521 534
522 explicit ExternalReference(Isolate::AddressId id); 535 ExternalReference(Isolate::AddressId id, Isolate* isolate);
523 536
524 explicit ExternalReference(const SCTableReference& table_ref); 537 explicit ExternalReference(const SCTableReference& table_ref);
525 538
526 // Isolate::Current() as an external reference. 539 // Isolate::Current() as an external reference.
527 static ExternalReference isolate_address(); 540 static ExternalReference isolate_address();
528 541
529 // One-of-a-kind references. These references are not part of a general 542 // One-of-a-kind references. These references are not part of a general
530 // pattern. This means that they have to be added to the 543 // pattern. This means that they have to be added to the
531 // ExternalReferenceTable in serialize.cc manually. 544 // ExternalReferenceTable in serialize.cc manually.
532 545
533 static ExternalReference perform_gc_function(); 546 static ExternalReference perform_gc_function(Isolate* isolate);
534 static ExternalReference fill_heap_number_with_random_function(); 547 static ExternalReference fill_heap_number_with_random_function(
535 static ExternalReference random_uint32_function(); 548 Isolate* isolate);
536 static ExternalReference transcendental_cache_array_address(); 549 static ExternalReference random_uint32_function(Isolate* isolate);
537 static ExternalReference delete_handle_scope_extensions(); 550 static ExternalReference transcendental_cache_array_address(Isolate* isolate);
551 static ExternalReference delete_handle_scope_extensions(Isolate* isolate);
538 552
539 // Deoptimization support. 553 // Deoptimization support.
540 static ExternalReference new_deoptimizer_function(); 554 static ExternalReference new_deoptimizer_function(Isolate* isolate);
541 static ExternalReference compute_output_frames_function(); 555 static ExternalReference compute_output_frames_function(Isolate* isolate);
542 static ExternalReference global_contexts_list(); 556 static ExternalReference global_contexts_list(Isolate* isolate);
543 557
544 // Static data in the keyed lookup cache. 558 // Static data in the keyed lookup cache.
545 static ExternalReference keyed_lookup_cache_keys(); 559 static ExternalReference keyed_lookup_cache_keys(Isolate* isolate);
546 static ExternalReference keyed_lookup_cache_field_offsets(); 560 static ExternalReference keyed_lookup_cache_field_offsets(Isolate* isolate);
547 561
548 // Static variable Factory::the_hole_value.location() 562 // Static variable Factory::the_hole_value.location()
549 static ExternalReference the_hole_value_location(); 563 static ExternalReference the_hole_value_location(Isolate* isolate);
550 564
551 // Static variable Factory::arguments_marker.location() 565 // Static variable Factory::arguments_marker.location()
552 static ExternalReference arguments_marker_location(); 566 static ExternalReference arguments_marker_location(Isolate* isolate);
553 567
554 // Static variable Heap::roots_address() 568 // Static variable Heap::roots_address()
555 static ExternalReference roots_address(); 569 static ExternalReference roots_address(Isolate* isolate);
556 570
557 // Static variable StackGuard::address_of_jslimit() 571 // Static variable StackGuard::address_of_jslimit()
558 static ExternalReference address_of_stack_limit(); 572 static ExternalReference address_of_stack_limit(Isolate* isolate);
559 573
560 // Static variable StackGuard::address_of_real_jslimit() 574 // Static variable StackGuard::address_of_real_jslimit()
561 static ExternalReference address_of_real_stack_limit(); 575 static ExternalReference address_of_real_stack_limit(Isolate* isolate);
562 576
563 // Static variable RegExpStack::limit_address() 577 // Static variable RegExpStack::limit_address()
564 static ExternalReference address_of_regexp_stack_limit(); 578 static ExternalReference address_of_regexp_stack_limit(Isolate* isolate);
565 579
566 // Static variables for RegExp. 580 // Static variables for RegExp.
567 static ExternalReference address_of_static_offsets_vector(); 581 static ExternalReference address_of_static_offsets_vector(Isolate* isolate);
568 static ExternalReference address_of_regexp_stack_memory_address(); 582 static ExternalReference address_of_regexp_stack_memory_address(
569 static ExternalReference address_of_regexp_stack_memory_size(); 583 Isolate* isolate);
584 static ExternalReference address_of_regexp_stack_memory_size(
585 Isolate* isolate);
570 586
571 // Static variable Heap::NewSpaceStart() 587 // Static variable Heap::NewSpaceStart()
572 static ExternalReference new_space_start(); 588 static ExternalReference new_space_start(Isolate* isolate);
573 static ExternalReference new_space_mask(); 589 static ExternalReference new_space_mask(Isolate* isolate);
574 static ExternalReference heap_always_allocate_scope_depth(); 590 static ExternalReference heap_always_allocate_scope_depth(Isolate* isolate);
575 591
576 // Used for fast allocation in generated code. 592 // Used for fast allocation in generated code.
577 static ExternalReference new_space_allocation_top_address(); 593 static ExternalReference new_space_allocation_top_address(Isolate* isolate);
578 static ExternalReference new_space_allocation_limit_address(); 594 static ExternalReference new_space_allocation_limit_address(Isolate* isolate);
579 595
580 static ExternalReference double_fp_operation(Token::Value operation); 596 static ExternalReference double_fp_operation(Token::Value operation,
581 static ExternalReference compare_doubles(); 597 Isolate* isolate);
582 static ExternalReference power_double_double_function(); 598 static ExternalReference compare_doubles(Isolate* isolate);
583 static ExternalReference power_double_int_function(); 599 static ExternalReference power_double_double_function(Isolate* isolate);
600 static ExternalReference power_double_int_function(Isolate* isolate);
584 601
585 static ExternalReference handle_scope_next_address(); 602 static ExternalReference handle_scope_next_address();
586 static ExternalReference handle_scope_limit_address(); 603 static ExternalReference handle_scope_limit_address();
587 static ExternalReference handle_scope_level_address(); 604 static ExternalReference handle_scope_level_address();
588 605
589 static ExternalReference scheduled_exception_address(); 606 static ExternalReference scheduled_exception_address(Isolate* isolate);
590 607
591 // Static variables containing common double constants. 608 // Static variables containing common double constants.
592 static ExternalReference address_of_min_int(); 609 static ExternalReference address_of_min_int();
593 static ExternalReference address_of_one_half(); 610 static ExternalReference address_of_one_half();
594 static ExternalReference address_of_minus_zero(); 611 static ExternalReference address_of_minus_zero();
595 static ExternalReference address_of_negative_infinity(); 612 static ExternalReference address_of_negative_infinity();
596 static ExternalReference address_of_nan(); 613 static ExternalReference address_of_nan();
597 614
598 static ExternalReference math_sin_double_function(); 615 static ExternalReference math_sin_double_function(Isolate* isolate);
599 static ExternalReference math_cos_double_function(); 616 static ExternalReference math_cos_double_function(Isolate* isolate);
600 static ExternalReference math_log_double_function(); 617 static ExternalReference math_log_double_function(Isolate* isolate);
601 618
602 Address address() const {return reinterpret_cast<Address>(address_);} 619 Address address() const {return reinterpret_cast<Address>(address_);}
603 620
604 #ifdef ENABLE_DEBUGGER_SUPPORT 621 #ifdef ENABLE_DEBUGGER_SUPPORT
605 // Function Debug::Break() 622 // Function Debug::Break()
606 static ExternalReference debug_break(); 623 static ExternalReference debug_break(Isolate* isolate);
607 624
608 // Used to check if single stepping is enabled in generated code. 625 // Used to check if single stepping is enabled in generated code.
609 static ExternalReference debug_step_in_fp_address(); 626 static ExternalReference debug_step_in_fp_address(Isolate* isolate);
610 #endif 627 #endif
611 628
612 #ifndef V8_INTERPRETED_REGEXP 629 #ifndef V8_INTERPRETED_REGEXP
613 // C functions called from RegExp generated code. 630 // C functions called from RegExp generated code.
614 631
615 // Function NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16() 632 // Function NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()
616 static ExternalReference re_case_insensitive_compare_uc16(); 633 static ExternalReference re_case_insensitive_compare_uc16(Isolate* isolate);
617 634
618 // Function RegExpMacroAssembler*::CheckStackGuardState() 635 // Function RegExpMacroAssembler*::CheckStackGuardState()
619 static ExternalReference re_check_stack_guard_state(); 636 static ExternalReference re_check_stack_guard_state(Isolate* isolate);
620 637
621 // Function NativeRegExpMacroAssembler::GrowStack() 638 // Function NativeRegExpMacroAssembler::GrowStack()
622 static ExternalReference re_grow_stack(); 639 static ExternalReference re_grow_stack(Isolate* isolate);
623 640
624 // byte NativeRegExpMacroAssembler::word_character_bitmap 641 // byte NativeRegExpMacroAssembler::word_character_bitmap
625 static ExternalReference re_word_character_map(); 642 static ExternalReference re_word_character_map();
626 643
627 #endif 644 #endif
628 645
629 // This lets you register a function that rewrites all external references. 646 // This lets you register a function that rewrites all external references.
630 // Used by the ARM simulator to catch calls to external references. 647 // Used by the ARM simulator to catch calls to external references.
631 static void set_redirector(ExternalReferenceRedirector* redirector) { 648 static void set_redirector(ExternalReferenceRedirector* redirector) {
632 // We can't stack them. 649 // We can't stack them.
633 ASSERT(Isolate::Current()->external_reference_redirector() == NULL); 650 ASSERT(Isolate::Current()->external_reference_redirector() == NULL);
634 Isolate::Current()->set_external_reference_redirector( 651 Isolate::Current()->set_external_reference_redirector(
635 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector)); 652 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector));
636 } 653 }
637 654
638 private: 655 private:
639 explicit ExternalReference(void* address) 656 explicit ExternalReference(void* address)
640 : address_(address) {} 657 : address_(address) {}
641 658
642 static void* Redirect(void* address, 659 static void* Redirect(Isolate* isolate,
660 void* address,
643 Type type = ExternalReference::BUILTIN_CALL) { 661 Type type = ExternalReference::BUILTIN_CALL) {
644 ExternalReferenceRedirector* redirector = 662 ExternalReferenceRedirector* redirector =
645 reinterpret_cast<ExternalReferenceRedirector*>( 663 reinterpret_cast<ExternalReferenceRedirector*>(
646 Isolate::Current()->external_reference_redirector()); 664 isolate->external_reference_redirector());
647 if (redirector == NULL) return address; 665 if (redirector == NULL) return address;
648 void* answer = (*redirector)(address, type); 666 void* answer = (*redirector)(address, type);
649 return answer; 667 return answer;
650 } 668 }
651 669
652 static void* Redirect(Address address_arg, 670 static void* Redirect(Isolate* isolate,
671 Address address_arg,
653 Type type = ExternalReference::BUILTIN_CALL) { 672 Type type = ExternalReference::BUILTIN_CALL) {
654 ExternalReferenceRedirector* redirector = 673 ExternalReferenceRedirector* redirector =
655 reinterpret_cast<ExternalReferenceRedirector*>( 674 reinterpret_cast<ExternalReferenceRedirector*>(
656 Isolate::Current()->external_reference_redirector()); 675 isolate->external_reference_redirector());
657 void* address = reinterpret_cast<void*>(address_arg); 676 void* address = reinterpret_cast<void*>(address_arg);
658 void* answer = (redirector == NULL) ? 677 void* answer = (redirector == NULL) ?
659 address : 678 address :
660 (*redirector)(address, type); 679 (*redirector)(address, type);
661 return answer; 680 return answer;
662 } 681 }
663 682
664 void* address_; 683 void* address_;
665 }; 684 };
666 685
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 return num_bits_set; 811 return num_bits_set;
793 } 812 }
794 813
795 // Computes pow(x, y) with the special cases in the spec for Math.pow. 814 // Computes pow(x, y) with the special cases in the spec for Math.pow.
796 double power_double_int(double x, int y); 815 double power_double_int(double x, int y);
797 double power_double_double(double x, double y); 816 double power_double_double(double x, double y);
798 817
799 } } // namespace v8::internal 818 } } // namespace v8::internal
800 819
801 #endif // V8_ASSEMBLER_H_ 820 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698