OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
33 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 33 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
34 | 34 |
35 #ifndef V8_ASSEMBLER_H_ | 35 #ifndef V8_ASSEMBLER_H_ |
36 #define V8_ASSEMBLER_H_ | 36 #define V8_ASSEMBLER_H_ |
37 | 37 |
38 #include "gdb-jit.h" | 38 #include "gdb-jit.h" |
39 #include "runtime.h" | 39 #include "runtime.h" |
40 #include "top.h" | |
41 #include "token.h" | 40 #include "token.h" |
42 | 41 |
43 namespace v8 { | 42 namespace v8 { |
44 namespace internal { | 43 namespace internal { |
45 | 44 |
46 | 45 |
47 // ----------------------------------------------------------------------------- | 46 // ----------------------------------------------------------------------------- |
48 // Common double constants. | 47 // Common double constants. |
49 | 48 |
50 class DoubleConstant: public AllStatic { | 49 class DoubleConstant: public AllStatic { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 310 |
312 // Read/modify the address of a call instruction. This is used to relocate | 311 // Read/modify the address of a call instruction. This is used to relocate |
313 // the break points where straight-line code is patched with a call | 312 // the break points where straight-line code is patched with a call |
314 // instruction. | 313 // instruction. |
315 INLINE(Address call_address()); | 314 INLINE(Address call_address()); |
316 INLINE(void set_call_address(Address target)); | 315 INLINE(void set_call_address(Address target)); |
317 INLINE(Object* call_object()); | 316 INLINE(Object* call_object()); |
318 INLINE(void set_call_object(Object* target)); | 317 INLINE(void set_call_object(Object* target)); |
319 INLINE(Object** call_object_address()); | 318 INLINE(Object** call_object_address()); |
320 | 319 |
321 template<typename StaticVisitor> inline void Visit(); | 320 template<typename StaticVisitor> inline void Visit(Heap* heap); |
322 inline void Visit(ObjectVisitor* v); | 321 inline void Visit(ObjectVisitor* v); |
323 | 322 |
324 // Patch the code with some other code. | 323 // Patch the code with some other code. |
325 void PatchCode(byte* instructions, int instruction_count); | 324 void PatchCode(byte* instructions, int instruction_count); |
326 | 325 |
327 // Patch the code with a call. | 326 // Patch the code with a call. |
328 void PatchCodeWithCall(Address target, int guard_bytes); | 327 void PatchCodeWithCall(Address target, int guard_bytes); |
329 | 328 |
330 // Check whether this return sequence has been patched | 329 // Check whether this return sequence has been patched |
331 // with a call to the debugger. | 330 // with a call to the debugger. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 typedef void* ExternalReferenceRedirector(void* original, Type type); | 502 typedef void* ExternalReferenceRedirector(void* original, Type type); |
504 | 503 |
505 explicit ExternalReference(Builtins::CFunctionId id); | 504 explicit ExternalReference(Builtins::CFunctionId id); |
506 | 505 |
507 explicit ExternalReference(ApiFunction* ptr, Type type); | 506 explicit ExternalReference(ApiFunction* ptr, Type type); |
508 | 507 |
509 explicit ExternalReference(Builtins::Name name); | 508 explicit ExternalReference(Builtins::Name name); |
510 | 509 |
511 explicit ExternalReference(Runtime::FunctionId id); | 510 explicit ExternalReference(Runtime::FunctionId id); |
512 | 511 |
513 explicit ExternalReference(Runtime::Function* f); | 512 explicit ExternalReference(const Runtime::Function* f); |
514 | 513 |
515 explicit ExternalReference(const IC_Utility& ic_utility); | 514 explicit ExternalReference(const IC_Utility& ic_utility); |
516 | 515 |
517 #ifdef ENABLE_DEBUGGER_SUPPORT | 516 #ifdef ENABLE_DEBUGGER_SUPPORT |
518 explicit ExternalReference(const Debug_Address& debug_address); | 517 explicit ExternalReference(const Debug_Address& debug_address); |
519 #endif | 518 #endif |
520 | 519 |
521 explicit ExternalReference(StatsCounter* counter); | 520 explicit ExternalReference(StatsCounter* counter); |
522 | 521 |
523 explicit ExternalReference(Top::AddressId id); | 522 explicit ExternalReference(Isolate::AddressId id); |
524 | 523 |
525 explicit ExternalReference(const SCTableReference& table_ref); | 524 explicit ExternalReference(const SCTableReference& table_ref); |
526 | 525 |
| 526 // Isolate::Current() as an external reference. |
| 527 static ExternalReference isolate_address(); |
| 528 |
527 // One-of-a-kind references. These references are not part of a general | 529 // One-of-a-kind references. These references are not part of a general |
528 // pattern. This means that they have to be added to the | 530 // pattern. This means that they have to be added to the |
529 // ExternalReferenceTable in serialize.cc manually. | 531 // ExternalReferenceTable in serialize.cc manually. |
530 | 532 |
531 static ExternalReference perform_gc_function(); | 533 static ExternalReference perform_gc_function(); |
532 static ExternalReference fill_heap_number_with_random_function(); | 534 static ExternalReference fill_heap_number_with_random_function(); |
533 static ExternalReference random_uint32_function(); | 535 static ExternalReference random_uint32_function(); |
534 static ExternalReference transcendental_cache_array_address(); | 536 static ExternalReference transcendental_cache_array_address(); |
535 static ExternalReference delete_handle_scope_extensions(); | 537 static ExternalReference delete_handle_scope_extensions(); |
536 | 538 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 static ExternalReference re_grow_stack(); | 622 static ExternalReference re_grow_stack(); |
621 | 623 |
622 // byte NativeRegExpMacroAssembler::word_character_bitmap | 624 // byte NativeRegExpMacroAssembler::word_character_bitmap |
623 static ExternalReference re_word_character_map(); | 625 static ExternalReference re_word_character_map(); |
624 | 626 |
625 #endif | 627 #endif |
626 | 628 |
627 // This lets you register a function that rewrites all external references. | 629 // This lets you register a function that rewrites all external references. |
628 // Used by the ARM simulator to catch calls to external references. | 630 // Used by the ARM simulator to catch calls to external references. |
629 static void set_redirector(ExternalReferenceRedirector* redirector) { | 631 static void set_redirector(ExternalReferenceRedirector* redirector) { |
630 ASSERT(redirector_ == NULL); // We can't stack them. | 632 // We can't stack them. |
631 redirector_ = redirector; | 633 ASSERT(Isolate::Current()->external_reference_redirector() == NULL); |
| 634 Isolate::Current()->set_external_reference_redirector( |
| 635 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector)); |
632 } | 636 } |
633 | 637 |
634 private: | 638 private: |
635 explicit ExternalReference(void* address) | 639 explicit ExternalReference(void* address) |
636 : address_(address) {} | 640 : address_(address) {} |
637 | 641 |
638 static ExternalReferenceRedirector* redirector_; | |
639 | |
640 static void* Redirect(void* address, | 642 static void* Redirect(void* address, |
641 Type type = ExternalReference::BUILTIN_CALL) { | 643 Type type = ExternalReference::BUILTIN_CALL) { |
642 if (redirector_ == NULL) return address; | 644 ExternalReferenceRedirector* redirector = |
643 void* answer = (*redirector_)(address, type); | 645 reinterpret_cast<ExternalReferenceRedirector*>( |
| 646 Isolate::Current()->external_reference_redirector()); |
| 647 if (redirector == NULL) return address; |
| 648 void* answer = (*redirector)(address, type); |
644 return answer; | 649 return answer; |
645 } | 650 } |
646 | 651 |
647 static void* Redirect(Address address_arg, | 652 static void* Redirect(Address address_arg, |
648 Type type = ExternalReference::BUILTIN_CALL) { | 653 Type type = ExternalReference::BUILTIN_CALL) { |
| 654 ExternalReferenceRedirector* redirector = |
| 655 reinterpret_cast<ExternalReferenceRedirector*>( |
| 656 Isolate::Current()->external_reference_redirector()); |
649 void* address = reinterpret_cast<void*>(address_arg); | 657 void* address = reinterpret_cast<void*>(address_arg); |
650 void* answer = (redirector_ == NULL) ? | 658 void* answer = (redirector == NULL) ? |
651 address : | 659 address : |
652 (*redirector_)(address, type); | 660 (*redirector)(address, type); |
653 return answer; | 661 return answer; |
654 } | 662 } |
655 | 663 |
656 void* address_; | 664 void* address_; |
657 }; | 665 }; |
658 | 666 |
659 | 667 |
660 // ----------------------------------------------------------------------------- | 668 // ----------------------------------------------------------------------------- |
661 // Position recording support | 669 // Position recording support |
662 | 670 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 return num_bits_set; | 792 return num_bits_set; |
785 } | 793 } |
786 | 794 |
787 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 795 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
788 double power_double_int(double x, int y); | 796 double power_double_int(double x, int y); |
789 double power_double_double(double x, double y); | 797 double power_double_double(double x, double y); |
790 | 798 |
791 } } // namespace v8::internal | 799 } } // namespace v8::internal |
792 | 800 |
793 #endif // V8_ASSEMBLER_H_ | 801 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |