OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 bool has_frame_; | 1314 bool has_frame_; |
1315 // This handle will be patched with the code object on installation. | 1315 // This handle will be patched with the code object on installation. |
1316 Handle<Object> code_object_; | 1316 Handle<Object> code_object_; |
1317 | 1317 |
1318 // Needs access to SafepointRegisterStackIndex for optimized frame | 1318 // Needs access to SafepointRegisterStackIndex for optimized frame |
1319 // traversal. | 1319 // traversal. |
1320 friend class OptimizedFrame; | 1320 friend class OptimizedFrame; |
1321 }; | 1321 }; |
1322 | 1322 |
1323 | 1323 |
1324 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1325 // The code patcher is used to patch (typically) small parts of code e.g. for | 1324 // The code patcher is used to patch (typically) small parts of code e.g. for |
1326 // debugging and other types of instrumentation. When using the code patcher | 1325 // debugging and other types of instrumentation. When using the code patcher |
1327 // the exact number of bytes specified must be emitted. It is not legal to emit | 1326 // the exact number of bytes specified must be emitted. It is not legal to emit |
1328 // relocation information. If any of these constraints are violated it causes | 1327 // relocation information. If any of these constraints are violated it causes |
1329 // an assertion to fail. | 1328 // an assertion to fail. |
1330 class CodePatcher { | 1329 class CodePatcher { |
1331 public: | 1330 public: |
1332 CodePatcher(byte* address, int instructions); | 1331 CodePatcher(byte* address, int instructions); |
1333 virtual ~CodePatcher(); | 1332 virtual ~CodePatcher(); |
1334 | 1333 |
1335 // Macro assembler to emit code. | 1334 // Macro assembler to emit code. |
1336 MacroAssembler* masm() { return &masm_; } | 1335 MacroAssembler* masm() { return &masm_; } |
1337 | 1336 |
1338 // Emit an instruction directly. | 1337 // Emit an instruction directly. |
1339 void Emit(Instr instr); | 1338 void Emit(Instr instr); |
1340 | 1339 |
1341 // Emit an address directly. | 1340 // Emit an address directly. |
1342 void Emit(Address addr); | 1341 void Emit(Address addr); |
1343 | 1342 |
1344 // Emit the condition part of an instruction leaving the rest of the current | 1343 // Emit the condition part of an instruction leaving the rest of the current |
1345 // instruction unchanged. | 1344 // instruction unchanged. |
1346 void EmitCondition(Condition cond); | 1345 void EmitCondition(Condition cond); |
1347 | 1346 |
1348 private: | 1347 private: |
1349 byte* address_; // The address of the code being patched. | 1348 byte* address_; // The address of the code being patched. |
1350 int instructions_; // Number of instructions of the expected patch size. | 1349 int instructions_; // Number of instructions of the expected patch size. |
1351 int size_; // Number of bytes of the expected patch size. | 1350 int size_; // Number of bytes of the expected patch size. |
1352 MacroAssembler masm_; // Macro assembler used to generate the code. | 1351 MacroAssembler masm_; // Macro assembler used to generate the code. |
1353 }; | 1352 }; |
1354 #endif // ENABLE_DEBUGGER_SUPPORT | |
1355 | 1353 |
1356 | 1354 |
1357 // ----------------------------------------------------------------------------- | 1355 // ----------------------------------------------------------------------------- |
1358 // Static helper functions. | 1356 // Static helper functions. |
1359 | 1357 |
1360 inline MemOperand ContextOperand(Register context, int index) { | 1358 inline MemOperand ContextOperand(Register context, int index) { |
1361 return MemOperand(context, Context::SlotOffset(index)); | 1359 return MemOperand(context, Context::SlotOffset(index)); |
1362 } | 1360 } |
1363 | 1361 |
1364 | 1362 |
1365 inline MemOperand GlobalObjectOperand() { | 1363 inline MemOperand GlobalObjectOperand() { |
1366 return ContextOperand(cp, Context::GLOBAL_INDEX); | 1364 return ContextOperand(cp, Context::GLOBAL_INDEX); |
1367 } | 1365 } |
1368 | 1366 |
1369 | 1367 |
1370 #ifdef GENERATED_CODE_COVERAGE | 1368 #ifdef GENERATED_CODE_COVERAGE |
1371 #define CODE_COVERAGE_STRINGIFY(x) #x | 1369 #define CODE_COVERAGE_STRINGIFY(x) #x |
1372 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1370 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1373 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1371 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1374 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1372 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1375 #else | 1373 #else |
1376 #define ACCESS_MASM(masm) masm-> | 1374 #define ACCESS_MASM(masm) masm-> |
1377 #endif | 1375 #endif |
1378 | 1376 |
1379 | 1377 |
1380 } } // namespace v8::internal | 1378 } } // namespace v8::internal |
1381 | 1379 |
1382 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1380 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |