| 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 20 matching lines...) Expand all Loading... |
| 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 2012 the V8 project authors. All rights reserved. | 33 // Copyright 2012 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 "src/allocation.h" | 38 #include "src/allocation.h" |
| 39 #include "src/builtins.h" | 39 #include "src/builtins.h" |
| 40 #include "src/isolate.h" | 40 #include "src/isolate.h" |
| 41 #include "src/log.h" |
| 41 #include "src/runtime/runtime.h" | 42 #include "src/runtime/runtime.h" |
| 42 | 43 |
| 43 namespace v8 { | 44 namespace v8 { |
| 44 | 45 |
| 45 // Forward declarations. | 46 // Forward declarations. |
| 46 class ApiFunction; | 47 class ApiFunction; |
| 47 | 48 |
| 48 namespace internal { | 49 namespace internal { |
| 49 | 50 |
| 50 // Forward declarations. | 51 // Forward declarations. |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 current_statement_position(RelocInfo::kNoPosition), | 1079 current_statement_position(RelocInfo::kNoPosition), |
| 1079 written_statement_position(RelocInfo::kNoPosition) {} | 1080 written_statement_position(RelocInfo::kNoPosition) {} |
| 1080 | 1081 |
| 1081 int current_position; | 1082 int current_position; |
| 1082 int written_position; | 1083 int written_position; |
| 1083 | 1084 |
| 1084 int current_statement_position; | 1085 int current_statement_position; |
| 1085 int written_statement_position; | 1086 int written_statement_position; |
| 1086 }; | 1087 }; |
| 1087 | 1088 |
| 1089 class AssemblerPositionsRecorder : public PositionsRecorder { |
| 1090 public: |
| 1091 explicit AssemblerPositionsRecorder(Assembler* assembler) |
| 1092 : assembler_(assembler) {} |
| 1088 | 1093 |
| 1089 class PositionsRecorder BASE_EMBEDDED { | |
| 1090 public: | |
| 1091 explicit PositionsRecorder(Assembler* assembler) | |
| 1092 : assembler_(assembler) { | |
| 1093 jit_handler_data_ = NULL; | |
| 1094 } | |
| 1095 | |
| 1096 void AttachJITHandlerData(void* user_data) { | |
| 1097 jit_handler_data_ = user_data; | |
| 1098 } | |
| 1099 | |
| 1100 void* DetachJITHandlerData() { | |
| 1101 void* old_data = jit_handler_data_; | |
| 1102 jit_handler_data_ = NULL; | |
| 1103 return old_data; | |
| 1104 } | |
| 1105 // Set current position to pos. | 1094 // Set current position to pos. |
| 1106 void RecordPosition(int pos); | 1095 void RecordPosition(int pos); |
| 1107 | 1096 |
| 1108 // Set current statement position to pos. | 1097 // Set current statement position to pos. |
| 1109 void RecordStatementPosition(int pos); | 1098 void RecordStatementPosition(int pos); |
| 1110 | 1099 |
| 1111 // Write recorded positions to relocation information. | 1100 // Write recorded positions to relocation information. |
| 1112 bool WriteRecordedPositions(); | 1101 bool WriteRecordedPositions(); |
| 1113 | 1102 |
| 1114 int current_position() const { return state_.current_position; } | 1103 int current_position() const { return state_.current_position; } |
| 1115 | 1104 |
| 1116 int current_statement_position() const { | 1105 int current_statement_position() const { |
| 1117 return state_.current_statement_position; | 1106 return state_.current_statement_position; |
| 1118 } | 1107 } |
| 1119 | 1108 |
| 1120 private: | 1109 private: |
| 1121 Assembler* assembler_; | 1110 Assembler* assembler_; |
| 1122 PositionState state_; | 1111 PositionState state_; |
| 1123 | 1112 |
| 1124 // Currently jit_handler_data_ is used to store JITHandler-specific data | 1113 DISALLOW_COPY_AND_ASSIGN(AssemblerPositionsRecorder); |
| 1125 // over the lifetime of a PositionsRecorder | |
| 1126 void* jit_handler_data_; | |
| 1127 | |
| 1128 DISALLOW_COPY_AND_ASSIGN(PositionsRecorder); | |
| 1129 }; | 1114 }; |
| 1130 | 1115 |
| 1131 | 1116 |
| 1132 // ----------------------------------------------------------------------------- | 1117 // ----------------------------------------------------------------------------- |
| 1133 // Utility functions | 1118 // Utility functions |
| 1134 | 1119 |
| 1135 inline int NumberOfBitsSet(uint32_t x) { | 1120 inline int NumberOfBitsSet(uint32_t x) { |
| 1136 unsigned int num_bits_set; | 1121 unsigned int num_bits_set; |
| 1137 for (num_bits_set = 0; x; x >>= 1) { | 1122 for (num_bits_set = 0; x; x >>= 1) { |
| 1138 num_bits_set += x & 1; | 1123 num_bits_set += x & 1; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 std::vector<ConstantPoolEntry> shared_entries; | 1281 std::vector<ConstantPoolEntry> shared_entries; |
| 1297 }; | 1282 }; |
| 1298 | 1283 |
| 1299 Label emitted_label_; // Records pc_offset of emitted pool | 1284 Label emitted_label_; // Records pc_offset of emitted pool |
| 1300 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1285 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
| 1301 }; | 1286 }; |
| 1302 | 1287 |
| 1303 } // namespace internal | 1288 } // namespace internal |
| 1304 } // namespace v8 | 1289 } // namespace v8 |
| 1305 #endif // V8_ASSEMBLER_H_ | 1290 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |