| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 313 |
| 315 // Read/modify the address of a call instruction. This is used to relocate | 314 // Read/modify the address of a call instruction. This is used to relocate |
| 316 // the break points where straight-line code is patched with a call | 315 // the break points where straight-line code is patched with a call |
| 317 // instruction. | 316 // instruction. |
| 318 INLINE(Address call_address()); | 317 INLINE(Address call_address()); |
| 319 INLINE(void set_call_address(Address target)); | 318 INLINE(void set_call_address(Address target)); |
| 320 INLINE(Object* call_object()); | 319 INLINE(Object* call_object()); |
| 321 INLINE(void set_call_object(Object* target)); | 320 INLINE(void set_call_object(Object* target)); |
| 322 INLINE(Object** call_object_address()); | 321 INLINE(Object** call_object_address()); |
| 323 | 322 |
| 324 template<typename StaticVisitor> inline void Visit(); | 323 template<typename StaticVisitor> inline void Visit(Heap* heap); |
| 325 inline void Visit(ObjectVisitor* v); | 324 inline void Visit(ObjectVisitor* v); |
| 326 | 325 |
| 327 // Patch the code with some other code. | 326 // Patch the code with some other code. |
| 328 void PatchCode(byte* instructions, int instruction_count); | 327 void PatchCode(byte* instructions, int instruction_count); |
| 329 | 328 |
| 330 // Patch the code with a call. | 329 // Patch the code with a call. |
| 331 void PatchCodeWithCall(Address target, int guard_bytes); | 330 void PatchCodeWithCall(Address target, int guard_bytes); |
| 332 | 331 |
| 333 // Check whether this return sequence has been patched | 332 // Check whether this return sequence has been patched |
| 334 // with a call to the debugger. | 333 // with a call to the debugger. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 typedef void* ExternalReferenceRedirector(void* original, Type type); | 505 typedef void* ExternalReferenceRedirector(void* original, Type type); |
| 507 | 506 |
| 508 explicit ExternalReference(Builtins::CFunctionId id); | 507 explicit ExternalReference(Builtins::CFunctionId id); |
| 509 | 508 |
| 510 explicit ExternalReference(ApiFunction* ptr, Type type); | 509 explicit ExternalReference(ApiFunction* ptr, Type type); |
| 511 | 510 |
| 512 explicit ExternalReference(Builtins::Name name); | 511 explicit ExternalReference(Builtins::Name name); |
| 513 | 512 |
| 514 explicit ExternalReference(Runtime::FunctionId id); | 513 explicit ExternalReference(Runtime::FunctionId id); |
| 515 | 514 |
| 516 explicit ExternalReference(Runtime::Function* f); | 515 explicit ExternalReference(const Runtime::Function* f); |
| 517 | 516 |
| 518 explicit ExternalReference(const IC_Utility& ic_utility); | 517 explicit ExternalReference(const IC_Utility& ic_utility); |
| 519 | 518 |
| 520 #ifdef ENABLE_DEBUGGER_SUPPORT | 519 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 521 explicit ExternalReference(const Debug_Address& debug_address); | 520 explicit ExternalReference(const Debug_Address& debug_address); |
| 522 #endif | 521 #endif |
| 523 | 522 |
| 524 explicit ExternalReference(StatsCounter* counter); | 523 explicit ExternalReference(StatsCounter* counter); |
| 525 | 524 |
| 526 explicit ExternalReference(Top::AddressId id); | 525 explicit ExternalReference(Isolate::AddressId id); |
| 527 | 526 |
| 528 explicit ExternalReference(const SCTableReference& table_ref); | 527 explicit ExternalReference(const SCTableReference& table_ref); |
| 529 | 528 |
| 529 // Isolate::Current() as an external reference. |
| 530 static ExternalReference isolate_address(); |
| 531 |
| 530 // One-of-a-kind references. These references are not part of a general | 532 // One-of-a-kind references. These references are not part of a general |
| 531 // pattern. This means that they have to be added to the | 533 // pattern. This means that they have to be added to the |
| 532 // ExternalReferenceTable in serialize.cc manually. | 534 // ExternalReferenceTable in serialize.cc manually. |
| 533 | 535 |
| 534 static ExternalReference incremental_marking_record_write_function(); | 536 static ExternalReference incremental_marking_record_write_function(); |
| 537 static ExternalReference store_buffer_overflow_function(); |
| 535 static ExternalReference perform_gc_function(); | 538 static ExternalReference perform_gc_function(); |
| 536 static ExternalReference fill_heap_number_with_random_function(); | 539 static ExternalReference fill_heap_number_with_random_function(); |
| 537 static ExternalReference random_uint32_function(); | 540 static ExternalReference random_uint32_function(); |
| 538 static ExternalReference transcendental_cache_array_address(); | 541 static ExternalReference transcendental_cache_array_address(); |
| 539 static ExternalReference delete_handle_scope_extensions(); | 542 static ExternalReference delete_handle_scope_extensions(); |
| 540 | 543 |
| 541 // Deoptimization support. | 544 // Deoptimization support. |
| 542 static ExternalReference new_deoptimizer_function(); | 545 static ExternalReference new_deoptimizer_function(); |
| 543 static ExternalReference compute_output_frames_function(); | 546 static ExternalReference compute_output_frames_function(); |
| 544 static ExternalReference global_contexts_list(); | 547 static ExternalReference global_contexts_list(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 static ExternalReference re_grow_stack(); | 630 static ExternalReference re_grow_stack(); |
| 628 | 631 |
| 629 // byte NativeRegExpMacroAssembler::word_character_bitmap | 632 // byte NativeRegExpMacroAssembler::word_character_bitmap |
| 630 static ExternalReference re_word_character_map(); | 633 static ExternalReference re_word_character_map(); |
| 631 | 634 |
| 632 #endif | 635 #endif |
| 633 | 636 |
| 634 // This lets you register a function that rewrites all external references. | 637 // This lets you register a function that rewrites all external references. |
| 635 // Used by the ARM simulator to catch calls to external references. | 638 // Used by the ARM simulator to catch calls to external references. |
| 636 static void set_redirector(ExternalReferenceRedirector* redirector) { | 639 static void set_redirector(ExternalReferenceRedirector* redirector) { |
| 637 ASSERT(redirector_ == NULL); // We can't stack them. | 640 // We can't stack them. |
| 638 redirector_ = redirector; | 641 ASSERT(Isolate::Current()->external_reference_redirector() == NULL); |
| 642 Isolate::Current()->set_external_reference_redirector( |
| 643 reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector)); |
| 639 } | 644 } |
| 640 | 645 |
| 641 private: | 646 private: |
| 642 explicit ExternalReference(void* address) | 647 explicit ExternalReference(void* address) |
| 643 : address_(address) {} | 648 : address_(address) {} |
| 644 | 649 |
| 645 static ExternalReferenceRedirector* redirector_; | |
| 646 | |
| 647 static void* Redirect(void* address, | 650 static void* Redirect(void* address, |
| 648 Type type = ExternalReference::BUILTIN_CALL) { | 651 Type type = ExternalReference::BUILTIN_CALL) { |
| 649 if (redirector_ == NULL) return address; | 652 ExternalReferenceRedirector* redirector = |
| 650 void* answer = (*redirector_)(address, type); | 653 reinterpret_cast<ExternalReferenceRedirector*>( |
| 654 Isolate::Current()->external_reference_redirector()); |
| 655 if (redirector == NULL) return address; |
| 656 void* answer = (*redirector)(address, type); |
| 651 return answer; | 657 return answer; |
| 652 } | 658 } |
| 653 | 659 |
| 654 static void* Redirect(Address address_arg, | 660 static void* Redirect(Address address_arg, |
| 655 Type type = ExternalReference::BUILTIN_CALL) { | 661 Type type = ExternalReference::BUILTIN_CALL) { |
| 662 ExternalReferenceRedirector* redirector = |
| 663 reinterpret_cast<ExternalReferenceRedirector*>( |
| 664 Isolate::Current()->external_reference_redirector()); |
| 656 void* address = reinterpret_cast<void*>(address_arg); | 665 void* address = reinterpret_cast<void*>(address_arg); |
| 657 void* answer = (redirector_ == NULL) ? | 666 void* answer = (redirector == NULL) ? |
| 658 address : | 667 address : |
| 659 (*redirector_)(address, type); | 668 (*redirector)(address, type); |
| 660 return answer; | 669 return answer; |
| 661 } | 670 } |
| 662 | 671 |
| 663 void* address_; | 672 void* address_; |
| 664 }; | 673 }; |
| 665 | 674 |
| 666 | 675 |
| 667 // ----------------------------------------------------------------------------- | 676 // ----------------------------------------------------------------------------- |
| 668 // Position recording support | 677 // Position recording support |
| 669 | 678 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 return num_bits_set; | 800 return num_bits_set; |
| 792 } | 801 } |
| 793 | 802 |
| 794 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 803 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
| 795 double power_double_int(double x, int y); | 804 double power_double_int(double x, int y); |
| 796 double power_double_double(double x, double y); | 805 double power_double_double(double x, double y); |
| 797 | 806 |
| 798 } } // namespace v8::internal | 807 } } // namespace v8::internal |
| 799 | 808 |
| 800 #endif // V8_ASSEMBLER_H_ | 809 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |