| 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 "runtime.h" | 38 #include "runtime.h" |
| 39 #include "token.h" | 39 #include "token.h" |
| 40 #include "objects.h" | |
| 41 | 40 |
| 42 namespace v8 { | 41 namespace v8 { |
| 43 namespace internal { | 42 namespace internal { |
| 44 | 43 |
| 45 | 44 |
| 46 // ----------------------------------------------------------------------------- | 45 // ----------------------------------------------------------------------------- |
| 46 // Common double constants. |
| 47 |
| 48 class DoubleConstant: public AllStatic { |
| 49 public: |
| 50 static const double min_int; |
| 51 static const double one_half; |
| 52 }; |
| 53 |
| 54 |
| 55 // ----------------------------------------------------------------------------- |
| 47 // Labels represent pc locations; they are typically jump or call targets. | 56 // Labels represent pc locations; they are typically jump or call targets. |
| 48 // After declaration, a label can be freely used to denote known or (yet) | 57 // After declaration, a label can be freely used to denote known or (yet) |
| 49 // unknown pc location. Assembler::bind() is used to bind a label to the | 58 // unknown pc location. Assembler::bind() is used to bind a label to the |
| 50 // current pc. A label can be bound only once. | 59 // current pc. A label can be bound only once. |
| 51 | 60 |
| 52 class Label BASE_EMBEDDED { | 61 class Label BASE_EMBEDDED { |
| 53 public: | 62 public: |
| 54 INLINE(Label()) { Unuse(); } | 63 INLINE(Label()) { Unuse(); } |
| 55 INLINE(~Label()) { ASSERT(!is_linked()); } | 64 INLINE(~Label()) { ASSERT(!is_linked()); } |
| 56 | 65 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 static const int kNoPosition = -1; | 175 static const int kNoPosition = -1; |
| 167 | 176 |
| 168 enum Mode { | 177 enum Mode { |
| 169 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 178 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). |
| 170 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. | 179 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. |
| 171 CODE_TARGET_CONTEXT, // Code target used for contextual loads. | 180 CODE_TARGET_CONTEXT, // Code target used for contextual loads. |
| 172 DEBUG_BREAK, // Code target for the debugger statement. | 181 DEBUG_BREAK, // Code target for the debugger statement. |
| 173 CODE_TARGET, // Code target which is not any of the above. | 182 CODE_TARGET, // Code target which is not any of the above. |
| 174 EMBEDDED_OBJECT, | 183 EMBEDDED_OBJECT, |
| 175 | 184 |
| 185 GLOBAL_PROPERTY_CELL, |
| 186 |
| 176 // Everything after runtime_entry (inclusive) is not GC'ed. | 187 // Everything after runtime_entry (inclusive) is not GC'ed. |
| 177 RUNTIME_ENTRY, | 188 RUNTIME_ENTRY, |
| 178 JS_RETURN, // Marks start of the ExitJSFrame code. | 189 JS_RETURN, // Marks start of the ExitJSFrame code. |
| 179 COMMENT, | 190 COMMENT, |
| 180 POSITION, // See comment for kNoPosition above. | 191 POSITION, // See comment for kNoPosition above. |
| 181 STATEMENT_POSITION, // See comment for kNoPosition above. | 192 STATEMENT_POSITION, // See comment for kNoPosition above. |
| 182 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. | 193 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. |
| 183 EXTERNAL_REFERENCE, // The address of an external C++ function. | 194 EXTERNAL_REFERENCE, // The address of an external C++ function. |
| 184 INTERNAL_REFERENCE, // An address inside the same function. | 195 INTERNAL_REFERENCE, // An address inside the same function. |
| 185 | 196 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 257 |
| 247 // Read/modify the code target in the branch/call instruction | 258 // Read/modify the code target in the branch/call instruction |
| 248 // this relocation applies to; | 259 // this relocation applies to; |
| 249 // can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY | 260 // can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY |
| 250 INLINE(Address target_address()); | 261 INLINE(Address target_address()); |
| 251 INLINE(void set_target_address(Address target)); | 262 INLINE(void set_target_address(Address target)); |
| 252 INLINE(Object* target_object()); | 263 INLINE(Object* target_object()); |
| 253 INLINE(Handle<Object> target_object_handle(Assembler* origin)); | 264 INLINE(Handle<Object> target_object_handle(Assembler* origin)); |
| 254 INLINE(Object** target_object_address()); | 265 INLINE(Object** target_object_address()); |
| 255 INLINE(void set_target_object(Object* target)); | 266 INLINE(void set_target_object(Object* target)); |
| 267 INLINE(JSGlobalPropertyCell* target_cell()); |
| 268 INLINE(Handle<JSGlobalPropertyCell> target_cell_handle()); |
| 269 INLINE(void set_target_cell(JSGlobalPropertyCell* cell)); |
| 270 |
| 256 | 271 |
| 257 // Read the address of the word containing the target_address in an | 272 // Read the address of the word containing the target_address in an |
| 258 // instruction stream. What this means exactly is architecture-independent. | 273 // instruction stream. What this means exactly is architecture-independent. |
| 259 // The only architecture-independent user of this function is the serializer. | 274 // The only architecture-independent user of this function is the serializer. |
| 260 // The serializer uses it to find out how many raw bytes of instruction to | 275 // The serializer uses it to find out how many raw bytes of instruction to |
| 261 // output before the next target. Architecture-independent code shouldn't | 276 // output before the next target. Architecture-independent code shouldn't |
| 262 // dereference the pointer it gets back from this. | 277 // dereference the pointer it gets back from this. |
| 263 INLINE(Address target_address_address()); | 278 INLINE(Address target_address_address()); |
| 264 // This indicates how much space a target takes up when deserializing a code | 279 // This indicates how much space a target takes up when deserializing a code |
| 265 // stream. For most architectures this is just the size of a pointer. For | 280 // stream. For most architectures this is just the size of a pointer. For |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // One-of-a-kind references. These references are not part of a general | 491 // One-of-a-kind references. These references are not part of a general |
| 477 // pattern. This means that they have to be added to the | 492 // pattern. This means that they have to be added to the |
| 478 // ExternalReferenceTable in serialize.cc manually. | 493 // ExternalReferenceTable in serialize.cc manually. |
| 479 | 494 |
| 480 static ExternalReference perform_gc_function(); | 495 static ExternalReference perform_gc_function(); |
| 481 static ExternalReference fill_heap_number_with_random_function(); | 496 static ExternalReference fill_heap_number_with_random_function(); |
| 482 static ExternalReference random_uint32_function(); | 497 static ExternalReference random_uint32_function(); |
| 483 static ExternalReference transcendental_cache_array_address(); | 498 static ExternalReference transcendental_cache_array_address(); |
| 484 static ExternalReference delete_handle_scope_extensions(); | 499 static ExternalReference delete_handle_scope_extensions(); |
| 485 | 500 |
| 501 // Deoptimization support. |
| 502 static ExternalReference new_deoptimizer_function(); |
| 503 static ExternalReference compute_output_frames_function(); |
| 504 static ExternalReference global_contexts_list(); |
| 505 |
| 486 // Static data in the keyed lookup cache. | 506 // Static data in the keyed lookup cache. |
| 487 static ExternalReference keyed_lookup_cache_keys(); | 507 static ExternalReference keyed_lookup_cache_keys(); |
| 488 static ExternalReference keyed_lookup_cache_field_offsets(); | 508 static ExternalReference keyed_lookup_cache_field_offsets(); |
| 489 | 509 |
| 490 // Static variable Factory::the_hole_value.location() | 510 // Static variable Factory::the_hole_value.location() |
| 491 static ExternalReference the_hole_value_location(); | 511 static ExternalReference the_hole_value_location(); |
| 492 | 512 |
| 493 // Static variable Heap::roots_address() | 513 // Static variable Heap::roots_address() |
| 494 static ExternalReference roots_address(); | 514 static ExternalReference roots_address(); |
| 495 | 515 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 518 | 538 |
| 519 static ExternalReference double_fp_operation(Token::Value operation); | 539 static ExternalReference double_fp_operation(Token::Value operation); |
| 520 static ExternalReference compare_doubles(); | 540 static ExternalReference compare_doubles(); |
| 521 | 541 |
| 522 static ExternalReference handle_scope_next_address(); | 542 static ExternalReference handle_scope_next_address(); |
| 523 static ExternalReference handle_scope_limit_address(); | 543 static ExternalReference handle_scope_limit_address(); |
| 524 static ExternalReference handle_scope_level_address(); | 544 static ExternalReference handle_scope_level_address(); |
| 525 | 545 |
| 526 static ExternalReference scheduled_exception_address(); | 546 static ExternalReference scheduled_exception_address(); |
| 527 | 547 |
| 548 // Static variables containing common double constants. |
| 549 static ExternalReference address_of_min_int(); |
| 550 static ExternalReference address_of_one_half(); |
| 551 |
| 528 Address address() const {return reinterpret_cast<Address>(address_);} | 552 Address address() const {return reinterpret_cast<Address>(address_);} |
| 529 | 553 |
| 530 #ifdef ENABLE_DEBUGGER_SUPPORT | 554 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 531 // Function Debug::Break() | 555 // Function Debug::Break() |
| 532 static ExternalReference debug_break(); | 556 static ExternalReference debug_break(); |
| 533 | 557 |
| 534 // Used to check if single stepping is enabled in generated code. | 558 // Used to check if single stepping is enabled in generated code. |
| 535 static ExternalReference debug_step_in_fp_address(); | 559 static ExternalReference debug_step_in_fp_address(); |
| 536 #endif | 560 #endif |
| 537 | 561 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 unsigned int num_bits_set; | 708 unsigned int num_bits_set; |
| 685 for (num_bits_set = 0; x; x >>= 1) { | 709 for (num_bits_set = 0; x; x >>= 1) { |
| 686 num_bits_set += x & 1; | 710 num_bits_set += x & 1; |
| 687 } | 711 } |
| 688 return num_bits_set; | 712 return num_bits_set; |
| 689 } | 713 } |
| 690 | 714 |
| 691 } } // namespace v8::internal | 715 } } // namespace v8::internal |
| 692 | 716 |
| 693 #endif // V8_ASSEMBLER_H_ | 717 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |